feat(android): Phase 0 media viewer — pinch-zoom, video playback, load states #1112
Loading…
Reference in a new issue
No description provided.
Delete branch "ux-android-viewer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Spec 055 Phase 0 for the Android app's full-bleed media viewer:
ViewerZoomState+ViewerGestures), no extra libraries.HorizontalPagerkeeps it), two fingers or a one-finger pan while zoomed are consumed by the transform layer. Paging is disabled while zoomed; settling on a new page always returns to 1x.rememberSaveable, so autoplay is never loud), tap reveals a control row with play/pause, seek, and a mute toggle. Only the current page holds a decoder.values/strings.xml), English (values-en), Danish (values-da).Supporting changes:
TimelineItemUinow carries payloaddimensions(width/height) so the pan clamp bounds against the fitted content size; unknown dimensions fall back to the viewport size.MemoriesApppasses the authenticatedTokenProviderinto the viewer and observes the timeline list viacollectAsStateWithLifecycleinstead of a.valuesnapshot, so pages loaded by the viewer's near-endloadMoreactually become pageable.material-icons-coreships neither and the extended artifact would add megabytes to an APK built without minification.Payload fields relied on
All fields already present on
TimelineItemDto/ the timeline contract — nothing invented:mediaTypecaptureTimestampdimensions(width/height)thumbnailUrlpreviewUrlThere is no
videoDurationfield; the seek slider reads duration from the player once metadata is available.Known gap: video cannot play yet (tracked as ISSUE-115)
Video playback currently always lands in the error/retry state, for two server-side reasons:
/api/media/{mediaItemId}/original?purpose=viewis reserved in the OpenAPI contract but not exposed by a user-facing controller (only the worker-scoped/api/worker/jobs/{jobId}/media/{mediaItemId}/originalexists).video_previewjob reportsvideo_preview_not_implemented, so no video rendition exists to serve either.The client prefers
previewUrland falls back to the original endpoint, so a future video rendition is picked up with no further client change. The error state is friendly and retryable rather than a crash or a silent black screen.Verification
cd apps/android && ./gradlew :app:testDebugUnitTest :app:assembleDebug— green (97 unit tests, debug APK assembled).New JVM tests:
ViewerZoomStateTest(scale clamps, focal-anchor invariance across zoom steps, pan clamping including the unknown-dimensions fallback, double-tap toggle,fitContentSizeletterboxing),ViewerDateTest(ISO/offset timestamps, null/garbage tolerance),VideoPlaybackUrlTest.TimelineViewModelTestnow assertsdimensionsride through to the UI model.TimelineJsonTestneeded no change: DTO parsing already coveredmediaType/dimensions.Pinch-zoom (1x–5x, focal-anchored, clamped pan) with double-tap toggle on photos; swipe-to-page keeps working at 1x through explicit gesture ownership in ViewerGestures (one finger at 1x stays with the pager, two fingers or a zoomed pan are consumed by the transform layer). Videos play through media3-exoplayer, muted-by-default with a tap-revealed control row (play/pause, seek, mute). Image and video pages both get a subtle loading placeholder and a friendly error state with retry. The viewer top bar shows the localized capture date plus position and a back button; system back exits the zoom first, then falls through to navigation. Timeline items now carry payload `dimensions` through TimelineItemUi so the pan clamp can bound against the fitted content size (viewport fallback when unknown). All new user-facing copy lives in de (default)/en/da string resources; Pause/Volume glyphs are drawn locally because material-icons-core has neither and the extended artifact would bloat an unminified APK. Video playback relies on `previewUrl` first and falls back to `/api/media/{id}/original?purpose=view`; that endpoint is currently only reserved in the OpenAPI contract and the worker's `video_preview` job reports video_preview_not_implemented, so videos surface the error/retry state until the rendition slice lands (ISSUE-115).