From df5948ac5bfc02e02b0a3486502bbfd82f631b00 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Mon, 27 Jul 2026 23:42:18 +0200 Subject: [PATCH] Take the empty toolbar off the screen Nothing has been left in the options menu: the landing screen carries its own headers, the open action went away with the direct picker, the ad removal moved into the settings section and the document's actions moved down to the buttons by the thumb. What stayed behind is an empty strip of colour at the top of every screen. The bar cannot simply be dropped though - it is where the action modes appear. find, tts and edit are all raised with startSupportActionMode(), and appcompat puts them in the ActionBar's own container, in place of the toolbar. So rather than moving to a .NoActionBar theme, MainActivity hides the bar on start and lets appcompat bring the container back for as long as a mode is up: checkShowingFlags() shows it whenever an action mode is showing, whatever the app asked for, and takes it away again when the mode finishes. That also leaves the window insets alone. ActionBarOverlayLayout keeps the system bar insets off the content and reports the toolbar's height on to the app as an inset of its own, which is what MainActivity's listener pads main_root with - so the find bar pushes the page down by exactly its own height, and nothing pads anything while no mode is up. A NoActionBar theme would swap that decor for a FitWindowsLinearLayout, which pads itself by the system bars on top of the padding MainActivity already applies. The fullscreen hide()/show() pair goes with it: with the bar hidden for good there is nothing left for it to toggle, and show() would have put the empty bar back on leaving fullscreen. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01LrDgmtcnqm8xEUtt42cTDd --- .../opendocument/droid/ui/activity/MainActivity.kt | 12 +++++++----- app/src/main/res/values/themes.xml | 9 +++++++-- 2 files changed, 14 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 30779b51bdfb..70f96a9327fe 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 @@ -177,7 +177,13 @@ class MainActivity : AppCompatActivity(), MenuProvider { WindowInsetsCompat.CONSUMED } - title = "" + // nothing lives in the toolbar any more - the landing screen has its own header and the + // document its buttons - so the bar would just be an empty strip of colour. Hiding it + // rather than moving to a .NoActionBar theme keeps it as the host the action modes are + // raised in: appcompat shows the container again for as long as one is up, and takes it + // back down afterwards, so find, tts and edit still get their bar without the app + // having to put one on screen itself. + supportActionBar?.hide() onBackPressedDispatcher.addCallback(this, backCallback) @@ -480,8 +486,6 @@ class MainActivity : AppCompatActivity(), MenuProvider { WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE insetsController.hide(WindowInsetsCompat.Type.statusBars()) - supportActionBar?.hide() - // delay offer to wait for fullscreen animation to finish handler.postDelayed( { @@ -591,8 +595,6 @@ class MainActivity : AppCompatActivity(), MenuProvider { return } - supportActionBar?.show() - WindowCompat.getInsetsController(window, window.decorView) .show(WindowInsetsCompat.Type.statusBars()) diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 25eb44bca7b9..0dec01cdbb63 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -6,8 +6,13 @@ have to add what is specific to them. Copying the whole theme per qualifier is what let the colours drift apart before. - Not a .NoActionBar variant: there is no Toolbar view anywhere, the app relies on the - default ActionBar and drives it through supportActionBar / startSupportActionMode. + Not a .NoActionBar variant, even though no screen puts anything in the bar any more: + the ActionBar's container is what startSupportActionMode() raises find, tts and edit + in, and appcompat only shows it for as long as one of them is up. MainActivity hides + the bar itself on start, so the container is off screen the rest of the time and the + window inset math stays the one ActionBarOverlayLayout does - which a NoActionBar + theme would swap for a decor that pads itself, on top of the padding MainActivity + applies. -->