Repository navigation
fix(layout): measure navigation bar overlap on screen and recheck after reload - #856
Merged
Merged
Conversation
…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.
Owner
Author
|
Added the inset sources to the padding log: |
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.
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
navBarOverlapcompared 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.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 becausesetKeyboard->updateBottomPadding()runs again with settled values.Changes (
InputView)getLocationOnScreenagainst the screen height (maximumWindowMetrics, orgetRealMetricsbelow Android 11).onWindowVisibilityChangedonce the window is visible.navigation bar padding <old> -> <new> (<inputs>)at info level, only when the value changes, so the next exported log shows the numbers.NavBarOverlapTestuses screen coordinates and covers a window that ends above the navigation bar.Earlier fixes on this code
7b2f345fe(#1461)70fe84245,e8ef8d843,7bde5e179abb8a64420ee44875a777c0093e(#828)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
NavBarOverlapTestpasses;assembleStandardDebugandcompileOfflineRunTestsKotlinpass.viewBottom=2400 screen=2400), no visible change.