From d8e06f059c7e949ba086cc400f0ac940c2cb65fc Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Mon, 17 Aug 2026 21:32:29 +0200 Subject: [PATCH] Ignore a month chip tap that had no touch down (#187) --- .../calendula/ui/month/MonthScreen.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 77384d8..a929d87 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 @@ -2177,7 +2177,7 @@ private fun MonthWeekRow( // leaves both the click and a pickup in flight untouched. Padded and // clipped to the background pill so the ripple matches it. A blanked // cell isn't part of this month, so it takes no taps either. - val downY = remember(week.days.size) { FloatArray(week.days.size) } + val downY = remember(week.days.size) { FloatArray(week.days.size) { NO_DOWN_Y } } Row(Modifier.matchParentSize()) { week.days.forEachIndexed { col, d -> if (blankOutside && !inMonth(d)) { @@ -2198,9 +2198,14 @@ private fun MonthWeekRow( .padding(horizontal = CELL_GAP, vertical = 1.dp) .clip(CELL_SHAPE) .clickable { + // Cleared on read: a click with no fresh down + // (TalkBack, D-pad) would otherwise resolve the + // previous tap's position and reopen its chip. + val cellY = downY[col] + downY[col] = NO_DOWN_Y val chip = week.chipAtCellY( col = col, - cellY = downY[col], + cellY = cellY, bandTopInCell = bandTopInCell( cellCoordinates, bandCoordinates, @@ -2231,6 +2236,11 @@ private fun bandTopInCell( return bandTop - cellTop } +/** + * Stand-in [cellY] for "no touch down recorded", which resolves to no chip. + */ +private const val NO_DOWN_Y = Float.NEGATIVE_INFINITY + /** * The chip at [cellY] in column [col], where [cellY] is measured from the top of * the row's day-column box. Null for a tap above the band (the day number), on an