canReuseUpdatedViewHolder
open fun canReuseUpdatedViewHolder(@NonNull viewHolder: RecyclerView.ViewHolder, @NonNull payloads: List<Any>): Boolean(source)
When an item is changed, ItemAnimator can decide whether it wants to re-use the same ViewHolder for animations or RecyclerView should create a copy of the item and ItemAnimator will use both to run the animation (e.g. cross-fade).
Note that this method will only be called if the still has the same type ( Adapter#getItemViewType(int)). Otherwise, ItemAnimator will always receive both s in the #animateChange(ViewHolder, ViewHolder, ItemHolderInfo, ItemHolderInfo) method.
If the payload list is not empty, DefaultItemAnimator returns true
. When this is the case:
- If you override animateChange, both ViewHolder arguments will be the same instance.
- If you are not overriding animateChange, then DefaultItemAnimator will call animateMove and run a move animation instead.