Skip to content
Snippets Groups Projects
Unverified Commit f88599bc authored by Codrut Topliceanu's avatar Codrut Topliceanu Committed by GitHub
Browse files

For #18667 - Migrated exitImmersiveModeIfNeeded to Fenix (#18699)

parent a9630984
No related branches found
No related tags found
No related merge requests found
......@@ -80,7 +80,6 @@ import mozilla.components.service.sync.logins.DefaultLoginValidationDelegate
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.exitImmersiveModeIfNeeded
import mozilla.components.support.ktx.android.view.hideKeyboard
import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifAnyChanged
import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifChanged
......@@ -110,7 +109,6 @@ import org.mozilla.fenix.downloads.DynamicDownloadDialog
import org.mozilla.fenix.ext.accessibilityManager
import org.mozilla.fenix.ext.breadcrumb
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.enterToImmersiveMode
import org.mozilla.fenix.ext.getPreferenceKey
import org.mozilla.fenix.ext.hideToolbar
import org.mozilla.fenix.ext.metrics
......@@ -130,6 +128,8 @@ import mozilla.components.feature.session.behavior.EngineViewBrowserToolbarBehav
import mozilla.components.feature.webauthn.WebAuthnFeature
import mozilla.components.support.base.feature.ActivityResultHandler
import org.mozilla.fenix.GleanMetrics.PerfStartup
import org.mozilla.fenix.ext.enterToImmersiveMode
import org.mozilla.fenix.ext.exitImmersiveModeIfNeeded
import org.mozilla.fenix.ext.measureNoInline
import mozilla.components.feature.session.behavior.ToolbarPosition as MozacToolbarPosition
......
......@@ -24,6 +24,19 @@ fun Activity.enterToImmersiveMode() {
or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY)
}
/**
* Attempts to come out from immersive mode using the View.
*/
fun Activity.exitImmersiveModeIfNeeded() {
if (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON and window.attributes.flags == 0) {
// We left immersive mode already.
return
}
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE
}
fun Activity.breadcrumb(
message: String,
data: Map<String, String> = emptyMap()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment