2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/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 01b58d4fc3
commit 1a96c90300

View File

@ -75,14 +75,7 @@ class DefaultThemeManager : ThemeManager {
context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
when (currentNightMode) { when (currentNightMode) {
Configuration.UI_MODE_NIGHT_NO -> { Configuration.UI_MODE_NIGHT_NO -> {
window.decorView.systemUiVisibility = updateLightNavigationBar(onHomeScreen, window, context)
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)
}
} }
Configuration.UI_MODE_NIGHT_YES -> { Configuration.UI_MODE_NIGHT_YES -> {
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility =
@ -93,14 +86,7 @@ class DefaultThemeManager : ThemeManager {
} }
Configuration.UI_MODE_NIGHT_UNDEFINED -> { Configuration.UI_MODE_NIGHT_UNDEFINED -> {
// We assume light here per Android doc's recommendation // We assume light here per Android doc's recommendation
window.decorView.systemUiVisibility = updateLightNavigationBar(onHomeScreen, window, context)
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)
}
} }
} }
} }
@ -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) { private fun updateNavigationBar(onHomeScreen: Boolean, window: Window, context: Context) {
if (onHomeScreen) { if (onHomeScreen) {
window.navigationBarColor = ContextCompat window.navigationBarColor = ContextCompat