From 752180cf6ece7162945fa4194ffa5d33af3cbc0c Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Sun, 20 Sep 2026 16:16:42 +0200 Subject: [PATCH] Hold the status bar off the window's top, not the content view's The banner moved into the decor's stack, above the content view and the bar an action mode raises. The inset padding stayed on `main_root`, inside the content view, so the status bar was held off the wrong thing: the banner drew behind the clock, and the padding below it left a dead strip the tools strip and the document rode down on. The padding now sits on the stack that holds all three, so the status bar is held off once, for everything in the window. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01FJJdfqpnVCKBNHXjAVxSou --- .../droid/ui/activity/MainActivity.kt | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/app/opendocument/droid/ui/activity/MainActivity.kt b/app/src/main/java/app/opendocument/droid/ui/activity/MainActivity.kt index 1ef95afdc31b..fc7fb345ca02 100644 --- a/app/src/main/java/app/opendocument/droid/ui/activity/MainActivity.kt +++ b/app/src/main/java/app/opendocument/droid/ui/activity/MainActivity.kt @@ -60,6 +60,11 @@ class MainActivity : AppCompatActivity() { // the insets arrived still gets it - see applyWindowInsets private var bottomInset = 0 + /** + * the decor's stack once [liftBanner] has moved the banner into it - see [applyWindowInsets] + */ + private var windowRoot: ViewGroup? = null + private val landingFragment: LandingFragment? get() = supportFragmentManager.findFragmentByTag(LandingFragment.FRAGMENT_TAG) @@ -276,6 +281,7 @@ class MainActivity : AppCompatActivity() { (adContainer.parent as? ViewGroup)?.removeView(adContainer) decor.addView(adContainer, 0) + windowRoot = decor } /** @@ -284,18 +290,23 @@ class MainActivity : AppCompatActivity() { * inset below is zero. * * The bars are not all held off the same way. Left, right and top are padding on the root, so - * nothing at all is drawn behind a cutout or the status bar. The bottom is not: the document is - * meant to run under the gesture bar - a page that stops short of it, with a strip of window - * background below, looks like a rendering fault rather than a decision - so only the things - * that would be *hidden* under it are lifted. The landing screen, whose list ends in a button, - * and [DocumentActions], whose buttons sit in that very corner. + * nothing at all is drawn behind a cutout or the status bar. That root is the decor's stack, + * not this layout: the banner and the bar an action mode raises sit above the content view, so + * padding the content view leaves both of them under the status bar and pads twice below. + * + * The bottom is not padding: the document is meant to run under the gesture bar - a page that + * stops short of it, with a strip of window background below, looks like a rendering fault + * rather than a decision - so only the things that would be *hidden* under it are lifted. The + * landing screen, whose list ends in a button, and [DocumentActions], whose buttons sit in that + * very corner. * * The keyboard is the exception, and gets the document container itself: it covers half the * screen, and while a document is being edited the caret has to stay above it. */ private fun applyWindowInsets() { - ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main_root)) { view, windowInsets - -> + val root: View = windowRoot ?: findViewById(R.id.main_root) + + ViewCompat.setOnApplyWindowInsetsListener(root) { view, windowInsets -> val bars = windowInsets.getInsets( WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout()