corona icon indicating copy to clipboard operation
corona copied to clipboard

Navigation floating buttons on android

Open gongalf opened this issue 4 years ago • 11 comments

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:

spotify XS ufit365 XS

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.

gongalf avatar Jun 08 '20 10:06 gongalf

Does this not fix itself if you call native.setProperty("androidSystemUiVisibility", "immersiveSticky") in main.lua?

alanthomson avatar Jun 18 '20 12:06 alanthomson

@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.

sekodev avatar Jun 19 '20 23:06 sekodev

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":

WhatsApp Image 2020-06-11 at 15 09 25 (1)

gongalf avatar Jun 20 '20 12:06 gongalf

Is this still an issue after release 2020.3619? Safe area APIs should be working as expected now.

sekodev avatar Oct 10 '20 14:10 sekodev

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?

Captura de pantalla 2020-10-11 a las 18 59 34

gongalf avatar Oct 11 '20 17:10 gongalf

Can you share which APIs you are using so we have more information on the ones that are not working?

sekodev avatar Oct 12 '20 15:10 sekodev

Do you mean the plugins?

  • ["plugin.OneSignal"]
  • ["CoronaProvider.native.popup.quickLook"]
  • ["CoronaProvider.native.popup.social"]
  • ["CoronaProvider.native.popup.activity"]
  • ["plugin.imageCrop"]

gongalf avatar Oct 19 '20 12:10 gongalf

No, not plugins. I'd want to know which safe area APIs you use so @Shchvova can look into what's wrong.

sekodev avatar Oct 19 '20 12:10 sekodev

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).

gongalf avatar Oct 19 '20 13:10 gongalf

Any progress on this one? It still does not work on device.

maciej-czekala avatar Mar 29 '21 21:03 maciej-czekala

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.

maciej-czekala avatar Mar 29 '21 22:03 maciej-czekala

3681 should have fixed safe area and 3686 has the added the ability to check for "hasSoftwareKeys" in getInfo :)

scottrules44 avatar Feb 08 '23 14:02 scottrules44