corona
corona copied to clipboard
Navigation floating buttons on android
It's necessary some method to detect those Android devices with the floating navigation buttons, and some way to force their display (set them fixed) and know the size they take up to adjust the size of the app allowing these buttons to be seen correctly. I give you an example of spotify and our app (on the same device) so you can see the comparison:
We need the app to look like Spotify, with the navigation buttons fixed at the bottom and with the size of the app adjusted to them.
Does this not fix itself if you call
native.setProperty("androidSystemUiVisibility", "immersiveSticky")
in main.lua?
@gongalf I don't have a device to test if it works as you expected but have you tried using safeActualContentHeight or getSafeAreaInsets?
https://docs.coronalabs.com/api/library/display/getSafeAreaInsets.html https://docs.coronalabs.com/api/library/display/safeActualContentHeight.html
The height of the screen "safe area" in Corona content units. The "safe area" is the rectangular region where it's safe to place important UI elements, ensuring that they are not obscured by status bars, device aspects like a sensor bar or rounded corners, software buttons, TV overscan areas, etc.
I've tried both options and they don't work (it only works on some devices, on others fail). Here is the screenshot of a Xiaomi using "immersiveSticky":
Is this still an issue after release 2020.3619? Safe area APIs should be working as expected now.
Using 2020.3620, I have tested on a Huawei P30 with EMUI 10.1.0 and the safe area is the entire screen (including the status bar and the lower navigation menu). In the capture you can see it with a red veil that fills the entire screen. I have tried with "immersiveSticky", "immersive", "lowProfile" and "default". Any ideas?
Can you share which APIs you are using so we have more information on the ones that are not working?
Do you mean the plugins?
- ["plugin.OneSignal"]
- ["CoronaProvider.native.popup.quickLook"]
- ["CoronaProvider.native.popup.social"]
- ["CoronaProvider.native.popup.activity"]
- ["plugin.imageCrop"]
No, not plugins. I'd want to know which safe area APIs you use so @Shchvova can look into what's wrong.
I used display.safeScreenOriginX, display.safeScreenOriginY, display.safeActualContentWidth, display.safeActualContentHeight and I've just used display.getSafeAreaInsets() in Xiaomi Redmi Note 8 Pro with MIUI 12.0.1.0 (It doesn't work either).
Any progress on this one? It still does not work on device.
as an alternative, would it be possible to find if a device has permanent (hardware) buttons at the bottom?
I think if we know if there are hardware buttons there is no need to shift objects from the bottom, but if there is I will just move it up. This is not a full solution but it would help a lot.
3681 should have fixed safe area and 3686 has the added the ability to check for "hasSoftwareKeys" in getInfo :)