2
0
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/17808: Remove deprecated systemUiVisibility and flags.

This commit is contained in:
mcarare 2021-07-01 18:25:05 +03:00 committed by mergify[bot]
parent abfbbbae16
commit e44cc8ee69

View File

@ -12,11 +12,10 @@ import android.graphics.Color
import android.os.Build import android.os.Build
import android.os.Build.VERSION.SDK_INT import android.os.Build.VERSION.SDK_INT
import android.util.TypedValue import android.util.TypedValue
import android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
import android.view.View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
import android.view.Window import android.view.Window
import androidx.annotation.StyleRes import androidx.annotation.StyleRes
import mozilla.components.support.ktx.android.content.getColorFromAttr import mozilla.components.support.ktx.android.content.getColorFromAttr
import mozilla.components.support.ktx.android.view.getWindowInsetsController
import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.browser.browsingmode.BrowsingMode import org.mozilla.fenix.browser.browsingmode.BrowsingMode
@ -76,38 +75,27 @@ abstract class ThemeManager {
private fun updateLightSystemBars(window: Window, context: Context) { private fun updateLightSystemBars(window: Window, context: Context) {
if (SDK_INT >= Build.VERSION_CODES.M) { if (SDK_INT >= Build.VERSION_CODES.M) {
window.statusBarColor = context.getColorFromAttr(android.R.attr.statusBarColor) window.statusBarColor = context.getColorFromAttr(android.R.attr.statusBarColor)
// This will be addressed on https://github.com/mozilla-mobile/fenix/issues/17808 window.getWindowInsetsController().isAppearanceLightStatusBars = true
@Suppress("DEPRECATION")
window.decorView.systemUiVisibility =
window.decorView.systemUiVisibility or SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
} else { } else {
window.statusBarColor = Color.BLACK window.statusBarColor = Color.BLACK
} }
if (SDK_INT >= Build.VERSION_CODES.O) { if (SDK_INT >= Build.VERSION_CODES.O) {
// API level can display handle light navigation bar color // API level can display handle light navigation bar color
// This will be addressed on https://github.com/mozilla-mobile/fenix/issues/17808 window.getWindowInsetsController().isAppearanceLightNavigationBars = true
@Suppress("DEPRECATION")
window.decorView.systemUiVisibility =
window.decorView.systemUiVisibility or SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
updateNavigationBar(window, context) updateNavigationBar(window, context)
} }
} }
private fun clearLightSystemBars(window: Window) { private fun clearLightSystemBars(window: Window) {
if (SDK_INT >= Build.VERSION_CODES.M) { if (SDK_INT >= Build.VERSION_CODES.M) {
// This will be addressed on https://github.com/mozilla-mobile/fenix/issues/17808 window.getWindowInsetsController().isAppearanceLightStatusBars = false
@Suppress("DEPRECATION")
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility and
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.inv()
} }
if (SDK_INT >= Build.VERSION_CODES.O) { if (SDK_INT >= Build.VERSION_CODES.O) {
// API level can display handle light navigation bar color // API level can display handle light navigation bar color
// This will be addressed on https://github.com/mozilla-mobile/fenix/issues/17808 window.getWindowInsetsController().isAppearanceLightNavigationBars = false
@Suppress("DEPRECATION")
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility and
SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR.inv()
} }
} }