Add named motion tokens and animate list item changes
Introduce ui/components/Motion.kt beside the pane dimension tokens: two named duration+easing tokens, MotionQuick (120ms) for small in-place state changes and MotionStandard (220ms) for content that moves or swaps, under a 300ms MAX_MOTION_MILLIS cap. Every animation call site now asks a token for its spec instead of writing a duration: the pane slide and section Crossfade use MotionStandard, the section chevron uses MotionQuick, and the pane-pop stagger moves in as MOTION_STAGGER_MILLIS (the old PANE_SLIDE_* / SECTION_SWAP_MILLIS constants are gone). Add a single LazyItemScope.animateListItem() helper (ListRow.kt) wrapping the supported Modifier.animateItem with the tokens: items fade in/out (MotionQuick) and slide to new positions on refresh, filter or re-sort (MotionStandard). Pipelines rows, run rows, version rows and evidence rows use it. Specs are built at composition time (no per-frame allocation) and the chevron reads its angle inside graphicsLayer so it turns without recomposing the header; resting layout is unchanged and the standard animator duration scale still applies, so disabled animations are instant. Add MotionTest covering token ordering, per-token bands, the cap, monotonic easings, self-reversal and spec timing; SlidingPaneStackTest now reads the pane timing from the token. Document the change and its verification in android/README.md.
This commit is contained in:
@@ -2011,3 +2011,78 @@ Not verified in this pass: the link fallback on-device (the reachable server ran
|
||||
the file path); a narrow-window layout of the selection bar; receiving the bulk
|
||||
share in a third-party app (the chooser was observed, not an import).
|
||||
|
||||
### Named motion tokens and animated list changes (16 Oct 2026, run 104/1)
|
||||
|
||||
Every animation duration and easing now lives in one file, and the pipelines and
|
||||
runs lists animate per item instead of cutting.
|
||||
|
||||
- **One motion token file.** `ui/components/Motion.kt` (beside the pane's
|
||||
dimension tokens in `SlidingPaneStack.kt`) defines two named tokens, each a
|
||||
duration + easing pair: `MotionQuick` (120ms) for small in-place state changes
|
||||
(the section chevron, a list row appearing/leaving) and `MotionStandard`
|
||||
(220ms) for content moving or swapping (a pane sliding, a section
|
||||
cross-fading, an item taking a new place in a re-sorted list). Nothing exceeds
|
||||
the `MAX_MOTION_MILLIS` (300ms) cap and both easings are monotonic
|
||||
ease-in-out curves; `MotionStandard` is symmetric, which is what keeps a pane
|
||||
close the exact reverse of its open. A call site asks a token for its concrete
|
||||
spec via `spec()`; it never writes a duration. The pane slide, the section
|
||||
`Crossfade` and the chevron now use the tokens (`PANE_SLIDE_*` /
|
||||
`SECTION_SWAP_MILLIS` are gone), and the pane pop stagger moved in as
|
||||
`MOTION_STAGGER_MILLIS`.
|
||||
- **Per-item list animation.** A single shared `LazyItemScope.animateListItem()`
|
||||
(`ListRow.kt`) wraps Compose's supported `Modifier.animateItem(fadeInSpec,
|
||||
placementSpec, fadeOutSpec)` with the tokens: an item fades in as it appears
|
||||
and out as it leaves (`MotionQuick`), and the items still on screen slide to
|
||||
their new positions when the list is refreshed, filtered or re-sorted
|
||||
(`MotionStandard`) rather than jumping. Pipelines rows, run rows, pipeline
|
||||
version rows and run evidence rows all use it. Because it is the supported
|
||||
lazy-list item animation the list keeps its own scroll/measure state; the
|
||||
modifier only drives the transition, so a resting list is unchanged.
|
||||
- **System animation setting.** The tokens map onto Compose's standard
|
||||
animations, so the platform animator duration scale applies unchanged: with
|
||||
animations disabled each spec runs for zero time and an item is at its final
|
||||
state at once, no special case.
|
||||
- **No per-frame allocation.** Specs are built at composition time, not per
|
||||
frame, and the chevron reads its animating angle inside the layer
|
||||
(`graphicsLayer { rotationZ = … }`) so it turns without recomposing the header
|
||||
each frame.
|
||||
|
||||
Verified on `emulator-5554` only (fold layout, 2076x2152 / 390dpi ≈ 852dp,
|
||||
against the live server; never the attached Pixel):
|
||||
|
||||
- `gradle :app:assembleDebug :app:testDebugUnitTest --offline --console=plain`
|
||||
(Gradle 9.7.1, JDK 17, `ANDROID_HOME` set) → `BUILD SUCCESSFUL`.
|
||||
`gradle :app:testDebugUnitTest --rerun-tasks --offline` re-ran every result XML
|
||||
to **174 tests across 22 classes, 0 failures, 0 errors, 0 skipped**; the new
|
||||
`MotionTest` (6 cases) checks the token ordering (quick shorter than standard),
|
||||
the per-token bands (quick 100-150ms, standard 200-250ms), the ≤300ms cap, that
|
||||
every easing is monotonic `0→1`, that `MotionStandard` reverses itself, and
|
||||
that a spec carries its token's timing. `SlidingPaneStackTest` now reads the
|
||||
pane's timing from the token.
|
||||
- **Filter change** (`filter.mp4`, frames `sheet1.png`/`sheet2.png`): at
|
||||
`animator_duration_scale 5`, typing `docker` into the pipelines search fades
|
||||
the non-matching rows out and moves the survivors up; deleting it brings the
|
||||
rows back in.
|
||||
- **A new run arriving** (`newrun.mp4`, frames `newrun_arrival.png` /
|
||||
`newrun_sheet1.png`): run 105 was admitted out-of-band with
|
||||
`pipelines run --json --pipeline 8 … --yes` (**not** from the app); tapping
|
||||
Refresh in the Runs list shows run 105 fade in at the top while every existing
|
||||
row slides down to make room. Run 105 then failed (its stage returned
|
||||
`blocked`), so nothing had to be reclaimed.
|
||||
- **Reduced motion** (`red_sheet.png`): at `animator_duration_scale 0`, typing
|
||||
`d`/`do`/`doc`/`dock` leaves each captured frame fully settled — no ghosted or
|
||||
half-placed rows — i.e. the change is instant with no partial state.
|
||||
- `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` (17,913,089 bytes, sha256 `4bc1b781…`) copied
|
||||
to `~/.local/share/pipelines/data/artifacts/104/1/pipelines-debug-wip-0b74903.apk`
|
||||
(`0b74903` = `git rev-parse --short HEAD`); `curl -I
|
||||
http://10.0.0.249:8080/artifacts/104/1/pipelines-debug-wip-0b74903.apk` returned
|
||||
`HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
|
||||
`Content-Length: 17913089`, and a streamed `curl | shasum -a 256` returned the
|
||||
same `4bc1b781…`.
|
||||
|
||||
Not verified in this pass: a narrow-window frame of the item animation; an item
|
||||
leaving a list (a run being deleted is not a client action), only the
|
||||
appear/move halves driven above.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user