Android: add optional on-screen button to open the stream menu #819
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
stale
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-streetpea/chiaki-ng!819
Loading…
Reference in a new issue
No description provided.
Delete branch "MicheleLoiDWR/android-stream-menu-button"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds an optional button at the top of the stream that opens the stream menu (the bar with the on-screen controls switches and display-mode buttons). Off by default.
On the device I tested on (gesture navigation), that menu can't be reopened once it hides. It's shown from the window-insets listener when the system bars appear, but
StreamActivityhides the bars withBEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE. As far as I can tell, in that mode an edge swipe only shows the bars temporarily on top of the app and the app is never notified, so the listener never fires. (Pulling the notification shade down does notify it, which is why the menu sometimes flashes for a split second.) I'd expect other gesture-navigation devices to behave the same, but I've only been able to verify it on this one.What users get
Settings → General:
The button sits at the top-center because that's the one spot the full on-screen controls layout leaves free (its touchpad starts 32dp from the top). The menu hides itself after the existing 2-second timeout, or when the button is tapped again.
Why a button instead of fixing the swipe
I tried restoring swipe-to-open first. The pre-edge-to-edge code used
SYSTEM_UI_FLAG_IMMERSIVE, whose new-API equivalent isBEHAVIOR_DEFAULT. In that mode the app is notified. But with gesture navigation, the same swipe up also starts Android's home gesture, so the app is pulled out of focus while the menu is showing, and the menu closes as soon as focus returns. That makes every accidental edge swipe mid-game worse, so I kept transient bars and added an explicit trigger.While investigating I also noticed that the listener checks
insets.isVisible(Type.systemBars()), and in my testing that never became true, even when the status and navigation bars were both reported visible. I suspect it's becausesystemBars()also includes the caption bar, which a full-screen app doesn't have. It doesn't matter with transient bars (the listener isn't called for swipes anyway), so I left it untouched here.Implementation
StreamActivity: shows and wires the button when enabled (toggleOverlay()). The auto-hide timer now also hides the overlay directly: when it's opened from the button, the system bars never appear, so hiding them wouldn't trigger the insets listener. With the menu opened the existing way, this changes nothing: the overlay hid at the same moment before.activity_stream.xml: the button (32dp, dark circle,ic_overflow), plus a newbg_stream_menu_button.xmlbackground.Preferences/preferences.xml/strings.xml: the two settings.SettingsFragment'sDataStoregets the new keys, including newgetInt/putIntoverrides for the slider.Testing
./gradlew lintDebug: no new warnings on the changed files.Notes
Developed with the assistance of Claude Code, and tested on real hardware as described above.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.