ursus
11/21/2019, 1:48 AMPaul Woitaschek
11/21/2019, 8:31 AMursus
11/21/2019, 4:59 PMursus
11/22/2019, 5:20 AM@Override
public boolean animateChange(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder,
int fromX, int fromY, int toX, int toY) {
if (oldHolder == newHolder) {
// Don't know how to run change animations when the same view holder is re-used.
// run a move animation to handle position changes.
return animateMove(oldHolder, fromX, fromY, toX, toY);
}
final float prevTranslationX = oldHolder.itemView.getTranslationX();
final float prevTranslationY = oldHolder.itemView.getTranslationY();
final float prevAlpha = oldHolder.itemView.getAlpha();
resetAnimation(oldHolder); <------------- THIS
Paul Woitaschek
11/22/2019, 7:26 AMPaul Woitaschek
11/22/2019, 7:27 AMsetSupportsChangeAnimations
says:
* @param supportsChangeAnimations true if change animations are supported by
* this ItemAnimator, false otherwise. If the property is false,
* the ItemAnimator
* will not receive a call to
* {@link #animateChange(RecyclerView.ViewHolder, RecyclerView.ViewHolder, int, int, int,
* int)} when changes occur.
Paul Woitaschek
11/22/2019, 7:27 AMursus
11/22/2019, 7:34 AM(recyclerView.itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false
Paul Woitaschek
11/22/2019, 7:34 AMPaul Woitaschek
11/22/2019, 7:35 AMfun RecyclerView.disableChangeAnimation() {
val animator = itemAnimator
if (animator is SimpleItemAnimator) {
animator.supportsChangeAnimations = false
}
}
ursus
11/22/2019, 7:35 AMPaul Woitaschek
11/22/2019, 7:36 AMursus
11/22/2019, 7:36 AMPaul Woitaschek
11/22/2019, 7:36 AMPaul Woitaschek
11/22/2019, 7:37 AManimateChange
and check who called it in the callstackursus
11/22/2019, 7:40 AMursus
11/22/2019, 7:55 AM