feat(android): cast round 2 — always-visible cast button, album autoplay, chronology, day headers #1228

Merged
chris merged 1 commit from feat/android-cast-ux-round2 into main 2026-10-14 23:32:52 +02:00
Owner

Spec 060 round 2 after the hardware-verified cast ship (#1220/#1221/#1227). Four Android UX changes, no backend/web changes, no new dependencies, no new strings.

1. Cast button on every main screen top bar

  • CastRouteButton mounted in: TimelineHeader, AlbumsHeader, person DetailHeader, SearchScreen header row, BackupHeader, UploadActivityTopBar, and trailing in Map's chips row. CastController threaded through MemoriesApp call sites.
  • CastRouteButton.darkBackground now defaults to the current MaterialTheme surface's luminance (white glyphs on dark surfaces, dark glyphs on light), so the in-screen placements follow the theme without per-site literals; the media viewer keeps its explicit true (black overlay bar).
  • TimelineScreen takes cast: CastController? = null — the add-photos picker replaces the header, so it stays untouched and shows no button.
  • People list and More/Settings have no top bar — deliberately left alone.

2. Album auto-start (spec 060 T013 follow-up)

  • Opening an album detail while a cast session is connected — or connecting while inside — starts the slideshow automatically at the default 5s interval. Manual "Afspil album på TV" overflow action unchanged.
  • Double-start guard is the pure shouldAutoStartSlideshow(castConnected, hasItems, slideshowActive, alreadyFired) (JVM-tested): one fire per screen entry (fresh remember per visit), never over a live run (manual start or a run surviving rotation), never before items are loaded. Leaving the screen still stops the run (existing DisposableEffect); returning is a new entry and starts a fresh run.
  • Slideshow runs the chronological list (auto-start and the interval dialog both pass sortedChronologically()).

3. Album chronological order

  • New pure AlbumChronology.kt: sortedChronologically() — stable sort by parsed capture Instant (ISO Z and offset forms), undated/unparseable last keeping relative input order; groupedByCaptureDay(zone) — capture-day buckets, oldest day first, undated trailing.
  • AlbumDetailViewModel sorts at load (and re-sorts after addItems), so grid, viewer pager and slideshow share one chronological list.

4. Sticky day headers in the album

  • The timeline's DayHeader became internal and now takes (localDate, itemCount) (the only fields it used) — reused, not duplicated; locale-aware day formatting and the undated label come along for free, so no new strings.
  • Album grid is now a LazyVerticalGrid with stickyHeader per day + items(day.items), same 3-column cells and AlbumCell selection behavior.

Verification

From apps/android: ./gradlew :app:testDebugUnitTest :app:assembleDebug → BUILD SUCCESSFUL, 472 tests, 0 failures (new: AlbumChronologyTest 9 tests, AlbumAutoStartTest 5 tests, plus 2 new AlbumDetailViewModelTest cases; FakeMemoriesApi gained an additive addAlbumItemCaptureTimestamp hook).

Spec 060 round 2 after the hardware-verified cast ship (#1220/#1221/#1227). Four Android UX changes, no backend/web changes, no new dependencies, no new strings. ## 1. Cast button on every main screen top bar - `CastRouteButton` mounted in: TimelineHeader, AlbumsHeader, person DetailHeader, SearchScreen header row, BackupHeader, UploadActivityTopBar, and trailing in Map's chips row. `CastController` threaded through `MemoriesApp` call sites. - `CastRouteButton.darkBackground` now defaults to the current `MaterialTheme` surface's luminance (white glyphs on dark surfaces, dark glyphs on light), so the in-screen placements follow the theme without per-site literals; the media viewer keeps its explicit `true` (black overlay bar). - `TimelineScreen` takes `cast: CastController? = null` — the add-photos picker replaces the header, so it stays untouched and shows no button. - People list and More/Settings have no top bar — deliberately left alone. ## 2. Album auto-start (spec 060 T013 follow-up) - Opening an album detail while a cast session is connected — or connecting while inside — starts the slideshow automatically at the default 5s interval. Manual "Afspil album på TV" overflow action unchanged. - Double-start guard is the pure `shouldAutoStartSlideshow(castConnected, hasItems, slideshowActive, alreadyFired)` (JVM-tested): one fire per screen entry (fresh `remember` per visit), never over a live run (manual start or a run surviving rotation), never before items are loaded. Leaving the screen still stops the run (existing DisposableEffect); returning is a new entry and starts a fresh run. - Slideshow runs the chronological list (auto-start and the interval dialog both pass `sortedChronologically()`). ## 3. Album chronological order - New pure `AlbumChronology.kt`: `sortedChronologically()` — stable sort by parsed capture `Instant` (ISO Z and offset forms), undated/unparseable last keeping relative input order; `groupedByCaptureDay(zone)` — capture-day buckets, oldest day first, undated trailing. - `AlbumDetailViewModel` sorts at load (and re-sorts after `addItems`), so grid, viewer pager and slideshow share one chronological list. ## 4. Sticky day headers in the album - The timeline's `DayHeader` became `internal` and now takes `(localDate, itemCount)` (the only fields it used) — reused, not duplicated; locale-aware day formatting and the undated label come along for free, so no new strings. - Album grid is now a `LazyVerticalGrid` with `stickyHeader` per day + `items(day.items)`, same 3-column cells and `AlbumCell` selection behavior. ## Verification From `apps/android`: `./gradlew :app:testDebugUnitTest :app:assembleDebug` → BUILD SUCCESSFUL, 472 tests, 0 failures (new: `AlbumChronologyTest` 9 tests, `AlbumAutoStartTest` 5 tests, plus 2 new `AlbumDetailViewModelTest` cases; `FakeMemoriesApi` gained an additive `addAlbumItemCaptureTimestamp` hook).
feat(android): cast round 2 — always-visible button, album autoplay, chronology
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 2s
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Build Android CI image (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Successful in 14s
Build and Deploy / Android unit tests and debug APK (push) Successful in 3m52s
73b05caf6d
- mount CastRouteButton in every main screen top bar: timeline, albums,
  person detail, search, backup, upload activity, and trailing in the map
  chips row (people list and More/Settings have no top bar); CastRouteButton
  now defaults its glyph set to the current surface's luminance, so light
  bars get dark icons and dark bars white ones without per-site literals
- album detail auto-starts the slideshow at the default 5s interval when a
  cast session is already connected on entry or connects while inside;
  the pure shouldAutoStartSlideshow guard covers connected + has-items +
  no-live-run + not-fired-this-entry, so it can never double-start
- album detail is chronological: stable client-side sort by capture
  timestamp (undated last, relative order kept) in AlbumDetailViewModel,
  shared by grid, viewer list and both slideshow triggers; pure
  AlbumChronology helpers (sort + capture-day bucketing) with JVM tests
- album grid gains sticky capture-day headers 'lige som på timelinen' by
  reusing the timeline's DayHeader (now internal, takes localDate+itemCount)
  — no duplicated composable, no new strings

Refs spec 060 (round 2 follow-up to PRs #1220/#1221/#1227)
chris merged commit 3b0ec8da6d into main 2026-10-14 23:32:52 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
chris/memories!1228
No description provided.