Fix bottom nav bar overlap on edge-to-edge displays - #597
Merged
Conversation
PR #585 tried to fix status/nav bar overlap by adding a second setOnApplyWindowInsetsListener on the root content view that returns WindowInsetsCompat.CONSUMED. That competes with the existing listener on the AppBarLayout (which pads it for the status bar) and starves child views of insets needed further down the tree — the same double-counted-inset bug already fixed once for Insights in cd9887a. Instead, extend the established per-view listener pattern (already used for the AppBarLayout here, and for ActivitySettings/DetailsActivity/ InsightsActivity) with one more, non-competing listener on the BottomNavigationView: pad it by the system bars inset (left/right/bottom) so it isn't obscured by the gesture/navigation bar on API 35+, while still propagating insets (return insets, not CONSUMED) instead of consuming them at the root. No IME handling is needed here: the only text input (search) lives in the toolbar, not behind the keyboard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
Fixes the main screen's
BottomNavigationViewbeing obscured by the system gesture/navigation bar on API 35+ (edge-to-edge, which Android 15 enforces).The existing per-activity pattern already pads the toolbar (
appbar) for the top status-bar inset. What was missing on the main screen was bottom inset handling — theBottomNavigationViewat the bottom ofmain.xmlhad no padding for the nav bar. This adds one narrowly-scopedOnApplyWindowInsetsListeneronbottomNavthat pads it by the systemBars left/right/bottom insets (preserving any initial padding) and returnsinsetsso nested consumers still receive them.Relationship to #585
Supersedes and closes #585. That PR (thanks @NYBACHOK for surfacing the issue) added a second, root-level listener on
android.R.id.contentreturningWindowInsetsCompat.CONSUMED. That competes with the existingappbarlistener and swallows insets before they reach the views that need them — the exact double-inset failure mode this project already fixed once incd9887a("Fix doubled top inset gap on Insights toolbar"). This version instead follows the codebase's established single-responsibility, non-consuming inset pattern.Notes
ActivityMain.javachanged (+13 lines); no layout edits.Test plan
🤖 Generated with Claude Code