From 28fb7404d833064c1282a74bb634b85b8f19cbbd Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Mon, 20 Jul 2026 23:20:21 +0200 Subject: [PATCH] fix(month): point the split slide the way the month moves (#53) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tapping a greyed leading/trailing day in the split grid follows the selection to that day's own month, but selectDate never set the slide direction — so the incoming page reused whatever the last swipe left in slideDir and could travel backwards while navigation moved forwards. Wrap selectDate so a tap that crosses months points slideDir at the month it is actually heading to. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../jeanlucmakiola/calendula/ui/month/MonthScreen.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/month/MonthScreen.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/month/MonthScreen.kt index c69728c..2022ff3 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/month/MonthScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/month/MonthScreen.kt @@ -297,6 +297,15 @@ fun MonthScreen( viewModel.goToDate(target) } } + // Selecting a day in the split grid can cross into a neighbour month — a + // tapped leading/trailing day follows to its own month. Point the slide the + // way the month is actually moving, so the incoming page travels the right + // direction instead of reusing whatever the last swipe left in slideDir. + val selectDay: (LocalDate) -> Unit = { date -> + val target = YearMonth(date.year, date.month) + if (target != month) slideDir = if (target < month) -1 else 1 + viewModel.selectDate(date) + } ModalNavigationDrawer( drawerState = drawerState, @@ -377,7 +386,7 @@ fun MonthScreen( onSwipeNext = goNext, onSwipePrev = goPrev, onRetry = jumpToToday, - onSelectDay = viewModel::selectDate, + onSelectDay = selectDay, onOpenDay = onOpenDay, onEventClick = onEventClick, onCreateEvent = { onCreateEvent(it, null) },