Open zagum opened 8 years ago
From the Javadoc it says that animateChange will not be executed if the property is false
. And it is set false
from the constructor. Am I wrong?
/**
* Sets whether this ItemAnimator supports animations of item change events.
* If you set this property to false, actions on the data set which change the
* contents of items will not be animated. What those animations do is left
* up to the discretion of the ItemAnimator subclass, in its
* {@link #animateChange(ViewHolder, ViewHolder, int, int, int, int)} implementation.
* The value of this property is true by default.
*
* @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(ViewHolder, ViewHolder, int, int, int,
* int)} when changes occur.
* @see Adapter#notifyItemChanged(int)
* @see Adapter#notifyItemRangeChanged(int, int)
*/
public void setSupportsChangeAnimations(boolean supportsChangeAnimations) {
mSupportsChangeAnimations = supportsChangeAnimations;
}
For some reason it doesn't work with recyclerview-animators
In some cases i'd like to animate only add/remove events. In SimpleItemAnimator there is field mSupportsChangeAnimations and getter/setter for it. Can you please add in your BaseItemAnimator class, in animateChange method, something like this:
if (getSupportsChangeAnimations()) { ... } else { skipAnimation(); }