Bug 1851079 – refactored Activity enterImmersiveMode to enable proper unit testing

fenix/120.0
mike a 9 months ago committed by mergify[bot]
parent e62f62ce7d
commit 30ffa11476

@ -99,7 +99,7 @@ import mozilla.components.support.base.feature.ActivityResultHandler
import mozilla.components.support.base.feature.PermissionsFeature
import mozilla.components.support.base.feature.UserInteractionHandler
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
import mozilla.components.support.ktx.android.view.enterToImmersiveMode
import mozilla.components.support.ktx.android.view.enterImmersiveMode
import mozilla.components.support.ktx.android.view.exitImmersiveMode
import mozilla.components.support.ktx.android.view.hideKeyboard
import mozilla.components.support.ktx.kotlin.getOrigin
@ -1508,7 +1508,7 @@ abstract class BaseBrowserFragment :
Toast
.makeText(requireContext(), R.string.full_screen_notification, Toast.LENGTH_SHORT)
.show()
activity?.enterToImmersiveMode()
activity?.enterImmersiveMode()
(view as? SwipeGestureLayout)?.isSwipeEnabled = false
browserToolbarView.collapse()
browserToolbarView.view.isVisible = false

@ -18,7 +18,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.colorResource
import mozilla.components.support.ktx.android.content.getColorFromAttr
import mozilla.components.support.ktx.android.view.getWindowInsetsController
import mozilla.components.support.ktx.android.view.createWindowInsetsController
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
@ -88,14 +88,14 @@ abstract class ThemeManager(
private fun updateLightSystemBars(window: Window, context: Context) {
if (SDK_INT >= Build.VERSION_CODES.M) {
window.statusBarColor = context.getColorFromAttr(android.R.attr.statusBarColor)
window.getWindowInsetsController().isAppearanceLightStatusBars = true
window.createWindowInsetsController().isAppearanceLightStatusBars = true
} else {
window.statusBarColor = Color.BLACK
}
if (SDK_INT >= Build.VERSION_CODES.O) {
// API level can display handle light navigation bar color
window.getWindowInsetsController().isAppearanceLightNavigationBars = true
window.createWindowInsetsController().isAppearanceLightNavigationBars = true
updateNavigationBar(window, context)
}
@ -103,12 +103,12 @@ abstract class ThemeManager(
private fun clearLightSystemBars(window: Window) {
if (SDK_INT >= Build.VERSION_CODES.M) {
window.getWindowInsetsController().isAppearanceLightStatusBars = false
window.createWindowInsetsController().isAppearanceLightStatusBars = false
}
if (SDK_INT >= Build.VERSION_CODES.O) {
// API level can display handle light navigation bar color
window.getWindowInsetsController().isAppearanceLightNavigationBars = false
window.createWindowInsetsController().isAppearanceLightNavigationBars = false
}
}

Loading…
Cancel
Save