mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-17 15:26:23 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/1144 - Use System Black Navigation Bar for <API27 + Light Theme
This commit is contained in:
parent
84b638f6ba
commit
572a924f78
@ -64,18 +64,10 @@ class DefaultThemeManager : ThemeManager {
|
||||
onHomeScreen: Boolean = true
|
||||
) {
|
||||
window.statusBarColor = ContextCompat
|
||||
.getColor(context, DefaultThemeManager
|
||||
.resolveAttribute(android.R.attr.statusBarColor, context))
|
||||
|
||||
if (onHomeScreen) {
|
||||
window.navigationBarColor = ContextCompat
|
||||
.getColor(context, DefaultThemeManager
|
||||
.resolveAttribute(R.attr.navigationBarColorHome, context))
|
||||
} else {
|
||||
window.navigationBarColor = ContextCompat
|
||||
.getColor(context, DefaultThemeManager
|
||||
.resolveAttribute(R.attr.navigationBarColorBrowser, context))
|
||||
}
|
||||
.getColor(
|
||||
context, DefaultThemeManager
|
||||
.resolveAttribute(android.R.attr.statusBarColor, context)
|
||||
)
|
||||
|
||||
when (themeManager.currentTheme) {
|
||||
ThemeManager.Theme.Normal -> {
|
||||
@ -87,18 +79,28 @@ class DefaultThemeManager : ThemeManager {
|
||||
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 -> {
|
||||
window.decorView.systemUiVisibility =
|
||||
window.decorView.systemUiVisibility and
|
||||
View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.inv() and
|
||||
View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR.inv()
|
||||
updateNavigationBar(onHomeScreen, window, context)
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -106,8 +108,25 @@ class DefaultThemeManager : ThemeManager {
|
||||
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility and
|
||||
View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.inv() and
|
||||
View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR.inv()
|
||||
updateNavigationBar(onHomeScreen, window, context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateNavigationBar(onHomeScreen: Boolean, window: Window, context: Context) {
|
||||
if (onHomeScreen) {
|
||||
window.navigationBarColor = ContextCompat
|
||||
.getColor(
|
||||
context, DefaultThemeManager
|
||||
.resolveAttribute(R.attr.navigationBarColorHome, context)
|
||||
)
|
||||
} else {
|
||||
window.navigationBarColor = ContextCompat
|
||||
.getColor(
|
||||
context, DefaultThemeManager
|
||||
.resolveAttribute(R.attr.navigationBarColorBrowser, context)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,6 @@
|
||||
sure we also get them in 27+ -->
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowLightStatusBar">@bool/theme_is_light</item>
|
||||
|
||||
<!-- Style the navigation bar -->
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="PrivateTheme" parent="PrivateThemeBase">
|
||||
|
@ -23,6 +23,7 @@
|
||||
<item name="android:windowLightStatusBar">@bool/theme_is_light</item>
|
||||
|
||||
<!-- Style the navigation bar -->
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="android:navigationBarDividerColor">@android:color/transparent</item>
|
||||
<item name="android:windowLightNavigationBar">@bool/theme_is_light</item>
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user