Mark view when swipe starts so ItemAnimator doesn't interfere
@@ -69,6 +69,9 @@ class MessageListSwipeCallback(
}
override fun onSwipeStarted(viewHolder: ViewHolder, direction: Int) {
+ // Mark view to prevent MessageListItemAnimator from interfering with swipe animations
+ viewHolder.markAsSwiped(true)
+
val swipeAction = when (direction) {
ItemTouchHelper.RIGHT -> swipeRightAction
ItemTouchHelper.LEFT -> swipeLeftAction
@@ -91,9 +94,6 @@ class MessageListSwipeCallback(
override fun onSwiped(viewHolder: ViewHolder, direction: Int) {
val item = viewHolder.messageListItem
- // Mark view to prevent MessageListItemAnimator from interfering with swipe animations
- viewHolder.markAsSwiped(true)
-
when (direction) {
ItemTouchHelper.RIGHT -> listener.onSwipeAction(item, swipeRightAction)
ItemTouchHelper.LEFT -> listener.onSwipeAction(item, swipeLeftAction)
