Put in some logging. Problem is the actionBarVisible is always false. full screen or not.
2023-02-26 14:16:20.181 28591-28591 insets org.openhab.habdroid D i = Insets{left=0, top=24, right=0, bottom=48}
2023-02-26 14:16:20.182 28591-28591 insets org.openhab.habdroid D actionBarVisible = false
2023-02-26 14:16:20.182 28591-28591 insets org.openhab.habdroid D top = 24
That probably why you put the not (!) in the condition to get it to work? Reading it it should be the other way around. But than it only works for full screen since actionBarVisible will never be true? Or at least on android 10 will never be true.
val t= if (i != null && !actionBarVisible) i.top else 0
made your isFullScreen in AbstractBaseActivity public and used that instead. This works for the statusbar both normal and full screen
private fun updateContentViewForInsets() {
val i = insets?.getInsets(WindowInsetsCompat.Type.systemBars())
//val actionBarVisible = activity.supportActionBar?.isShowing() == true
val actionBarVisible = !activity.isFullscreenEnabled;
val t= if (i != null && actionBarVisible) i.top else 0
Log.d("insets","i = "+i)
Log.d("insets","actionBarVisible = "+actionBarVisible)
Log.d( "insets","top = "+t)
contentView.updatePadding(top = t)
}
Doing the same for the navigationbar also works. Although you need to restart the app after flipping the āfull screenā button in the settings. Probably this also needs to be added to the setFullScreen method
fun enableDrawingBehindStatusBar() {
if (!isFullscreenEnabled) {
Log.d("insert","running enableDrawingBehindStatusBar")
EdgeToEdgeUtils.applyEdgeToEdge(window, true)
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_content)) { view, insets ->
view.updatePadding(bottom = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom)
insets
}
}
}