Use beandroid's date scroller for the Stream tab #324
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
The Stream tab of the app scrolls with our own
FastScroller(ui/FastScroller.kt,ui/FastScroll.kt), whose handle moves by rows and whose bubble names the day of the first row.beandroid's journal has a better one,
DateScroller(app/src/main/kotlin/de/konstantinfickel/beandroid/ui/DateScroller.kt, pure part inui/journal/DateScroll.kt). Bring it to the Stream tab:DateScrollerand a statelessDateScrollerContentfor the screenshot testsReference commits in beandroid: 6f8ea91, 414698b.
Plan
Decisions
FastScroller: they are sorted by name, not by date.dayName, with the full date below, else the date (with the year only whereshowsYear) and the weekday.Pure part:
ui/DateScroll.kt(from beandroid'sui/journal/DateScroll.kt, in the style of this repo)DateScroll(newest, oldest, days)withfraction,dateAt,snap,months,adjust(A11Y_STEP),dayForMonth;MonthMarkandList<MonthMark>.visible(track, spacing).dateScroll(days: List<Day>): none with fewer than two distinct days.dayIndices(leading, days): the index of each day header in theLazyColumn(one header plus the cards of each day).leadingis the number of rows above the days (pull banner, unreadable files, working, reminders, "nothing"), whichStream.ktalready counts forstreamRows.src/test/.../ui/DateScrollTest.kt: fraction/dateAt round trip,snap(exact, between days with a tie going to the newer one, the ends),monthsandvisible(all → quarters → years),adjust(one step to the next or previous day, any other value snaps),dayForMonth,dayIndiceswith leading rows, anddateScrollbeing none for one day.Composable:
ui/DateScroller.ktDateScroller(scroll, listState, indices, onDraggingChange, modifier)(stateful: visibility, expansion, drag fraction, a conflatedChannelof target dates collected withcollectLatest→scrollToItem,SegmentTickhaptics when the month changes, hidden 1.5 s after scrolling or dragging stops) and the statelessinternal DateScrollerContent(scroll, fraction, dragging, visible, …).primary, 32 → 36 dp, animated withMaterialTheme.motionScheme; while held, the gradient panel onsurface, the rule, the month/year marks (tap to jump, 48 dp touch target,contentDescription) and theprimaryContainerpreview inStreamdTheme.monoat a larger size (date) withlabelMedium(weekday). A narrow 36 dp edge target at the right shows the handle again; a tap away from the handle jumps there.contentDescription,stateDescription,progressBarRangeInfo,setProgressthroughadjust, custom actions for the previous and next month.ic_unfold_more.xml(Material Symbols Rounded, weight 400, withoutandroid:tint) andStreamdIcons.UnfoldMore.res/values/strings.xml: scroll by date, previous month, next month, jump to %s. Remove the strings ofFastScrolleronly if the configuration no longer uses them.Wiring
Stream.kt: replaceFastScrollerwithDateScrolleroverfound(the days after the filter and the search), alignedCenterEndand still ending above the Capture button (bottom = 96.dp). Without aDateScroll(fewer than two days) nothing is drawn.StreamActions(or a parameter ofStreamScreen) gainsonScrubbing: (Boolean) -> Unit.App.kt: holdscrubbingand hide theExtendedFloatingActionButtonwhile it is true. It is reset when the tab changes; theDisposableEffectof the scroller reportsfalsewhen it leaves.streamRows/dayAtofFastScroll.kt(and their tests) go away if nothing uses them any more.handleFraction,rowAtandFastScrollerstay forConfig.kt.Screenshot tests (
StreamScreenshots.kt, byDateScrollerContent, since layoutlib renders no gesture): one scene with the handle shown and resting, one held, with marks and the preview over the stream (a fixture spanning several months, across a new year, so year marks show), one held on today showing "Today". Record withupdateDebugScreenshotTestand look at each image; existing Stream scenes change only if the hidden scroller changed them.Docs
AGENTS.md: replace the description of the Stream tab'sFastScrollerwithDateScroller/DateScroll.kt(FastScrollerstays for the configuration); mention the hidden Capture button.README.mdandREQUIREMENTS.md(the Stream tab of R35, wherever the fast scroller is described): the time axis, the month marks, the preview, and the accessibility.Checks:
nix build .#streamd-app(unit tests and screenshots), thennix flake check.Reference: beandroid
ui/DateScroller.kt,ui/journal/DateScroll.kt, commits 6f8ea91 and 414698b.Implemented in PR #325: #325
Time: approximately 13 minutes (08:17–08:30 UTC).
Token usage, from the session counter immediately before this report: 4,587,618 total tokens, including 4,455,936 cached input tokens; the remainder is 113,002 uncached input tokens and 18,680 output tokens.
Findings and implementation:
Validation passed:
nix build .#streamd-app(offline build, native-backed unit tests and screenshot comparison) andnix flake check.