wasabeef / recyclerview-animators

An Android Animation library which easily add itemanimator to RecyclerView items.
Apache License 2.0
11.51k stars 1.98k forks source link

Support for method setSupportsChangeAnimations() #105

Open zagum opened 8 years ago

zagum commented 8 years ago

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

davideas commented 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;
}
aberaud commented 6 years ago

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