Ignore a month chip tap that had no touch down (#187)
This commit is contained in:
@@ -2177,7 +2177,7 @@ private fun MonthWeekRow(
|
|||||||
// leaves both the click and a pickup in flight untouched. Padded and
|
// leaves both the click and a pickup in flight untouched. Padded and
|
||||||
// clipped to the background pill so the ripple matches it. A blanked
|
// 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.
|
// 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()) {
|
Row(Modifier.matchParentSize()) {
|
||||||
week.days.forEachIndexed { col, d ->
|
week.days.forEachIndexed { col, d ->
|
||||||
if (blankOutside && !inMonth(d)) {
|
if (blankOutside && !inMonth(d)) {
|
||||||
@@ -2198,9 +2198,14 @@ private fun MonthWeekRow(
|
|||||||
.padding(horizontal = CELL_GAP, vertical = 1.dp)
|
.padding(horizontal = CELL_GAP, vertical = 1.dp)
|
||||||
.clip(CELL_SHAPE)
|
.clip(CELL_SHAPE)
|
||||||
.clickable {
|
.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(
|
val chip = week.chipAtCellY(
|
||||||
col = col,
|
col = col,
|
||||||
cellY = downY[col],
|
cellY = cellY,
|
||||||
bandTopInCell = bandTopInCell(
|
bandTopInCell = bandTopInCell(
|
||||||
cellCoordinates,
|
cellCoordinates,
|
||||||
bandCoordinates,
|
bandCoordinates,
|
||||||
@@ -2231,6 +2236,11 @@ private fun bandTopInCell(
|
|||||||
return bandTop - cellTop
|
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 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
|
* the row's day-column box. Null for a tap above the band (the day number), on an
|
||||||
|
|||||||
Reference in New Issue
Block a user