Skip to content

fix(layout): measure navigation bar overlap on screen and recheck after reload - #856

Merged
LeanBitLab merged 2 commits into
mainfrom
fix/bottom-padding-after-reload
Nov 16, 2026
Merged

LeanBitLab merged 2 commits into
mainfrom
fix/bottom-padding-after-reload

Conversation

@LeanBitLab

Copy link
Copy Markdown
Owner

Problem

A user reports extra space below the keys right after selecting a custom font, removing it, changing the toolbar mode, or selecting something. It goes back to normal when the keyboard is shown again or when any key is tapped. Their exported log has no errors and no layout information.

Not reproduced on a POCO M2 Pro (Android 17), so the causes below are from the code.

Causes

  1. fix(layout): reserve only the part of the navigation bar the keyboard really overlaps #828 measured in window coordinates. navBarOverlap compared the input view's bottom with its own window's height. A window that itself ends above the navigation bar (the suspected Samsung / Android 12 case from [Bug]: Bottom Bar in android 12 #824) has the view end at the window bottom, so the full inset was still reserved, doubling the gap.
  2. Padding computed while the window settles. setThemeNeedsReload() (font, toolbar mode, theme) replaces the input view and hides/re-shows the window at once. The first padding is computed before layout from the raw inset, and only a layout listener corrects it; a key tap fixes it because setKeyboard -> updateBottomPadding() runs again with settled values.

Changes (InputView)

  • Measure the overlap on screen: view bottom from getLocationOnScreen against the screen height (maximumWindowMetrics, or getRealMetrics below Android 11).
  • Recheck the padding in onWindowVisibilityChanged once the window is visible.
  • Log navigation bar padding <old> -> <new> (<inputs>) at info level, only when the value changes, so the next exported log shows the numbers.
  • NavBarOverlapTest uses screen coordinates and covers a window that ends above the navigation bar.

Earlier fixes on this code

Commit Fixed Effect
7b2f345fe (#1461) Keys under nav bar, Android 15+ edge to edge Kept: a view reaching the screen bottom still reserves the full inset (unit test)
70fe84245, e8ef8d843, 7bde5e179 Floating mode overlap and dead space Untouched: floating paths return before the new code; the recheck skips floating
abb8a6442 Android 15+ IME nav bar frame taller than the inset Kept: frame height still preferred; same 126px on the test device
0ee44875a Nav bar padding refinements, docked background Untouched
777c0093e (#828) Doubled gap on Samsung Note 10, Android 12 (#824) Changed on purpose: window coordinates could not detect a window ending above the nav bar

Remaining risk: devices where the screen bottom and the nav bar don't line up as usual (tablet taskbar, unusual cutouts). The result is still capped at the reported inset, so the worst case is too little padding, not a doubled gap.

Testing

  • NavBarOverlapTest passes; assembleStandardDebug and compileOfflineRunTestsKotlin pass.
  • POCO M2 Pro, Android 17: padding stays 126px at start and after a toolbar mode change (viewBottom=2400 screen=2400), no visible change.
  • Not verified on an affected device. Needs the reporter's device, Android version and navigation mode, plus an exported log from the next beta.

…er reload

The overlap from #828 compared the view bottom with its own window, so a
window that itself ends above the navigation bar still reserved the full
inset and doubled the space below the keys. Compare with the screen instead.

A settings change (font, toolbar mode) replaces the input view and re-shows
the window at once, so the padding can be computed while the window is still
settling and stay wrong until a key is tapped. Recheck it once the window is
visible, and log the padding inputs when the value changes so exported logs
show them.
The reported inset is either the IME's own navigation bar frame (Android 13+)
or the system inset, and the two can differ (126px vs 63px on a test device).
Log both and the SDK level so a report from a Samsung on Android 13 shows
which one was used.
@LeanBitLab

Copy link
Copy Markdown
Owner Author

Added the inset sources to the padding log: imeNavFrame (the IME's own navigation bar frame, Android 13+), systemInset and the SDK level. The reporter's device is a Samsung S20 FE on Android 13 with the latest beta, where the IME can draw its own navigation bar frame, so the next exported log should show whether the padding came from the frame or the system inset.

@LeanBitLab
LeanBitLab merged commit 4f5da44 into main Nov 16, 2026
1 check passed
@LeanBitLab
LeanBitLab deleted the fix/bottom-padding-after-reload branch November 16, 2026 18:12
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.

1 participant

⌂ Proxy