Compare commits

...
Author SHA1 Message Date
c169e41c33 Merge pull request 'android: wallet + roster bottom actions clipped while the keyboard is up' (#69) from wt/t_3a094045 into main
Reviewed-on: #69
2026-09-14 15:51:31 +00:00
77428789cb Merge branch 'main' into wt/t_3a094045 2026-09-14 15:51:24 +00:00
apk-dev
535a2baff9
android: wallet + roster bottom actions clipped while the keyboard is up
The two screens whose action row lives inside a non-scrollable Column could
not be un-covered by insets alone: the container had no scroll range at all.

- WalletScreen: root Column is now a verticalScroll viewport that consumes
  systemBars ∪ ime itself (screenContentInsets()) before the scroll, paired
  with Scaffold(contentWindowInsets = 0). The nested LazyColumn becomes a
  plain Column (a lazy list cannot be measured inside a scroll container with
  unbounded height) and the weight(1f) bottom spacer goes with it: a weighted
  spacer cannot live in a scrollable Column.
- RosterScreen: same inset treatment; the friends LazyColumn drops
  fillMaxSize() for weight(1f) so the wipe-confirm strip above it keeps its
  height when the IME shrinks the window.
- Insets.kt is PR #67's helper, taken verbatim (this branch does not carry #67).

Stacked on PR #67 (wt/chat-ime-insets, 08381c4) for ui/Insets.kt.
2026-09-14 02:05:03 -04:00
2 changed files with 33 additions and 12 deletions

View file

@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
@ -52,6 +53,11 @@ fun RosterScreen(
var confirmWipe by remember { mutableStateOf(false) }
Scaffold(
// The content root below consumes systemBars ∪ ime itself (see
// `screenContentInsets`); zeroing the Scaffold's own insets keeps the
// navigation bar from being applied twice and lets the wipe-confirm
// strip sit above the keyboard instead of under it.
contentWindowInsets = WindowInsets(0, 0, 0, 0),
topBar = {
TopAppBar(
title = { Text("OnionWire") },
@ -64,7 +70,7 @@ fun RosterScreen(
)
},
) { pad ->
Column(Modifier.padding(pad).fillMaxSize()) {
Column(Modifier.padding(pad).fillMaxSize().screenContentInsets()) {
Card(
modifier = Modifier.fillMaxWidth().padding(horizontal = 12.dp),
@ -134,7 +140,11 @@ fun RosterScreen(
)
}
} else {
LazyColumn(Modifier.fillMaxSize()) {
// weight(1f), not fillMaxSize(): the list must yield height to
// its siblings (the action row and the wipe-confirm strip above
// it) when the IME shrinks the window, instead of claiming all
// of it and pushing them off the bottom.
LazyColumn(Modifier.weight(1f).fillMaxWidth()) {
items(friends, key = { it.pubkeyHex }) { f ->
FriendRow(f) { onOpenChat(f) }
HorizontalDivider()

View file

@ -9,14 +9,15 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
@ -82,6 +83,11 @@ fun WalletScreen(
LaunchedEffect(Unit) { reload() }
Scaffold(
// The content root below consumes systemBars ∪ ime itself (see
// `screenContentInsets`); zeroing the Scaffold's own insets keeps the
// navigation bar from being applied twice, and keeps the IME inset out
// of the Scaffold's inner padding.
contentWindowInsets = WindowInsets(0, 0, 0, 0),
topBar = {
TopAppBar(
title = { Text("Wallet") },
@ -95,7 +101,13 @@ fun WalletScreen(
},
) { pad ->
Column(
Modifier.padding(pad).fillMaxSize(),
Modifier
.padding(pad)
.fillMaxSize()
// systemBars ∪ ime, applied outside the scrolling viewport so
// the inset does not scroll away with the content.
.screenContentInsets()
.verticalScroll(rememberScrollState()),
) {
Card(
modifier = Modifier
@ -171,19 +183,18 @@ fun WalletScreen(
style = MaterialTheme.typography.titleSmall,
modifier = Modifier.padding(horizontal = 12.dp, vertical = 4.dp),
)
LazyColumn(
// Plain Column, not a LazyColumn: the root is a scrolling
// container now, so a nested lazy list would either throw on the
// unbounded height or need an arbitrary cap. `walletRecentTransfers`
// is bounded (25 rows), and the page scrolls as one gesture.
Column(
modifier = Modifier
.fillMaxWidth()
.weight(1f, fill = false)
.padding(horizontal = 12.dp),
verticalArrangement = Arrangement.spacedBy(4.dp),
) {
items(transfers, key = { it.txid }) { t ->
TransferCard(t)
}
transfers.forEach { t -> TransferCard(t) }
}
} else {
Spacer(Modifier.weight(1f))
}
val kind = composer