capacitor-statusbar-safe-area icon indicating copy to clipboard operation
capacitor-statusbar-safe-area copied to clipboard

Add support for insets on Android 9 and below

Open Menardi opened this issue 1 year ago • 0 comments

Thanks for this really useful plugin! I use it in an app which has both a transparent status bar and navigation bar, so it's very useful to make sure buttons are not hidden under them.

Currently on Android 9 and below, the plugin always returns 0 for all insets, which was causing buttons to be rendered below the status and navigation bars in my app. This is because the insets are only calculated for Build.VERSION_CODES.Q and above.

This PR adds an else branch to this if check to ensure the insets are returned correctly on Android 9 and below. I have tested it in my app, and the height of the transparent status and navigation bars are returned correctly. getSystemWindowInsets is only supported on Android 10 and above, but the individual calls like getSystemWindowInsetTop are supported down to Android 4.4, which I why I've used those.

Menardi avatar Dec 11 '23 14:12 Menardi