diff --git a/android/README.md b/android/README.md index 641c009b..f7b6c173 100644 --- a/android/README.md +++ b/android/README.md @@ -1615,3 +1615,61 @@ Verified on `emulator-5554` only (2076x2152 / 390dpi fold layout, live server), `HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`, `Content-Length: 18012767`; a streamed `GET | shasum -a 256` returned the same `b3b7d948…`. + +## Pane safe area (16 Oct 2026) + +The pane stack now guarantees every pane clears the system UI from the live +window insets instead of relying on each screen's implicit Material defaults. +One shared `paneSafeArea()` (`WindowInsets.safeDrawing`: status bar, any display +cutout, navigation bar and IME) is the single source of that geometry — never a +fixed padding: + +- `SlidingPaneStack` reads it (unioned with `systemGestures`) for the covered + peeks' strip geometry, so a peek also clears a cutout and the keyboard. +- Each pane's `Scaffold(contentWindowInsets = paneSafeArea())` reserves it once + for the content, and its `TopAppBar(windowInsets = paneSafeArea().only(Top + + Horizontal))` reserves the top/horizontal part, so a pane can never sit under + the status bar, a cutout, the navigation bar or the IME. Applied to the five + stacked panes (`PipelineListScreen`, `PipelineDetailScreen`, `RunHistoryScreen`, + `RunDetailScreen`, `StageDetailPane`) and to `SettingsScreen`. +- No inset is applied twice: while the connection banner is shown it owns the top + inset and the `NavHost` consumes `paneSafeArea().only(Top)` (was `statusBars`), + so the pane's app bar directly below the banner is not padded a second time. +- The search field lives inside the pane's `Scaffold` content, so it is already + inside the safe area; a future floating overlay must read the same + `paneSafeArea()`. +- The floating destinations pill clears the same safe area + (`windowInsetsPadding(paneSafeArea())`), so the keyboard no longer hides it. + +Evidence on `emulator-5554` only (fold AVD; narrow `wm size 1080x2340` @ 390dpi ≈ +443dp, wide `wm size reset` = 2076x2152 / 390dpi ≈ 852dp; **never** the attached +Pixel), against the live server, driven with `adb shell input` / `uiautomator +dump` and captured with `android/scripts/capture_png.sh -s emulator-5554` (every +image validated): + +- `gradle :app:assembleDebug --console=plain` → `BUILD SUCCESSFUL` (Gradle + 8.11.1, JDK 17); `app/build/outputs/apk/debug/app-debug.apk` is 18,029,402 + bytes, sha256 `45c1bd09b9622dfe023ff62129a80c44b060bf7c15963757e3f1a5dfa5f851fb`. +- `gradle :app:testDebugUnitTest --rerun-tasks --console=plain` → + `BUILD SUCCESSFUL`; the 18 result XMLs aggregate to **140 tests, 0 failures, 0 + errors, 0 skipped**. +- `safe-area-narrow-stage-pane.png` / `safe-area-wide-stage-pane.png`: the run 84 + `implementer` stage pane on the narrow and wide windows — the status bar and its + icons are visible, and the pane's app bar and scrolling body sit fully below + them, not clipped or covered. +- `safe-area-wide-ime-open.png` / `safe-area-wide-ime-scrolled.png`: the pipeline + search field focused (IME shown); the list scrolls inside the remaining space so + the last pipeline row is fully visible above the keyboard, and the destination + pill sits above the IME. +- `safe-area-wide-banner-owns-top.png`: with the connection banner shown it owns + the top inset and the pane's app bar follows directly below it — the inset is + reserved once, never twice. +- `adb -s emulator-5554 logcat -d` held 0 `FATAL EXCEPTION` / `E AndroidRuntime` + lines; `wm size` was reset afterwards. +- **APK publish.** Copied to + `~/.local/share/pipelines/data/artifacts/86/1/pipelines-debug-wip-5ad4b58.apk` + (`5ad4b58` = `git rev-parse --short HEAD`; the working tree is uncommitted WIP on + top of it). `curl -I + http://10.0.0.249:8080/artifacts/86/1/pipelines-debug-wip-5ad4b58.apk` returned + `HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`, + `Content-Length: 18029402`. diff --git a/android/app/src/main/java/net/awan/pipelines/ui/PipelinesApp.kt b/android/app/src/main/java/net/awan/pipelines/ui/PipelinesApp.kt index 039c9f36..5612fce7 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/PipelinesApp.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/PipelinesApp.kt @@ -7,12 +7,12 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.consumeWindowInsets import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.navigationBars +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.statusBars import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.selection.selectable import androidx.compose.foundation.shape.CircleShape @@ -48,6 +48,7 @@ import net.awan.pipelines.data.transport.ConnectionState import net.awan.pipelines.ui.components.ConnectionBanner import net.awan.pipelines.ui.components.SlidingPaneStack import net.awan.pipelines.ui.components.clampTabIndex +import net.awan.pipelines.ui.components.paneSafeArea import net.awan.pipelines.ui.components.pipelineDetailTabs import net.awan.pipelines.ui.components.rememberPaneContent import net.awan.pipelines.ui.components.runDetailTabs @@ -116,11 +117,11 @@ fun PipelinesApp(vm: AppViewModel) { // // Exactly one layer owns the top inset. The outer Scaffold's content insets // are zeroed so it no longer reserves the status bar on top of the inner - // screens' app bars (a Material 3 TopAppBar already applies the status-bar - // inset), which removed the duplicate top band. The bottom is owned by each - // screen's Scaffold, and the floating pill explicitly clears the navigation - // bar/gesture area via windowInsetsPadding. The Column reserves - // DESTINATION_PILL_RESERVE at the bottom so no scrollable content is + // screens' app bars (a Material 3 TopAppBar applies the top safe-area inset), + // which removed the duplicate top band. The bottom is owned by each screen's + // Scaffold, and the floating pill explicitly clears the safe area (system + // bars, cutout, gesture area and IME) via windowInsetsPadding. The Column + // reserves DESTINATION_PILL_RESERVE at the bottom so no scrollable content is // permanently hidden behind the pill. val bannerVisible = connectionState !is ConnectionState.Connected Scaffold(contentWindowInsets = WindowInsets(0, 0, 0, 0)) { padding -> @@ -140,7 +141,9 @@ fun PipelinesApp(vm: AppViewModel) { .weight(1f) .then( if (bannerVisible) { - Modifier.consumeWindowInsets(WindowInsets.statusBars) + Modifier.consumeWindowInsets( + paneSafeArea().only(WindowInsetsSides.Top), + ) } else { Modifier }, @@ -178,7 +181,7 @@ fun PipelinesApp(vm: AppViewModel) { onSelect = onNavigate, modifier = Modifier .align(Alignment.BottomEnd) - .windowInsetsPadding(WindowInsets.navigationBars) + .windowInsetsPadding(paneSafeArea()) .padding(end = 16.dp, bottom = 16.dp), ) } @@ -342,8 +345,8 @@ private fun RunsDestination( /** * The Pipelines/Runs/Settings destinations as a floating rounded pill at the * bottom right: the three destinations as icons, inset from the bottom/right - * edges (it clears the navigation bar/gesture area via windowInsetsPadding), - * each a 48dp touch + * edges (it clears the safe area — system bars, cutout, gesture area and IME — + * via windowInsetsPadding), each a 48dp touch * target. Selection is a tonal container plus the `Role.Tab` selected * accessibility state — never colour alone — and tapping switches destination * through the caller's existing navigate/popUpTo logic. diff --git a/android/app/src/main/java/net/awan/pipelines/ui/components/ConnectionBanner.kt b/android/app/src/main/java/net/awan/pipelines/ui/components/ConnectionBanner.kt index cc50fdcc..3a56a2cd 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/components/ConnectionBanner.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/components/ConnectionBanner.kt @@ -2,10 +2,10 @@ package net.awan.pipelines.ui.components import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.statusBars import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface @@ -75,10 +75,12 @@ private fun Banner( Surface(color = container, contentColor = contentColor, modifier = modifier.fillMaxWidth()) { Row( // The banner sits directly under the status bar (the outer Scaffold - // zeroes its content insets), so it owns the status-bar inset: the - // padding is inside the Surface so the banner colour covers the bar. + // zeroes its content insets), so it owns the top safe-area inset: the + // padding is inside the Surface so the banner colour covers the bar + // and any cutout, and the pane stack below consumes it so it is not + // applied a second time. modifier = Modifier - .windowInsetsPadding(WindowInsets.statusBars) + .windowInsetsPadding(paneSafeArea().only(WindowInsetsSides.Top)) .padding(horizontal = 16.dp, vertical = 8.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp), diff --git a/android/app/src/main/java/net/awan/pipelines/ui/components/SlidingPaneStack.kt b/android/app/src/main/java/net/awan/pipelines/ui/components/SlidingPaneStack.kt index 7cb8d1d5..471eaed1 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/components/SlidingPaneStack.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/components/SlidingPaneStack.kt @@ -14,7 +14,7 @@ import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.offset -import androidx.compose.foundation.layout.systemBars +import androidx.compose.foundation.layout.safeDrawing import androidx.compose.foundation.layout.systemGestures import androidx.compose.foundation.layout.union import androidx.compose.foundation.layout.width @@ -176,6 +176,22 @@ internal fun peekStripsDp( return strips } +/** + * The one set of system insets every pane — and every overlay laid over a pane, + * such as the search field and its results panel — must clear: the status bar + * and any display cutout, the navigation bar and the IME + * ([WindowInsets.safeDrawing], read live from the window, never a fixed + * padding). A pane's [androidx.compose.material3.Scaffold] applies it to its + * content and its app bar applies its top/horizontal part, so a pane can never + * sit under the status bar, a cutout, the navigation bar or the keyboard. + * + * It is reserved exactly once: a parent that has already owned an inset (the + * connection banner owns the status bar while it is shown) consumes it, so the + * pane below it applies it once, never twice. + */ +@Composable +internal fun paneSafeArea(): WindowInsets = WindowInsets.safeDrawing + /** * The one shared sliding pane stack, adaptive to the window width. Both the * Pipelines and Runs destinations use it, so the motion and geometry live in @@ -230,7 +246,7 @@ fun SlidingPaneStack( // the strip node's geometry (not via a padding modifier, which would // shrink the pointer node to nothing once the gesture insets are wide). val hostWidth = maxWidth - val insetPadding = WindowInsets.systemBars.union(WindowInsets.systemGestures) + val insetPadding = paneSafeArea().union(WindowInsets.systemGestures) .asPaddingValues() val direction = LocalLayoutDirection.current val startInset = insetPadding.calculateLeftPadding(direction) diff --git a/android/app/src/main/java/net/awan/pipelines/ui/graph/StageDetailPane.kt b/android/app/src/main/java/net/awan/pipelines/ui/graph/StageDetailPane.kt index 2888b87b..1d021e22 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/graph/StageDetailPane.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/graph/StageDetailPane.kt @@ -2,8 +2,10 @@ package net.awan.pipelines.ui.graph import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape @@ -46,6 +48,7 @@ import net.awan.pipelines.ui.components.KeyValueRow import net.awan.pipelines.ui.components.PaneIdentity import net.awan.pipelines.ui.components.SectionExpansionState import net.awan.pipelines.ui.components.SectionHeader +import net.awan.pipelines.ui.components.paneSafeArea import net.awan.pipelines.ui.components.rememberSectionExpansion import net.awan.pipelines.ui.displayMap import net.awan.pipelines.ui.fileChangeLine @@ -334,6 +337,7 @@ fun StageDetailPane( Scaffold( modifier = modifier, containerColor = paneContainerColor(), + contentWindowInsets = paneSafeArea(), topBar = { TopAppBar( title = { Text(GraphSemantics.nodeLabel(stageKey)) }, @@ -342,6 +346,7 @@ fun StageDetailPane( Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back") } }, + windowInsets = paneSafeArea().only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal), colors = TopAppBarDefaults.topAppBarColors(containerColor = paneContainerColor()), ) }, diff --git a/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineDetailScreen.kt b/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineDetailScreen.kt index 3b0d8117..41a9fe67 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineDetailScreen.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineDetailScreen.kt @@ -5,8 +5,10 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width @@ -54,6 +56,7 @@ import net.awan.pipelines.ui.components.ErrorState import net.awan.pipelines.ui.components.KeyValueRow import net.awan.pipelines.ui.components.LoadingState import net.awan.pipelines.ui.components.PaneIdentity +import net.awan.pipelines.ui.components.paneSafeArea import net.awan.pipelines.ui.components.collapsibleSection import net.awan.pipelines.ui.components.pipelineDetailTabs import net.awan.pipelines.ui.components.rememberSectionExpansion @@ -98,6 +101,7 @@ fun PipelineDetailScreen( Scaffold( modifier = modifier, + contentWindowInsets = paneSafeArea(), topBar = { TopAppBar( title = { Text(detail?.name ?: "Pipeline") }, @@ -106,6 +110,7 @@ fun PipelineDetailScreen( Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back") } }, + windowInsets = paneSafeArea().only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal), actions = { IconButton(onClick = { vm.loadPipeline(pipelineId, version) }) { Icon(Icons.Default.Refresh, contentDescription = "Refresh pipeline") diff --git a/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineListScreen.kt b/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineListScreen.kt index 8b8efac9..49761c21 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineListScreen.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineListScreen.kt @@ -2,8 +2,10 @@ package net.awan.pipelines.ui.screens import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items @@ -36,6 +38,7 @@ import net.awan.pipelines.ui.components.ErrorState import net.awan.pipelines.ui.components.ListRow import net.awan.pipelines.ui.components.LoadingState import net.awan.pipelines.ui.components.PaneIdentity +import net.awan.pipelines.ui.components.paneSafeArea import net.awan.pipelines.ui.theme.pipelinesText @OptIn(ExperimentalMaterial3Api::class) @@ -66,9 +69,11 @@ fun PipelineListScreen( Scaffold( modifier = modifier, + contentWindowInsets = paneSafeArea(), topBar = { TopAppBar( title = { Text("Pipelines") }, + windowInsets = paneSafeArea().only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal), actions = { IconButton(onClick = vm::refreshPipelines) { Icon(Icons.Default.Refresh, contentDescription = "Refresh pipelines") diff --git a/android/app/src/main/java/net/awan/pipelines/ui/screens/RunDetailScreen.kt b/android/app/src/main/java/net/awan/pipelines/ui/screens/RunDetailScreen.kt index 21de11a4..8336dbc7 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/screens/RunDetailScreen.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/screens/RunDetailScreen.kt @@ -6,8 +6,10 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyColumn @@ -57,6 +59,7 @@ import net.awan.pipelines.ui.components.ErrorState import net.awan.pipelines.ui.components.KeyValueRow import net.awan.pipelines.ui.components.LoadingState import net.awan.pipelines.ui.components.PaneIdentity +import net.awan.pipelines.ui.components.paneSafeArea import net.awan.pipelines.ui.components.RunStatusIcon import net.awan.pipelines.ui.components.StatusChip import net.awan.pipelines.ui.components.collapsibleSection @@ -126,6 +129,7 @@ fun RunDetailScreen( Scaffold( modifier = modifier, + contentWindowInsets = paneSafeArea(), topBar = { TopAppBar( title = { Text(run?.let { "Run ${it.id}" } ?: "Run") }, @@ -134,6 +138,7 @@ fun RunDetailScreen( Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back") } }, + windowInsets = paneSafeArea().only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal), actions = { IconButton(onClick = { vm.loadRun(runId) }) { Icon(Icons.Default.Refresh, contentDescription = "Refresh run") diff --git a/android/app/src/main/java/net/awan/pipelines/ui/screens/RunHistoryScreen.kt b/android/app/src/main/java/net/awan/pipelines/ui/screens/RunHistoryScreen.kt index 8455b8d3..f7f54a1e 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/screens/RunHistoryScreen.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/screens/RunHistoryScreen.kt @@ -8,8 +8,10 @@ import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyColumn @@ -51,6 +53,7 @@ import net.awan.pipelines.ui.components.ErrorState import net.awan.pipelines.ui.components.ListRow import net.awan.pipelines.ui.components.LoadingState import net.awan.pipelines.ui.components.PaneIdentity +import net.awan.pipelines.ui.components.paneSafeArea import net.awan.pipelines.ui.components.runStateColor import net.awan.pipelines.ui.components.runStateOf import net.awan.pipelines.ui.formatDuration @@ -85,9 +88,11 @@ fun RunHistoryScreen( Scaffold( modifier = modifier, + contentWindowInsets = paneSafeArea(), topBar = { TopAppBar( title = { Text(if (filterPipelineId == null) "Runs" else "Runs for this pipeline") }, + windowInsets = paneSafeArea().only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal), actions = { IconButton(onClick = vm::refreshRuns) { Icon(Icons.Default.Refresh, contentDescription = "Refresh runs") diff --git a/android/app/src/main/java/net/awan/pipelines/ui/screens/SettingsScreen.kt b/android/app/src/main/java/net/awan/pipelines/ui/screens/SettingsScreen.kt index 167c6da1..032ad18f 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/screens/SettingsScreen.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/screens/SettingsScreen.kt @@ -3,8 +3,10 @@ package net.awan.pipelines.ui.screens import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.text.KeyboardOptions @@ -28,6 +30,7 @@ import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import net.awan.pipelines.data.transport.ConnectionState import net.awan.pipelines.ui.AppViewModel +import net.awan.pipelines.ui.components.paneSafeArea @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -43,7 +46,13 @@ fun SettingsScreen(vm: AppViewModel, modifier: Modifier = Modifier) { Scaffold( modifier = modifier, - topBar = { TopAppBar(title = { Text("Settings") }) }, + contentWindowInsets = paneSafeArea(), + topBar = { + TopAppBar( + title = { Text("Settings") }, + windowInsets = paneSafeArea().only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal), + ) + }, ) { padding -> SettingsContent( padding = Modifier.padding(padding),