Swipe between artifacts in the full-screen artifact viewer

The full-screen viewer becomes a pager instead of a single image with no
way to reach its neighbours.

- ArtifactGallery now owns the one viewer instance over pagedArtifacts(groups)
  -- the grid's image artifacts in the order the grid draws them -- and each
  tile opens the position it holds in that list via viewerIndexByUrl, so the
  grid and the viewer derive their index from one source (previously a second,
  untested per-tile counter and a per-tile viewer that had no neighbours).
- A horizontal drag or flick in ArtifactViewerBody moves to the previous/next
  artifact: pagedIndex moves by one and clamps at both ends without wrapping,
  a single-item gallery is inert, and canPageAtScale pages only at fit so a
  zoomed image pans via the existing zoomAbout/clampImageOffset as before.
  Previous/next IconButtons (disabled at each end) keep both neighbours
  reachable without a swipe, and the header shows "N of M · type" while the
  open artifact's own content, type icon, name and actions reload per artifact.
- Pure helpers pagedArtifacts, viewerIndexByUrl, pagedIndex, canPageAtScale and
  artifactViewerPositionLabel are added to ArtifactViewer.kt; ArtifactViewerTest
  covers next/previous, clamping at both ends, a single-item and an empty list,
  a zoomed viewer that does not page, the paged order versus the grid's draw
  order, and the per-artifact position label.

Placement check: the Android topic doc android/README.md is updated in this
commit with a section describing the pager, its gesture rule and the recorded
build/test checks. No packaged template and no packaged authoring skill
reference (internal/author/skill/references/*, internal/author/install.go's
inventory) documents the app's full-screen artifact viewer, so none needed
updating.

Only the four files this run changed are staged. The unrelated uncommitted
covered-pane statistics and list-load-phase edits (SlidingPaneStack.kt,
States.kt, Dimens.kt, LoadPhaseTest.kt) and the untracked scratch files in the
worktree belong to other changes and are deliberately left uncommitted.
This commit is contained in:
2026-10-17 02:17:35 +01:00
parent 18db2f913a
commit f440b109ac
4 changed files with 668 additions and 104 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