With the arrival of API35, Android 15 devices no longer respond to the previous methods for setting status and nav bar colours, and edgetoedge is also causing issues for many developers.
I have been trying to resolve these, but with limited knowledge and understanding of what is required.
I have been applying new methods to my existing HideBars extension, with some success, can at least set a colour (the same colour) to both the status bar and the nav bar, and "going full screen" still works (hiding bars). Hiding individual bars is a bit quirky, and when I start hiding the title bar as well then fun starts...In terms of apps fitting in the screen, it is suggested to set margins on components that fall outside the edgetoedge display, and disappear either being the status bar or nav bar. I have had some success with this as well using a margin setter method and blocks. As you will see from the aia, there is still much to be resolved. Needs to be tested on an Android 15+ device. Most things work as expected on Android less than 15 devices. All testing so far done with companion app 276u on Google Pixel 8a, Android 16. (and Google Pixel 8 Android 13 - emulator). Also test compiled on Pixel 8a, same behaviours/results.
The method I am using to change the colour of the status and nav bar is this:
@SimpleFunction(description = "sets system bars colours")
public void SetSystemBarsColours(int colour) {
Window scrn = this.activity.getWindow();
if (Build.VERSION.SDK_INT >= 35) {
WindowInsets windowInsets = scrn.getDecorView().getRootWindowInsets();
scrn.getDecorView().setOnApplyWindowInsetsListener((view, insets) -> {
int NavHeight = windowInsets.getInsets(WindowInsets.Type.systemBars()).bottom;
view.setPadding(0, 0, 0, NavHeight);
view.setBackgroundColor(colour);
return insets;
});
} else {
scrn.setStatusBarColor(colour);
scrn.setNavigationBarColor(colour);
}
}
but I am having to refresh the screen twice (hide/show - clock - hide show, as seen in the blocks) for the new colour to be adopted.
Would welcome suggestions and ideas on how to progress this.
Extension code:
HideBars.java.txt (7.5 KB)
Example aia:
hidebarstest2.aia (14.6 KB)
Example aix (built with RUSH):
metricrat.co.uk.hidebars.aix (9.2 KB)
References: