Main calendar screen: HorizontalPager with per-day swipe navigation#5
Main calendar screen: HorizontalPager with per-day swipe navigation#5
Conversation
- Use HorizontalPager with rememberPagerState for swipe-between-days - beyondBoundsPageCount=0 so only the current page's video is composed - LaunchedEffect on isScrollInProgress pauses videos during drag/fling and resumes them once the pager settles (uses existing temporaryPause/Resume) - Two-way sync: pager→ViewModel via LaunchedEffect(currentPage), ViewModel→pager (date picker) via LaunchedEffect(currentDayIndex) - Prev/next buttons animate the pager via animateScrollToPage Agent-Logs-Url: https://github.com/LukeNeedham/VideoDiary/sessions/e974c16a-349c-47f8-bfd4-bf30a508f4cd Co-authored-by: LukeNeedham <49884591+LukeNeedham@users.noreply.github.com>
- Add explanatory comments on both sync LaunchedEffects clarifying why the guard prevents any cyclic effect between them - Use days.getOrElse for bounds-safe current-day lookup - Extract navigateByOffset helper to deduplicate onPrevious/onNext Agent-Logs-Url: https://github.com/LukeNeedham/VideoDiary/sessions/e974c16a-349c-47f8-bfd4-bf30a508f4cd Co-authored-by: LukeNeedham <49884591+LukeNeedham@users.noreply.github.com>
Also coerce initialPage into days.indices for safe pager initialization Agent-Logs-Url: https://github.com/LukeNeedham/VideoDiary/sessions/e974c16a-349c-47f8-bfd4-bf30a508f4cd Co-authored-by: LukeNeedham <49884591+LukeNeedham@users.noreply.github.com>
…ceIn - Use remember(pagerState, coroutineScope) for onPrevious/onNext lambdas so they are not recreated on every recomposition - Use pagerState.pageCount (dynamic property on stable pagerState) instead of days.indices, avoiding capturing mutable days in the remembered lambdas - Guard initialPage: use days.isNotEmpty() check before coerceIn(days.indices) Agent-Logs-Url: https://github.com/LukeNeedham/VideoDiary/sessions/e974c16a-349c-47f8-bfd4-bf30a508f4cd Co-authored-by: LukeNeedham <49884591+LukeNeedham@users.noreply.github.com>
Use a single remembered navigateByOffset: (Int) -> Unit lambda, with onPrevious/onNext as thin stable wrappers via remember(navigateByOffset) Agent-Logs-Url: https://github.com/LukeNeedham/VideoDiary/sessions/e974c16a-349c-47f8-bfd4-bf30a508f4cd Co-authored-by: LukeNeedham <49884591+LukeNeedham@users.noreply.github.com>
…se/resume - require(days.isNotEmpty()) documents the programming contract and makes the days.last() fallback provably safe - Replace LaunchedEffect(isScrollInProgress) with snapshotFlow so pause/resume only fires on actual scroll-state transitions, not at initial composition - Simplify initialPage back to currentDayIndex.coerceIn(days.indices) Agent-Logs-Url: https://github.com/LukeNeedham/VideoDiary/sessions/e974c16a-349c-47f8-bfd4-bf30a508f4cd Co-authored-by: LukeNeedham <49884591+LukeNeedham@users.noreply.github.com>
LukeNeedham
left a comment
There was a problem hiding this comment.
Fix the build - there are many build errors
Agent-Logs-Url: https://github.com/LukeNeedham/VideoDiary/sessions/88f1835c-fecc-47c7-864b-c5715eabc3f3 Co-authored-by: LukeNeedham <49884591+LukeNeedham@users.noreply.github.com>
Fixed in f56ec04 — |
LukeNeedham
left a comment
There was a problem hiding this comment.
Fix the build
Task :app:compileDebugKotlin FAILED
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:48:22 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:57:20 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:58:24 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:58:35 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:68:13 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:68:24 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:69:13 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:69:24 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:76:20 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:77:24 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:77:35 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:87:37 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:87:48 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:92:52 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:94:26 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:94:37 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:95:41 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:95:52 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:96:41 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:96:52 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:116:17 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:117:29 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:147:17 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:148:29 This foundation API is experimental and is likely to change or be removed in the future.
Agent-Logs-Url: https://github.com/LukeNeedham/VideoDiary/sessions/6b501114-2906-493a-9312-3cd3443c972d Co-authored-by: LukeNeedham <49884591+LukeNeedham@users.noreply.github.com>
Fixed in d05e739 — added |
LukeNeedham
left a comment
There was a problem hiding this comment.
Fix ALL build errors. Ensure project builds.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:51:22 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:60:20 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:61:24 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:61:35 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:71:13 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:71:24 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:72:13 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:72:24 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:79:20 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:80:24 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:80:35 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:90:37 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:90:48 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:95:52 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:97:26 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:97:37 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:98:41 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:98:52 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:99:41 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:99:52 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:119:17 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:120:29 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:150:17 This foundation API is experimental and is likely to change or be removed in the future.
e: file:///home/runner/work/VideoDiary/VideoDiary/app/src/main/java/com/lukeneedham/videodiary/ui/feature/calendar/component/CalendarScroller.kt:151:29 This foundation API is experimental and is likely to change or be removed in the future.
…imentalFoundationApi Agent-Logs-Url: https://github.com/LukeNeedham/VideoDiary/sessions/652c62cb-25bf-4871-b79e-20e781ed4f94 Co-authored-by: LukeNeedham <49884591+LukeNeedham@users.noreply.github.com>
Fixed in a2df9fc — the root cause was using |
|
✅ Debug APK build complete! Download the APK from the workflow run artifacts. |
CalendarScroller.ktto useHorizontalPager(snap-based swipe navigation between days)currentDayIndexbeyondBoundsPageCount = 0— only one page's video composed at a timepagerState.animateScrollToPagesnapshotFlow + distinctUntilChangedfor pager→ViewModel directionrequire(days.isNotEmpty())guard + safegetOrNull/getOrElseaccessnavigateByOffset/onPrevious/onNextviarememberimport androidx.compose.runtime.remember@OptIn(ExperimentalFoundationApi::class)onCalendarScrollerand its preview — use Kotlin's built-inkotlin.OptIn(notandroidx.annotation.OptIn) so it actually suppresses Kotlin experimental API errors