Closed jkuester closed 1 year ago
Actually, now that I look at things again, perhaps I can remove some of my code here by combining my solution with @hayribakici's... :thinking: If we just set the bar colors in the theme config we would not have to worry about doing that work in the code. (Though I think we still need to manually set the Dark/Light System UI colors in the code due to Android compatibility issues.) I will give this a shot before merging/closing anything....
Ah, never-mind. I remembered why setting the colors in the theme XMLs will not work. Basically, before Android 8 you cannot make the Android System UI colors compatible with a light background for the navigation bar. So, if you set a white background (or any other super light color) in the theme, then the background will wash out the System UI buttons and make them hard to see. So, I think for now it is best just to handle all the colors programatically. (Technically could include the new theming colors and overwrite all the theme configuration in a values-26
directory, but it seems cleaner to do it all in the code at this point.)
Closes #131
The colors of the Navigation bar at the bottom of the screen have always just been left to the default (dark) system color. This looks fine for the dark themes, but as noted in the issue, it does not look great for the light themes.
@hayribakici set a good initial starting point in this PR, but unfortunately, upon testing I found that modifying the theme resources was not going to work the best across a wide range of Android versions (or at least I could not figure it out).
That PR launched me down the rabbit-hole of trying to understand the right way to do this. I ended up finding layers of different support for various system APIs and functionality all for customizing the look of the status bar at the top and the navigation bar at the bottom.
This PR adds a new
SystemUiManager
class that encapsulates all this logic and will use the proper functionality for the particular Android version the app is running on.I have tested on the following Android versions:
5
- No support for changing the status bar or navigation bar. Both just use the default (Dark) system coloring. Looks as good as it can given the circumstances (themes and hiding the status bar still work).6
- Supports theming the status bar but not the navigation bar. Nav bar still just uses the default (Dark) system coloring.10
- Supports theming both status bar and navigation bar (using the now-deprecatedsystemUiVisibility
flags)13
- Supports theming both status bar and navigation bar (using the newWindowInsetsController
). I also think I fixed an existing bug in Android 13 around the handling of cutouts in the status bar.