Window insets does not properly implement fullscreen

Viewed 223

As SystemUiVisibility property has been deprecated, I was trying to replace them in new api with window insets, but faced a problem with displaying fragment in fullscreen - ActionBar is still visible, regardless of using insetsController.hide(WindowInsets.Type.systemBars()) (which must hide all navigation components, including ActionBar, I suppose).

Old version works pretty fine:

activity?.window?.decorView?.systemUiVisibility = (
                View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                        or View.SYSTEM_UI_FLAG_IMMERSIVE
                        or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                        or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                        or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                        or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                        or View.SYSTEM_UI_FLAG_FULLSCREEN
                )

And updated version for using window insets

activity?.window?.apply {
            setDecorFitsSystemWindows(false)
            insetsController?.apply {
                hide(WindowInsets.Type.systemBars())
                systemBarsBehavior = BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
            }
        }
0 Answers
Related