You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@SuppressLint("InlinedApi")
private fun hideSystemUi() {
playerView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LOW_PROFILE
or View.SYSTEM_UI_FLAG_FULLSCREEN
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION)
}
how to solve this ?
The text was updated successfully, but these errors were encountered:
You can add a API version check and if you're using API 30+ try out window insets, refer to this video to learn more about window insets and medium post here
I have to admit, insets still feel like a mess and still have a lot of question regarding how to migrate and replace all the window flags with insets. Personally I'd I've managed to achieve the following use-case by doing the following:
/** * Hides both status bar and navigation bar*/fun FragmentActivity.hideStatusBarAndNavigationBar() {
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.R) {
WindowCompat.setDecorFitsSystemWindows(window, true)
val controller =ViewCompat.getWindowInsetsController(window.decorView)
// swipe in system bars, this is now sticky immersive
controller?.systemBarsBehavior =WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE// hide status and navigation bar
controller?.hide(WindowInsets.Type.systemBars())
} else {
// Until I figure out how to hide status bar and nav pre android R using insets
@Suppress("DEPRECATION")
window.decorView.systemUiVisibility =View.SYSTEM_UI_FLAG_LOW_PROFILEorView.SYSTEM_UI_FLAG_FULLSCREENorView.SYSTEM_UI_FLAG_LAYOUT_STABLEorView.SYSTEM_UI_FLAG_IMMERSIVE_STICKYorView.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATIONorView.SYSTEM_UI_FLAG_HIDE_NAVIGATION
}
}
As my comments suggestion the insets work for everything except for hiding status bar in pre-android R so instead since I only use insets if the current version is API 30+
I am trying to follow this step in here https://developer.android.com/codelabs/exoplayer-intro#2
but when I implement
hideSystemUi
method in Kotlin. then code seems deprecatedlike this https://i.stack.imgur.com/uqAUP.png
how to solve this ?
The text was updated successfully, but these errors were encountered: