Measure the covered pane edge instead of spending a fixed budget

The covered panes spent a fixed 224dp (PEEK_BUDGET_DP) whatever the window
width, so a folded window lost over half its width and the active pane was
squeezed as levels were added. Derive the covered region at runtime from the
compact identity a covered edge must show - an icon plus the shortest label
that identifies the pane, measured with the app's own type role and floored at
the platform minimum touch target - plus the leading gesture inset.

coveredEdgesDp now returns edges that sum to exactly that region, so the active
pane opens at hostWidth - region and its width is identical at every depth:
opening a level only adds a thin edge inside the region. The nearest covered
level shows its identity, one older level is a thinner touch-target edge, and
older levels fold into a count rather than accumulating width; tapping an edge
still pops everything above it. Removes PEEK_BUDGET_DP, MIN_ACTIVE_PANE_WIDTH_DP
and the peekBudgetDp/peekStripsDp budget split from Dimens.kt and
SlidingPaneStack.kt. PaneIdentity gains the pane-kind icon drawn above the title
at the vector's own measured default size, and each destination passes its
compact label/icon.

The touched files also carry the in-flight covered-pane statistics and list-scroll
plumbing they depend on (PaneStat/paneStatTier/visiblePaneStats, per-destination
LazyListState); the remaining pieces of that work remain uncommitted.
This commit is contained in:
2026-10-16 18:50:36 +01:00
parent b003872032
commit af68a62ab8
11 changed files with 490 additions and 255 deletions
+92
View File
@@ -955,6 +955,11 @@ frames and pinch-zoom (adb cannot drive a two-finger pinch).
## Adaptive pane navigation and a fixed peek budget (15 Oct 2026)
> **Superseded** by "The covered edge is measured, not budgeted" below: the fixed
> `PEEK_BUDGET_DP` (`224.dp`) is gone. The covered region is now measured from the
> compact identity a covered edge has to show, so the active pane is no longer
> charged a fixed `224dp` whatever the window width is.
The pane stack was made adaptive to the window width and its peek space changed
from one peek per level to a single fixed budget shared between the covered
panes. `android/` only; nothing in the Pipelines server, its Go source, the
@@ -1220,6 +1225,11 @@ artifacts is a data issue in that run, not re-tested against a repaired copy.
## Covered panes show a compact identity, with a minimum peek width (16 Oct 2026)
> **Superseded** by "The covered edge is measured, not budgeted" below: the
> `MIN_COVERED_PANE_WIDTH_DP`/`PEEK_WIDTH_DP` split of a fixed budget no longer
> decides the layout. A covered edge is now as wide as the identity it has to
> show; the two tokens only bound which statistics that identity shows.
A wide-window stack no longer squeezes a full pane into each covered peek: a
covered pane now renders only its compact identity (a title and at most one
status/subtitle, centred in its strip) and its full body — tab rail, list,
@@ -3662,3 +3672,85 @@ distribution, `ANDROID_HOME=~/Library/Android/sdk`, every Gradle command with
shares the one `runListState`, so it gets the same treatment as the normally
opened runs list. A real hardware fold to the cover display was not exercised
(narrow was produced with `wm size`).
## The covered edge is measured, not budgeted (16 Oct 2026)
The covered panes used to spend the fixed `PEEK_BUDGET_DP` (`224.dp`) whatever the
window width was, so on a folded window the covered area was over half the screen
and the active pane was left with a fixed, small width. The stack now derives the
covered region from what a covered edge actually has to show and takes the active
pane's width from what remains. `android/` only; no dependency was added, no run
was started from the app, the Pipelines server/Go source/installer/Docker files
were not touched, and the operator's Pixel 10 Pro Fold was not used at all
(implementation verified with the build and the unit tests, per the brief).
- **The region is measured, not budgeted.** `rememberCompactIdentityWidth`
(`ui/components/PaneIdentity.kt`) measures the width one covered edge needs for
its compact identity — an icon plus the shortest label that identifies the pane
— at runtime, with the app's own type role and the platform's font metrics, and
floors it at the platform minimum touch target
(`LocalMinimumInteractiveComponentSize`). `SlidingPaneStack` adds the leading
system-gesture inset (`systemBars ∪ systemGestures`) and uses that as the whole
covered region. No percentage of the window, budget token or new dp constant
stands in for it; the only fixed values left are platform ones (the minimum
touch target and the leading gesture inset) plus the identity's own existing
`SPACING_S` padding and the icon's own default size.
- **The active pane's width is the same at every depth — the invariant.**
`coveredEdgesDp` (`ui/components/SlidingPaneStack.kt`) always returns edges that
sum to exactly the region, so `activeStart` is the region and the active pane
measures `hostWidth - region` at depth 1, 2, 3 and 4 alike. Opening another
level only adds an edge *inside* the region; it never widens the region or
resizes or reflows a pane already there. `SlidingPaneStackTest` asserts the sum
is constant across depths (`theCoveredRegionIsTheSameAtEveryDepthSoTheActiveWidthNeverChanges`).
- **The stack reads as a stack, and depth does not consume width.** The nearest
covered level shows its identity. One older level is shown as a thinner edge —
the platform minimum touch target, the thinnest edge that stays tappable after
the leading inset — and every level older than that folds into that edge's
count (`"<n> more"`) instead of spending width on each. When the region cannot
fit the thin older edge as well as a full touch target for the nearest identity
(one identity width is usually less than two touch targets), the older levels
fold into the nearest edge's count rather than being squeezed: nothing is
derived below the platform minimum. Tapping an edge still calls the same
`onPopTo(level)`, closing everything above it.
- **The old token and what replaced it.** `PEEK_BUDGET_DP` was `224.dp` and is
removed, together with `MIN_ACTIVE_PANE_WIDTH_DP` (`320.dp`) and the
`peekBudgetDp`/`peekStripsDp` split of a fixed budget. What replaced it is the
measured compact-identity width above. `PEEK_WIDTH_DP` (`56.dp`) and
`MIN_COVERED_PANE_WIDTH_DP` (`112.dp`) no longer place anything either: they now
only bound which statistics a covered identity shows (see
`paneStatTier`/`visiblePaneStats`) and are documented as such in `Dimens.kt`.
- **The identity carries an icon.** `PaneIdentity` gained an `icon` parameter
drawn above the title at the vector's own default size, so the drawn identity
matches the width that was measured for it. The list, pipeline-detail,
run-detail and stage panes each pass their own glyph.
Evidence (macOS, JDK 17 from Homebrew `openjdk@17`, the cached Gradle 8.11.1
distribution, `ANDROID_HOME=~/Library/Android/sdk`, `--offline`, every command
with `--no-daemon`):
- `gradle :app:testDebugUnitTest :app:assembleDebug --no-daemon --offline
--console=plain` → `BUILD SUCCESSFUL`. The result XMLs total **293 tests, 0
failures, 0 errors, 0 skipped** across 34 files. The rewritten
`SlidingPaneStackTest` pins the invariant and the fold rules: a narrow window
spends nothing, the edges sum to the region at every depth (so the active width
is constant), one covered level keeps the whole identity edge, two covered
levels show the nearest identity plus one thinner older edge, beyond two the
older levels fold into one count edge, a region too small to fit both a thin
edge and the nearest touch target collapses to a single counted edge, the
nearest edge keeps its touch target after the gesture inset, and the edges stay
monotonic and deterministic.
- `app/build/outputs/apk/debug/app-debug.apk` is 18,247,412 bytes, sha256
`77db131cdb2737da64286384e5f7387540b1c87588b89c36bf4c34821f091372`; it was
copied to `~/.local/share/pipelines/data/artifacts/166/1/pipelines-debug-wip-b003872.apk`
(`b003872` = `git rev-parse --short HEAD`; the tree is WIP on top of it).
`curl -I http://10.0.0.249:8080/artifacts/166/1/pipelines-debug-wip-b003872.apk`
returned `HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
`Content-Length: 18247412`.
Not verified in this pass: the derived widths on a real window, the stacked look
and the identifiers on the left, the covered area's share of the window, and the
two- and four-level screenshots — all of that is runtime/visual evidence for the
review stages, and the device policy for this brief keeps the implementation to
the build and the unit tests. Four levels are also unreachable in the app itself
(`MasterPane.List/Detail/Stage`, `MAX_PANE_DEPTH = 2`), so the four-level fold is
covered by the pure `coveredEdgesDp` cases rather than by a screenshot.