Animate selection and live state changes

Animate selection and status changes across the Android UI using the
existing Motion tokens, leaving every resting state unchanged.

- DestinationPill draws one selection indicator and animates its offset
  between the three slots (animateDpAsState, MotionStandard), with the
  glyph tint cross-fading in step; geometry comes from named
  DESTINATION_ITEM_SIZE/GAP tokens via the unit-tested
  destinationIndicatorOffsetDp helper.
- The shared ListRow fades its tonal container and content colour under
  MotionQuick instead of switching.
- New shared CollapsibleSectionBody wraps section bodies in
  AnimatedVisibility (expand/shrink + fade) under MotionQuick, used by
  both the lazy collapsibleSection and the stage pane's StageSection, so
  body and chevron move together.
- StatusChip eases container and label colour and RunStatusIcon eases its
  glyph tint, so a live run's status transition is visible rather than a
  silent colour swap.

Verified: assembleDebug + testDebugUnitTest BUILD SUCCESSFUL, 186 tests
across 23 classes with 0 failures/errors/skips; frames captured on
emulator-5554 for the travelling pill, section collapse and a live status
change; APK published to the run artifact directory. README documents the
change and its evidence.
This commit is contained in:
2026-10-16 11:24:01 +01:00
parent b89ad29c41
commit d019213c5b
9 changed files with 295 additions and 89 deletions
+79
View File
@@ -2169,3 +2169,82 @@ Evidence (macOS, JDK 17 from Homebrew `openjdk@17`, Gradle 9.7.1,
Not verified in this pass: a narrow-window frame (the fold inner display is
851dp wide); the error state's fade-in from loading (the disconnected load failed
before a loading frame could be drawn, only its fade-out was captured).
### Animated selection and state changes (16 Oct 2026, run 109/1)
Selection and live state changes animate instead of cutting, and every resting
state is unchanged. All of it reuses the one `Motion.kt` token file; no new
dependency, geometry or literal.
- **The destination pill's indicator travels.** `DestinationPill`
(`PipelinesApp.kt`) now draws one selection indicator behind the three icons
and animates its offset between them (`animateDpAsState`, `MotionStandard`), so
picking another destination slides the highlight across rather than each icon
swapping its own background; the glyph tint cross-fades in step
(`animateColorAsState`). The geometry comes from two named tokens,
`DESTINATION_ITEM_SIZE`/`DESTINATION_ITEM_GAP` (the existing 48dp target and
4dp gap, named once), through the pure `destinationIndicatorOffsetDp`, which is
unit-tested. The icons own the taps, so a tap registers while the indicator is
still travelling, and a rapid run of taps only retargets the one animator.
- **A selected row's highlight fades in.** The shared `ListRow` animates its
tonal container and content colour under `MotionQuick` instead of switching, so
selecting a pipeline/run row fades the `secondaryContainer` highlight in and
out; the settled row is exactly the old one.
- **Section bodies animate with their chevron.** A new shared
`CollapsibleSectionBody` (`Sections.kt`) wraps a section's body in
`AnimatedVisibility` with `expandVertically`/`shrinkVertically` + fade under
`MotionQuick` — the same token the `SectionHeader` chevron turns with — so the
content and the chevron move together. Both `collapsibleSection` (the lazy
variant) and the stage pane's `StageSection` use it; collapsed, the body is not
composed, so a resting section is unchanged. (The section *switch* was already
an in-place `Crossfade` with no lateral motion and is unchanged.)
- **A live run's status change animates.** `StatusChip` eases its container and
label colour under `MotionQuick` and `RunStatusIcon` eases its glyph tint, so a
run whose status changes while the 1s poll is running visibly transitions the
chip and the row's leading accent instead of silently swapping a colour.
- **Taps, pause and the animator scale.** These are ordinary Compose animators,
so the platform animator duration scale applies unchanged (disabled = instant),
the recomposer pauses them while the screen is not resumed, and the
selectable/clickable nodes are independent of the animators, so taps register
mid-animation.
Verified on `emulator-5554` only (fold layout, 2076x2152 / 390dpi; never the
attached Pixel, never `emulator-5556`), against the live server; each frame
captured and validated with `scripts/capture_png.sh -s emulator-5554`:
- `gradle :app:assembleDebug :app:testDebugUnitTest --offline --console=plain` →
`BUILD SUCCESSFUL`; `gradle :app:testDebugUnitTest --rerun-tasks --offline`
re-ran every result XML to **186 tests across 23 classes, 0 failures, 0 errors,
0 skipped**. The new `PipelinesNavTest` cases check the indicator offset lines
up with each slot and pins to slot 0 when nothing is selected.
- **Pill selection moving** at `animator_duration_scale 6`
(`pill_0/1/5.png`): with Pipelines selected, tapping Runs leaves `pill_0` on
Pipelines, `pill_1` freezes the highlight between the two icons, and `pill_5`
settles under Runs.
- **Section collapsing** at `animator_duration_scale 15`
(`sec2_expand_3.png`, `sec2_collapse_2.png`): the Input tab's `prompt` section
expands with the code block revealing under a down chevron, and collapses with
the block clipped and the following `pwd` header rising as the chevron returns.
- **Live status change** (`status3_post_01/02/03.png`): run 112 was started
out-of-band with `pipelines run … --pipeline 1 --prompt "… sleep 45 …"` (**not**
from the app) and watched in its open detail; its summary chip goes from
`running` (`status3_post_01`) through the mid-transition tint
(`status3_post_02`) to `succeeded` (`status3_post_03`).
- **Taps mid-animation**: at scale 15, tapping Runs and then Settings 0.2s later
(while the indicator was still travelling) landed on the Settings screen, so
the second tap registered.
- `adb -s emulator-5554 logcat -d` held 0 `FATAL EXCEPTION` / 0
`E AndroidRuntime` lines; `animator_duration_scale` was left at 1.
- **APK publish.** `app-debug.apk` (18,133,184 bytes, sha256 `567c437d…`) copied
to `~/.local/share/pipelines/data/artifacts/109/1/pipelines-debug-wip-b89ad29.apk`
(`b89ad29` = `git rev-parse --short HEAD`); `curl -I
http://10.0.0.249:8080/artifacts/109/1/pipelines-debug-wip-b89ad29.apk` returned
`HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
`Content-Length: 18133184`, and a streamed `curl | shasum -a 256` returned the
same `567c437d…`.
Not verified in this pass: a clean *settled* frame of the selected-row highlight
(it fades in while the wide layout then covers the list with the opened pane, so
only a transient mid-fade frame was captured); resume-after-pause of an
in-flight animation on device (the pause is Compose's own recomposer behaviour,
not code here).