public class FlexibleItemAnimator
extends SimpleItemAnimator
RecyclerView.ItemAnimator provides basic
animations on remove, add, and move events that happen to the items in
a RecyclerView. RecyclerView uses a DefaultItemAnimator by default.RecyclerView#setItemAnimator(RecyclerView.ItemAnimator)| Modifier and Type | Class and Description |
|---|---|
protected class |
FlexibleItemAnimator.DefaultAddVpaListener |
protected class |
FlexibleItemAnimator.DefaultRemoveVpaListener |
| Modifier and Type | Field and Description |
|---|---|
protected android.view.animation.Interpolator |
mInterpolator |
| Constructor and Description |
|---|
FlexibleItemAnimator() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
animateAdd(ViewHolder holder) |
protected void |
animateAddImpl(ViewHolder holder,
int index)
Performs the Add Animation of this ViewHolder.
|
boolean |
animateChange(ViewHolder oldHolder,
ViewHolder newHolder,
int fromX,
int fromY,
int toX,
int toY) |
boolean |
animateMove(ViewHolder holder,
int fromX,
int fromY,
int toX,
int toY) |
boolean |
animateRemove(ViewHolder holder) |
protected void |
animateRemoveImpl(ViewHolder holder,
int index)
Performs the Remove Animation of this ViewHolder.
|
boolean |
canReuseUpdatedViewHolder(ViewHolder viewHolder,
java.util.List<java.lang.Object> payloads)
If the payload list is not empty, DefaultItemAnimator returns
true. |
void |
endAnimation(ViewHolder item) |
void |
endAnimations() |
boolean |
isRunning() |
protected boolean |
preAnimateAddImpl(ViewHolder holder)
Prepares the View for Add Animation.
|
protected boolean |
preAnimateRemoveImpl(ViewHolder holder)
Prepares the View for Remove Animation.
|
void |
runPendingAnimations() |
void |
setInterpolator(android.view.animation.Interpolator mInterpolator) |
public void setInterpolator(android.view.animation.Interpolator mInterpolator)
public final void runPendingAnimations()
protected boolean preAnimateRemoveImpl(ViewHolder holder)
- If AnimatedViewHolder#preAnimateRemoveImpl() is implemented and returns
true, then ViewHolder has precedence and the implementation of this method is ignored;
- If not, the implementation of this method is therefore performed.
true.holder - the ViewHoldertrue if a later call to runPendingAnimations() is requested,
false otherwise.protected void animateRemoveImpl(ViewHolder holder,
int index)
- If AnimatedViewHolder#animateRemoveImpl(ViewPropertyAnimatorListener, long, int) is
implemented and returns true, then ViewHolder has precedence and the implementation of this
method is ignored;
- If not, the implementation of this method is therefore performed.
holder - the ViewHolderindex - the progressive order of executionpublic final boolean animateRemove(ViewHolder holder)
protected boolean preAnimateAddImpl(ViewHolder holder)
- If AnimatedViewHolder#preAnimateAddImpl() is implemented and returns
true, then ViewHolder has precedence and the implementation of this method is ignored;
- If not, the implementation of this method is therefore performed.
true.holder - the ViewHoldertrue if a later call to runPendingAnimations() is requested,
false otherwise.protected void animateAddImpl(ViewHolder holder,
int index)
- If AnimatedViewHolder#animateAddImpl(ViewPropertyAnimatorListener, long, int) is
implemented and returns true, then ViewHolder has precedence and the implementation
of this method is ignored;
- If not, the implementation of this method is therefore performed.
holder - the ViewHolderindex - the progressive order of executionpublic final boolean animateAdd(ViewHolder holder)
public final boolean animateMove(ViewHolder holder,
int fromX,
int fromY,
int toX,
int toY)
public boolean animateChange(ViewHolder oldHolder,
ViewHolder newHolder,
int fromX,
int fromY,
int toX,
int toY)
public void endAnimation(ViewHolder item)
public boolean isRunning()
public void endAnimations()
public boolean canReuseUpdatedViewHolder(ViewHolder viewHolder,
java.util.List<java.lang.Object> payloads)
true.
When this is the case:
animateChange(), both ViewHolder arguments will be the same
instance.animateChange(), then DefaultItemAnimator will call
animateMove() and run a move animation instead.