Merge lane-c: keep the lane's reviewed work

Combine the two reviewed versions of the Android artifact gallery/viewer.

- ArtifactViewer.kt: keep lane-c's gallery-wide paged full-screen viewer
  (artifacts/index/configuredServerUrl/onIndexChange overload with paging
  gestures, header, page buttons, share action and video-frame support) and
  re-add HEAD's single-artifact overload (url/name/fetchBytes/onDismiss/video)
  as a thin wrapper so StageVerdict still compiles and works.
- Artifacts.kt: keep lane-c's gallery-owned single viewer + onOpen callback and
  compose HEAD's all-artifacts-as-tiles grid (media tiles open the paged viewer,
  non-media open externally, selection and per-item share/copy preserved).

Checked: no conflict markers remain in any affected path. android/README.md
already carries the new "Page between artifacts in the full-screen viewer
(17 Oct 2026)" section documenting this change; the packaged templates, the
top-level README and topic docs, and the packaged authoring skill references
are not made stale by this Android-client UI change, so nothing further needs
updating.
This commit is contained in:
2026-10-17 02:35:42 +01:00
4 changed files with 731 additions and 121 deletions
+47
View File
@@ -1907,6 +1907,53 @@ inner display at 390 dpi); an Android 8/9 device branch (the `layoutInDisplayCut
Mode = SHORT_EDGES` fallback is compiled and lint-guarded but only the API 36 path
ran).
## Page between artifacts in the full-screen viewer (17 Oct 2026)
The full-screen viewer is now a pager: a horizontal drag or flick moves to the
previous/next image artifact in gallery order, and the header shows the open
artifact's position ("2 of 5", reloading that artifact's own name, content type,
image and actions). `ArtifactGallery` owns the one viewer instance over
`pagedArtifacts(groups)` (group by group, each group's images in recorded order —
the order the grid draws), and each tile resolves its viewer index through the new
`viewerIndexByUrl` from that same list, so the grid and the viewer cannot disagree
about which artifact a tap opens (previously a second, untested running counter).
- **Gesture.** The paging/dismiss drag sits on a single full-screen surface in
`ArtifactViewerBody`, not on the image, so a drag that starts on the letterbox
around a fitted image pages too. The rule is "page only at fit": a pinch, or any
drag once the image is zoomed (`canPageAtScale`), pans via the shared
`zoomAbout`/`clampImageOffset` exactly as before. At the first/last artifact the
drag is damped (`PAGE_RESISTANCE`) and never wraps; a one-artifact gallery is
inert; a downward drag at fit still dismisses. The previous/next `IconButton`s
(disabled at each end) keep both neighbours reachable without a swipe, and a
loading/error/unavailable artifact shows its own state while its neighbours stay
reachable. The header, actions and page buttons share one `viewerCapsule()`
scrim background.
- **Pure helpers.** `pagedArtifacts`, `viewerIndexByUrl`, `pagedIndex` (the one
clamp shared by the gesture and the buttons) and `canPageAtScale` in
`ArtifactViewer.kt`.
- **Checks.** `gradle :app:testDebugUnitTest :app:assembleDebug --no-daemon` →
`BUILD SUCCESSFUL`; **317 tests, 0 failures, 0 errors, 0 skipped**. The paging
tests are in `ArtifactViewerTest` (`pagedIndex` next/previous, clamping at both
ends, a single-item and an empty list; `aZoomedViewerDoesNotPage`;
`pagedArtifactsAreTheGalleryImagesInGridOrder`; and
`theGridTileViewerIndicesMatchTheViewerOrder`, which walks the grid's draw order
and asserts every tile resolves to its viewer position). `gradle
:app:lintDebug` → only the two pre-existing `windowLightNavigationBar` NewApi
errors (`values/themes.xml`, `values-night/themes.xml`); 0 findings attributed to
`ArtifactViewer.kt` or `Artifacts.kt`.
- **APK publish.** `~/.local/share/pipelines/data/artifacts/224/3/pipelines-debug-wip-18db2f9.apk`
(`18db2f9` = `git rev-parse --short HEAD`), 18,093,313 bytes, md5
`540168beaf3c7f5b7f19eaecd2c3099a`; `curl -I
http://10.0.0.75:8080/artifacts/224/3/pipelines-debug-wip-18db2f9.apk` returned
`HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
`Content-Length: 18093313`. Built with Gradle 8.11.1, AGP 8.7.2, JDK 17.0.10
(Android Studio JBR), `compileSdk 35`/`build-tools 35.0.0`, minSdk 26.
Not verified in this pass: the on-device swipe/zoom/back-gesture behaviour and the
narrow/wide covered-pane strip (the device is visual review's); this pass verified
only the build and the unit tests.
## Share every artifact, from the grid cells and the per-visit rows (16 Oct 2026)
Every artifact item now carries a real share action: each image cell in a gallery