Ugly white top and bottom bar removable?

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
            }
        }
    }

Thatā€™s expected (the action bar is not visible, after all). The problem is the top inset not being 0 despite the status bar not being visibleā€¦
That !actionBarVisible check is there because the action bar implementation takes care of the top padding by itself as long as itā€™s visible.

I think my Android knowledge ends here. I would expect it to change depending on full screen or not. All I can tell, something doesnā€™t work. The app always applies a huge inset (72 vertical pixels are lost which is a lot on a 800 screen) and ruins the full screen by doing that

I figured as much :wink: Iā€™ll have a look into it, just be a bit patient, please :wink:

1 Like

Donā€™t worry, thatā€™s not what I meant. Just I donā€™t know enough about Android to help anymore. For the time being I use chrome in full screen. Disabling Google updates made this stable enough. So take the time you need!

Turns out itā€™s indeed an API level issue: an API 29 (Android 10) emulator reproduces the problem, an API 30 (Android 11) emulator doesnā€™t. sigh Iā€™ll see what I can find about this.

Well, that explains why it wasnā€™t noticed before. Good work Sherlock :+1:

PR for fix

1 Like

Missed last message, great news. Any way to tell when itā€™s published (probably in a beta?)?

Yeah, the fix is in latest Beta (3.3.2). We found out in the meantime that it only worked by accident, though, so Iā€™ll need to revisit this change (PR 3293) ā€¦ it turned out the compatibility libraries donā€™t fully work as they should :-/

1 Like

Installed the latest 3.3.3-beta. It solves the issue.

Great work and thanx a lotšŸ‘

Please check version Release 3.3.5-beta Ā· openhab/openhab-android Ā· GitHub to see if thereā€™s a new regression.

@mueller-ma , installed it. Both ā€œnormalā€ and fullscreen work correct on the tablet :+1:

1 Like