recyclerview-animators icon indicating copy to clipboard operation
recyclerview-animators copied to clipboard

Support for method setSupportsChangeAnimations()

Open zagum opened this issue 9 years ago • 2 comments

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(); }

zagum avatar Aug 22 '16 07:08 zagum

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;
}

davideas avatar Aug 24 '16 22:08 davideas

For some reason it doesn't work with recyclerview-animators

aberaud avatar Jul 18 '18 13:07 aberaud