Commit b25f807e authored by mcarare's avatar mcarare Committed by mergify[bot]
Browse files

For #17808: Remove deprecated systemUiVisibility and flags.

parent 9b3f3123
Loading
Loading
Loading
Loading
+6 −18
Original line number Original line Diff line number Diff line
@@ -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()
            }
            }
        }
        }