Skip to content

Commit f3ca4b0

Browse files
author
Saket Narayan
committed
Detach ItemExpandAnimator and TintPainter when InboxRecyclerView is detached
1 parent 02c8abf commit f3ca4b0

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

inboxrecyclerview/src/main/java/me/saket/inboxrecyclerview/InboxRecyclerView.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ class InboxRecyclerView(
7979
super.onRestoreInstanceState(superState)
8080
}
8181

82+
override fun onDetachedFromWindow() {
83+
super.onDetachedFromWindow()
84+
if (pageSetupDone) {
85+
itemExpandAnimator.onDetachRecyclerView(this)
86+
tintPainter.onDetachRecyclerView(this)
87+
}
88+
}
89+
8290
/**
8391
* Set the [ExpandablePageLayout] to be used with this list.
8492
* The pull-to-collapse threshold is set to 85% of the standard toolbar height.

inboxrecyclerview/src/main/java/me/saket/inboxrecyclerview/dimming/UncoveredAreaTintPainter.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ open class UncoveredAreaTintPainter(color: Int, opacity: Float) : TintPainter(),
6868
recyclerView.page.removeStateChangeCallbacks(this)
6969
recyclerView.page.viewTreeObserver.removeOnGlobalLayoutListener(pageLayoutChangeListener)
7070
recyclerView.page.viewTreeObserver.removeOnPreDrawListener(pagePreDrawListener)
71+
tintAnimator.cancel()
7172
}
7273

7374
private fun onPageMove() {

0 commit comments

Comments
 (0)