diff --git a/sample/src/main/java/com/rubensousa/dpadrecyclerview/sample/ui/screen/compose/NestedComposeListAdapter.kt b/sample/src/main/java/com/rubensousa/dpadrecyclerview/sample/ui/screen/compose/NestedComposeListAdapter.kt index 46b99a1d..bd54da22 100644 --- a/sample/src/main/java/com/rubensousa/dpadrecyclerview/sample/ui/screen/compose/NestedComposeListAdapter.kt +++ b/sample/src/main/java/com/rubensousa/dpadrecyclerview/sample/ui/screen/compose/NestedComposeListAdapter.kt @@ -59,6 +59,10 @@ class NestedComposeListAdapter( holder.item?.let { scrollState.save(holder.getRecyclerView(), it.diffId) } + } + + override fun onViewDetachedFromWindow(holder: NestedComposeListViewHolder) { + super.onViewDetachedFromWindow(holder) holder.cancelAnimations() } diff --git a/sample/src/main/java/com/rubensousa/dpadrecyclerview/sample/ui/screen/list/HorizontalListAdapter.kt b/sample/src/main/java/com/rubensousa/dpadrecyclerview/sample/ui/screen/list/HorizontalListAdapter.kt index 0ef3eb51..58e9e1f9 100644 --- a/sample/src/main/java/com/rubensousa/dpadrecyclerview/sample/ui/screen/list/HorizontalListAdapter.kt +++ b/sample/src/main/java/com/rubensousa/dpadrecyclerview/sample/ui/screen/list/HorizontalListAdapter.kt @@ -80,4 +80,8 @@ class HorizontalListAdapter( holder.recycle() } + override fun onViewDetachedFromWindow(holder: HorizontalListViewHolder) { + holder.cancelAnimations() + } + } \ No newline at end of file diff --git a/sample/src/main/java/com/rubensousa/dpadrecyclerview/sample/ui/screen/list/HorizontalListViewHolder.kt b/sample/src/main/java/com/rubensousa/dpadrecyclerview/sample/ui/screen/list/HorizontalListViewHolder.kt index b76abec0..d50166fe 100644 --- a/sample/src/main/java/com/rubensousa/dpadrecyclerview/sample/ui/screen/list/HorizontalListViewHolder.kt +++ b/sample/src/main/java/com/rubensousa/dpadrecyclerview/sample/ui/screen/list/HorizontalListViewHolder.kt @@ -82,6 +82,10 @@ class HorizontalListViewHolder( animator.startDeselectionAnimation() } + fun cancelAnimations() { + animator.cancel() + } + override fun getSubPositionAlignments(): List { return alignments }