Skip to content

fix: pad activities for system bar insets on Android 15+ - #34

Open
cahenesy wants to merge 1 commit into
duhow:mainfrom
cahenesy:fix/edge-to-edge-insets
Open

cahenesy wants to merge 1 commit into
duhow:mainfrom
cahenesy:fix/edge-to-edge-insets

Conversation

@cahenesy

Copy link
Copy Markdown

Fixes #33.

Problem

Android 15 lays apps out edge to edge when they target SDK 35 or higher, so the window extends behind the system bars and the app has to inset its own content. targetSdk is already 35, but nothing in the project consumes window insets — there is no fitsSystemWindows, no WindowInsets handling and no enableEdgeToEdge().

activity_main.xml, activity_workout_history.xml and activity_workout_detail.xml all use a plain LinearLayout with the Toolbar as the first child, so on Android 15+ the toolbar is drawn beneath the status bar. The title collides with the clock and status icons, and the overflow menu lands inside the status bar strip where taps open the notification shade — which makes Settings and Debug unreachable.

Toolbar overlapping the status bar

Change

Adds ui/Insets.kt with a single View.applySystemBarInsets() extension, and calls it on the root view of the three activities right after setContentView.

It consumes systemBars() or displayCutout() — the cutout type matters in landscape on devices with a punch-hole camera, where it is not covered by the system bars alone. The listener returns the insets rather than consuming them, so child views can still react if that is ever needed.

Four files, 35 insertions, no deletions. No behaviour changes beyond padding.

Testing

  • tools/lint.py passes 4/4
  • :app:assembleDebug and :app:assembleRelease both succeed (release exercises R8 full mode and lintVitalRelease)
  • Installed on a Pixel 10 Pro XL running Android 17: the toolbar now sits below the status bar and the overflow menu opens correctly. History and detail screens verified too.
  • Confirmed against an unmodified ed88b46 build first, to be sure the problem was not self-inflicted.

I went with padding the root view because it is the smallest change that fixes all three screens consistently. If you would rather the scrolling content ran under the navigation bar, the alternative is to pad only the top on the root and give the RecyclerView bottom padding with clipToPadding=false — happy to rework it that way if you prefer.

Android 15 lays out apps targeting SDK 35 or later edge to edge, so the
window extends behind the status and navigation bars. All three
activities use a plain LinearLayout with the toolbar as the first child
and none of them consume window insets, so the toolbar is drawn beneath
the status bar.

The result is that the title overlaps the clock and status icons, and
the overflow menu sits inside the status bar strip, where taps open the
notification shade instead of the menu. That makes Settings unreachable
on Android 15 and later.

Add a small applySystemBarInsets() helper and apply it to the root view
of MainActivity, WorkoutHistoryActivity and WorkoutDetailActivity.
@cahenesy

cahenesy commented Sep 9, 2026

Copy link
Copy Markdown
Author

Gentle follow-up on this one. It still applies cleanly to main, and it's been running on a Pixel 10 Pro XL since I opened it with no issues.

Same note as #36: there are no check runs on the head commit here either, which I think means the workflow approval for a first-time contributor is still pending on your side.

The alternative I offered — top padding on the root, bottom padding on the RecyclerView with clipToPadding=false — is still on the table if you'd rather the list scrolled under the navigation bar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Toolbar drawn under the status bar on Android 15+, making the overflow menu untappable

1 participant