Fix navigation drawer not switching screens on first launch#374
Merged
cbalster merged 1 commit intoJun 15, 2026
Merged
Conversation
introduction_view was a second content child of DrawerLayout (no layout_gravity). Showing then hiding it on first launch broke DrawerLayout touch handling, so taps on menu rows closed the drawer instead of selecting the item, and onNavigationItemSelected never fired. Wrap the content and the intro overlay in a single FrameLayout so DrawerLayout has exactly one content child plus the NavigationView drawer. Layout-only change. Fixes criticalmaps#373
cbalster
approved these changes
Jun 15, 2026
Member
|
Hi @richterrene, |
Member
|
Merci @richterrene! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes the first-launch bug where the navigation drawer opens but tapping a menu entry (Chat / Rules / Settings / About) does not switch screens — the app stays on Map until it is force-stopped and relaunched.
Fixes #373.
Root cause
activity_main.xmlgaveDrawerLayouttwo content children plus the drawer:introduction_viewis a full-screen,clickable/focusableview with nolayout_gravity, soDrawerLayouttreats it as a second content view. It is only shown on first launch (until the privacy policy is accepted) and then hidden. Showing then hiding that extra content child leavesDrawerLayout's touch handling broken for the session: taps onNavigationViewrows are swallowed as a "close drawer" gesture, soonNavigationItemSelectednever fires. A restart recreates the hierarchy cleanly and the overlay is never shown again, which is why a restart "fixes" it.Fix
Wrap the content and the intro overlay in a single
FrameLayoutsoDrawerLayouthas exactly one content child plus theNavigationViewdrawer. Layout-only change — no Java changes.Testing
Verified on a Pixel emulator (API 36) against
master:onNavigationItemSelectednever firesConfirmed via
dumpsys activity top(fragment swap) and instrumentedonNavigationItemSelected/onDrawerClosed/navigateTologging on both first-launch and post-restart paths.Note
A Kotlin/Compose rewrite exists on
migrate_to_kotlin_and_compose, butmasterstill ships this Java/XML screen, so this targetsmaster. If the Compose UI replaces this screen, the same "single content child under the drawer" rule should carry over.