-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PPJG-2914 Remove last callback #24
Conversation
We have to remove the previous callback if we set new items, since the callback could break the logic with the predictive animations(namely supportsPredictiveItemAnimations) which are calculated via a few onLayout callbacks
… redundant volatile annotation
rxdiffadapter/src/main/java/com/revolut/rxdiffadapter/RxDiffAdapter.kt
Outdated
Show resolved
Hide resolved
@@ -141,9 +143,18 @@ open class RxDiffAdapter @Deprecated("Replace with constructor without delegates | |||
diffResult.dispatchUpdatesTo(this) | |||
} | |||
|
|||
val lastCallback = lastDispatchDiffCallback | |||
if (lastCallback != null) { | |||
rv.removeCallbacks(lastCallback) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cancelling current task may postpone dispatching items to recycler(if updates happens frequently).
Proposal here:
- let's schedule task for dispatching new state(if it's required)
- make that runnable mutable and update it's state here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do in a separate ticket and dm you with the reference
# Conflicts: # rxdiffadapter/src/main/java/com/revolut/rxdiffadapter/RxDiffAdapter.kt
We have to remove the previous callback if we set new items, since the callback could break the logic with the predictive animations(see supportsPredictiveItemAnimations) which are calculated via a few onLayout callback.
Dm me in slack if you need to see the reproduction