android: keep the chat composer above the keyboard (ime insets) #67
Merged
sirius
merged 1 commit from 2026-09-14 04:34:11 +00:00
wt/chat-ime-insets into main 2026-09-14
android: keep the chat composer above the keyboard (ime insets)
enableEdgeToEdge() sets decorFitsSystemWindows=false, so on API 30+ the framework no longer resizes the window for the soft keyboard. The manifest's android:windowSoftInputMode="adjustResize" therefore has nothing to resize and the IME arrives as an unconsumed window inset; Scaffold's contentWindowInsets covers systemBars only. Result: the composer row, its Send button and the typed body were drawn underneath the keyboard and only reachable by dismissing it. - ui/Insets.kt (new): screenContentInsets() applies systemBars ∪ ime once, at the screen's content root. union is per-side max, so the keyboard and the navigation bar are never summed; the Top side is excluded because a Scaffold's pad.top is already the app bar's measured height (the app bar carries its own status-bar inset). @Composable because WindowInsets.ime is a composable read. - ChatScreen: Scaffold(contentWindowInsets = 0) plus the root consuming the inset; the body region holds weight(1f) in every branch (loading and empty included) so the composer can never be squeezed off the bottom; Send is always drawn instead of being swapped for a spinner (no layout jump under the thumb); the field sets ImeAction.Send so the keyboard's own action key sends; focus returns to the field after a send; testTag on the composer/input/send. - InviteScreens (both screens) and RotateScreen: same inset handoff, so the Verify / Approve / confirm buttons under a text field stay reachable by scrolling. - UnlockScreen: safeDrawingPadding(). It had no system-bar insets at all (title drawn under the status bar) and its Open button sat under the keyboard while a passphrase was being typed. Verified on emulator-5554 (ow35, x86_64, API 35) with the debug build whose sources are byte-identical to this commit: element keyboard closed keyboard open composer y=2232 y=1380 Send button y=2253 y=1433 keyboard top - y≈1500 mInputShown=true while the draft text was visible; the message sent both via the Send button and via the keyboard's action key (paper-plane = ImeAction.Send), each landing with the ✓✓ delivery marker. :app:testDebugUnitTest green. Note: no CI job covers this — ci.yml's path allowlist is src/**, crates/**, tests/**, Cargo.*, so an android-only change runs nothing, and android-release.yml only fires on v*.*.* tags.