Keep home and task list clear of the navigation bar (#152)

This commit is contained in:
makiolaj committed 2026-11-12 15:58:31 +01:00
1 parent 3e34c60577
commit d562cf85f2
3 files changed
+43 -5

No files matched your search

+5
View File
@@ -7,6 +7,11 @@ All notable changes to this project are documented here. The format follows
## [Unreleased]
### Fixed
- With 3-button navigation, the navigation bar no longer covers the last home
search results, and in landscape it no longer covers the home screen, the
task list or the home top bar's buttons (#152).
## [1.3.1] - 2026-11-09
### Changed
@@ -29,7 +29,17 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.calculateEndPadding
import androidx.compose.foundation.layout.calculateStartPadding
import androidx.compose.foundation.layout.ime
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.layout.union
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListScope
@@ -74,6 +84,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.ImeAction
@@ -152,6 +163,7 @@ fun ListsScreen(
// System back closes search before leaving the screen.
BackHandler(enabled = searchActive, onBack = closeSearch)
val layoutDirection = LocalLayoutDirection.current
Scaffold(
modifier = modifier,
topBar = {
@@ -180,7 +192,12 @@ fun ListsScreen(
available = syncAvailable && !searchActive,
syncing = syncing,
onSync = viewModel::syncAll,
modifier = Modifier.fillMaxSize().padding(top = inner.calculateTopPadding()),
// Side insets too: in landscape a 3-button navigation bar sits at the side.
modifier = Modifier.fillMaxSize().padding(
start = inner.calculateStartPadding(layoutDirection),
top = inner.calculateTopPadding(),
end = inner.calculateEndPadding(layoutDirection),
),
) {
when (val s = state) {
ListsUiState.Loading -> Unit // brief; avoids a flash before first emission
@@ -513,7 +530,7 @@ private fun HomeTopBar(
Row(
modifier = Modifier
.fillMaxWidth()
.statusBarsPadding()
.windowInsetsPadding(WindowInsets.systemBars.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal))
.height(72.dp)
.padding(horizontal = 12.dp),
verticalAlignment = Alignment.CenterVertically,
@@ -672,7 +689,13 @@ private fun SearchResults(
)
}
} else {
LazyColumn(modifier = Modifier.fillMaxSize()) {
// The last result scrolls clear of the navigation bar and the keyboard.
LazyColumn(
modifier = Modifier.fillMaxSize(),
contentPadding = WindowInsets.navigationBars.union(WindowInsets.ime)
.only(WindowInsetsSides.Bottom)
.asPaddingValues(),
) {
items(results, key = { it.occurrenceKey }) { task ->
UpcomingRow(task = task, onClick = { onOpenTask(task) })
}
@@ -22,6 +22,8 @@ import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.calculateEndPadding
import androidx.compose.foundation.layout.calculateStartPadding
import androidx.compose.foundation.layout.ime
import androidx.compose.foundation.layout.isImeVisible
import androidx.compose.foundation.layout.navigationBars
@@ -90,6 +92,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
@@ -250,7 +253,14 @@ fun TaskListScreen(
}
},
) { inner ->
Box(modifier = Modifier.fillMaxSize()) {
// Side insets too: in landscape a 3-button navigation bar sits at the side.
val layoutDirection = LocalLayoutDirection.current
Box(
modifier = Modifier.fillMaxSize().padding(
start = inner.calculateStartPadding(layoutDirection),
end = inner.calculateEndPadding(layoutDirection),
),
) {
SyncPullBox(
available = syncAvailable,
syncing = syncing,