list: keep the swipe underlay visible through the spring-back

This commit is contained in:
jay
2026-11-12 16:50:07 -05:00
parent 037c5b1382
commit 7efa7bff59
@@ -123,17 +123,20 @@ class SwipeActionsCallback(
} else {
dX
}
if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE && isCurrentlyActive) {
// Arm when the finger passes the cell; disarm when pulled back inside it.
val raw = abs(dX)
val reveal = revealWidth(viewHolder).toFloat()
if (raw > reveal) {
armedViewHolder = viewHolder
armedAction = if (dX > 0) SwipeAction.QUEUE else SwipeAction.PLAY_NEXT
} else if (raw < reveal * 0.5f) {
armedViewHolder = null
armedAction = null
if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) {
if (isCurrentlyActive) {
// Arm when the finger passes the cell; disarm when pulled back inside it.
val raw = abs(dX)
val reveal = revealWidth(viewHolder).toFloat()
if (raw > reveal) {
armedViewHolder = viewHolder
armedAction = if (dX > 0) SwipeAction.QUEUE else SwipeAction.PLAY_NEXT
} else if (raw < reveal * 0.5f) {
armedViewHolder = null
armedAction = null
}
}
// Draw whenever the row is displaced, including the spring-back's frames.
if (clampedDX != 0f) {
drawUnderlay(c, viewHolder, clampedDX)
}