Skip to content

Keep all screens clear of the navigation bar - #126

Open
oers wants to merge 5 commits into
developmentfrom
claude/guess-move-insets
Open

oers wants to merge 5 commits into
developmentfrom
claude/guess-move-insets

Conversation

@oers

@oers oers commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

A user on a Samsung S21 couldn't reach the New game button in Guess the best move. Switching the phone to gesture navigation worked around it. Checking the other screens turned up the same problem on two more.

Cause: From Android 15 on, the app draws edge to edge (enforced for targetSdk 35+), so the status and navigation bars lie over the layout. With three-button navigation, anything under the navigation bar can't be tapped; the thin gesture bar leaves it reachable.

Screen Before Now
Guess the best move only the board kept clear; New game under the navigation bar whole screen padded
Main screen only the board kept clear; the buttons below it (start, undo, redo, rotate) under the navigation bar: at the bottom in portrait, at the side in landscape whole frame padded
Settings list ran under both bars; first and last settings partly covered list still scrolls under the bars but ends clear of them

The analysis drawer already kept itself clear. The dialogs are positioned by the system.

How: A small SystemBars.keepClear(view) helper adds the system bars' size to a view's own padding. On Android versions that don't draw edge to edge the insets are 0 and nothing changes. The board's position is unchanged: the top and side padding replace the margins it had.

Test: SystemBarsTest lays out both screen layouts, in portrait and landscape, on a phone-sized screen. It places the navigation bar where three-button navigation puts it and checks that the buttons lie between the bars. It also checks the settings list's padding. The layout checks don't start the activities, because that would occupy the engine for the following tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_01V5G4cWSLBkiNNK4KC3zvXM

From Android 15 on the app draws edge to edge, so the system bars lie
over the layout. The guess move screen only kept its board clear of
them; the "New game" button at the bottom ended up under the navigation
bar. With three-button navigation (reported on a Samsung S21) it could
not be tapped - only switching to gesture navigation, with its thin bar,
made it reachable.

The whole screen is now padded by the system bars, through a small
SystemBars.keepClear() helper. A new test inflates the layout with a
status and a navigation bar and checks the button lies between them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V5G4cWSLBkiNNK4KC3zvXM
The same edge-to-edge problem as on the guess move screen: the main
screen also only kept its board clear of the system bars, so the
buttons below it (back to the start, undo, redo, rotate) lay under the
navigation bar with three-button navigation - at the bottom in portrait,
at the side in landscape. The settings list ran under both bars, so the
first and last settings were partly covered.

The main screen now pads its whole frame like the guess move screen; the
settings list keeps scrolling under the bars but is padded so that it
ends clear of them. SystemBars.keepClear() adds to a view's own padding
instead of replacing it.

SystemBarsTest replaces GuessMoveLayoutTest: both layouts, in portrait
and landscape, with the navigation bar where three-button navigation
puts it, plus the settings list's padding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V5G4cWSLBkiNNK4KC3zvXM
@oers oers changed the title Keep the guess move screen clear of the navigation bar Keep all screens clear of the navigation bar Oct 26, 2026
On Android before 11 (the CI emulator) androidx caps the navigation bar
inset a view in a window gets at the window's real navigation bar - 0
for an app that isn't drawn edge to edge - so the settings list on its
real screen can't show the bottom padding in a test. It now checks the
top there (the list is wired up and scrolls under the bars), and the
padding on every side on a list outside a window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V5G4cWSLBkiNNK4KC3zvXM
In landscape a punch-hole camera (the S21 has one) sits at the side of
the screen, where no system bar covers it; drawn edge to edge, a corner
of the board could end up under it. SystemBars.keepClear() now pads by
the display cutout as well, and SystemBarsTest lays both screens out
with a cutout at the side in landscape.

The emulator CI runs Android 10, where the app isn't drawn edge to edge,
so the layout tests could only simulate the bars. A new job runs the
screen-edge tests on an Android 15 emulator switched to three-button
navigation - the user's setup - and the new ScreenEdgeTest checks the
main screen's buttons and the settings list against the device's real
bars and cutouts (on both emulators).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V5G4cWSLBkiNNK4KC3zvXM
"overlay enable" turned the three-button overlay on but left gesture
navigation on as well, so which one the tests ran against was unclear.
"enable-exclusive" turns the others in the category off. The screen-edge
test now also logs the bars it checked against, and CI prints that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V5G4cWSLBkiNNK4KC3zvXM

This branch has not been deployed

No deployments
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.

2 participants