feat(month): month view style picker + Split pull-to-expand (#38, #53) #90

Merged
makiolaj merged 36 commits from feat/month-view-style into release/v2.16.0 2026-07-20 21:25:50 +00:00
2 changed files with 28 additions and 0 deletions
Showing only changes of commit 052335e842 - Show all commits

View File

@@ -239,6 +239,19 @@ fun MonthScreen(
.collect { (first, last) -> viewModel.onVisibleMonthsChanged(first, last) } .collect { (first, last) -> viewModel.onVisibleMonthsChanged(first, last) }
} }
// Keep the paged month tracking the scrolling grid. The scrolling styles
// navigate by scroll position and never touch the paged month otherwise, so
// without this it stays wherever paged navigation last left it (today's
// month, on a fresh open) — and switching to a paged style, or reseeding the
// other scrolling style's list state, which both read off it, would snap
// back there rather than staying on the month you were looking at.
LaunchedEffect(listState, scrolling, dense, weekStart) {
if (!scrolling) return@LaunchedEffect
snapshotFlow { visibleMonth }
.distinctUntilChanged()
.collect { viewModel.syncScrollMonth(it) }
}
val isOnCurrentMonth = titleMonth == YearMonth(today.year, today.month) val isOnCurrentMonth = titleMonth == YearMonth(today.year, today.month)
// Continuous names the month on the block's own sticky header, so the bar // Continuous names the month on the block's own sticky header, so the bar

View File

@@ -284,6 +284,21 @@ class MonthViewModel @Inject constructor(
_selectedDate.value = todayDate _selectedDate.value = todayDate
} }
/**
* Track [_month] to the month a scrolling style is showing. Those styles
* navigate by scroll position and never set [_month] themselves, so it would
* otherwise sit wherever paged navigation last left it (today's month, on a
* fresh open) — and a switch to a paged style, or a reseed of the other
* scrolling style's list, would jump there instead of holding position. The
* selection is realigned alongside it so that landing on the Split style
* shows a live day in the month on screen rather than a stale, off-month one.
*/
fun syncScrollMonth(ym: YearMonth) {
if (_month.value == ym) return
_month.value = ym
_selectedDate.value = selectionForMonth(ym, todayDate)
}
/** Jump to the month containing [date] (drawer jump-to-date). */ /** Jump to the month containing [date] (drawer jump-to-date). */
fun goToDate(date: LocalDate) { fun goToDate(date: LocalDate) {
_month.value = YearMonth(date.year, date.month) _month.value = YearMonth(date.year, date.month)