Let's say I want to opt IN (because Google will soon remove the opt-out option).
And, let's say I want to adjust for the bars insets (overlapping areas) in the activity as a whole.
I could use a solution like the one proposed by MrCoder in this thread:
https://www.b4x.com/android/forum/threads/problem-with-android-version-15-and-higher.166267/ (page 2 has a complete example).
It is very clever. Notice that it's using getInsetsIgnoringVisibility() instead of the getInsets() method. That makes sense, since everything Is running in Activity.create, so the UI probably isn't built yet.
However, I have doubts. It seems to assume that the navigation bar and status bar will be permanently visible afterward. But... Is that 'always true? Can we be sure that the navigation bar is ALWAYS visible when "edge to edge enforcement" is enabled?
Or could there be a specific device that, by default, puts the bars in TRANSIENT visibility mode (SWIPE), even when running API 'level 35 and "edge to edge enforcement" enabled?
If so, the getInsetsIgnoringVisibility() method will return insets > 0, the adjustments will be applied and the app will stop using the overlapped area. However, the bar will only appear momentarily on the screen. To avoid wasting that area, perhaps it would be better to detect this kind of situation and only make the adjustment If the bars are configured by default (in the system) to be ALWAYS visible.
But I haven't found a way to 'detect this configuration. So, my questions are:
- How to know if the system bars default setting configured in the system is ALWAYS visible? (especially the navigation bar)
- Or there are any other workaround ?