2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-02 03:40:16 +00:00

For #1144 - Only send SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR flag >O

This commit is contained in:
ekager 2019-04-04 20:27:46 -07:00 committed by Colin Lee
parent 3b23ecdc7b
commit 203e2e28c5

View File

@ -75,14 +75,7 @@ class DefaultThemeManager : ThemeManager {
context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
when (currentNightMode) {
Configuration.UI_MODE_NIGHT_NO -> {
window.decorView.systemUiVisibility =
window.decorView.systemUiVisibility or
View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR or
View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.O) {
// API level can display handle light navigation bar color
updateNavigationBar(onHomeScreen, window, context)
}
updateLightNavigationBar(onHomeScreen, window, context)
}
Configuration.UI_MODE_NIGHT_YES -> {
window.decorView.systemUiVisibility =
@ -93,14 +86,7 @@ class DefaultThemeManager : ThemeManager {
}
Configuration.UI_MODE_NIGHT_UNDEFINED -> {
// We assume light here per Android doc's recommendation
window.decorView.systemUiVisibility =
window.decorView.systemUiVisibility or
View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR or
View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.O) {
// API level can display handle light navigation bar color
updateNavigationBar(onHomeScreen, window, context)
}
updateLightNavigationBar(onHomeScreen, window, context)
}
}
}
@ -113,6 +99,21 @@ class DefaultThemeManager : ThemeManager {
}
}
private fun updateLightNavigationBar(onHomeScreen: Boolean, window: Window, context: Context) {
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.O) {
// API level can display handle light navigation bar color
updateNavigationBar(onHomeScreen, window, context)
window.decorView.systemUiVisibility =
window.decorView.systemUiVisibility or
View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR or
View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
} else {
window.decorView.systemUiVisibility =
window.decorView.systemUiVisibility or
View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
}
}
private fun updateNavigationBar(onHomeScreen: Boolean, window: Window, context: Context) {
if (onHomeScreen) {
window.navigationBarColor = ContextCompat