Boolean |
canReuseUpdatedViewHolder(viewHolder: RecyclerView.ViewHolder, payloads: MutableList<Any!>)
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 ViewHolder still has the same type (Adapter#getItemViewType(int) ). Otherwise, ItemAnimator will always receive both ViewHolder s in the #animateChange(ViewHolder, ViewHolder, ItemHolderInfo, ItemHolderInfo) method.
|
Unit |
setAddDuration(addDuration: Long)
Sets the duration for which all add animations will run.
|
Unit |
setChangeDuration(changeDuration: Long)
Sets the duration for which all change animations will run.
|
Unit |
runPendingAnimations()
Called when there are pending animations waiting to be started. This state is governed by the return values from animateAppearance() , animateChange() animatePersistence() , and animateDisappearance() , which inform the RecyclerView that the ItemAnimator wants to be called later to start the associated animations. runPendingAnimations() will be scheduled to be run on the next frame.
|
RecyclerView.ItemAnimator.ItemHolderInfo |
recordPreLayoutInformation(state: RecyclerView.State, viewHolder: RecyclerView.ViewHolder, changeFlags: Int, payloads: MutableList<Any!>)
Called by the RecyclerView before the layout begins. Item animator should record necessary information about the View before it is potentially rebound, moved or removed.
The data returned from this method will be passed to the related animate** methods.
Note that this method may be called after pre-layout phase if LayoutManager adds new Views to the layout in pre-layout pass.
The default implementation returns an ItemHolderInfo which holds the bounds of the View and the adapter change flags.
|
Long |
getRemoveDuration()
Gets the current duration for which all remove animations will run.
|
Unit |
dispatchAnimationFinished(viewHolder: RecyclerView.ViewHolder)
Method to be called by subclasses when an animation is finished.
For each call RecyclerView makes to animateAppearance() , animatePersistence() , or animateDisappearance() , there should be a matching #dispatchAnimationFinished(ViewHolder) call by the subclass.
For animateChange() , subclass should call this method for both the oldHolder and newHolder (if they are not the same instance).
|
Long |
getMoveDuration()
Gets the current duration for which all move animations will run.
|
Unit |
onAnimationFinished(viewHolder: RecyclerView.ViewHolder)
Called after #dispatchAnimationFinished(ViewHolder) is called by the ItemAnimator.
|
Long |
getAddDuration()
Gets the current duration for which all add animations will run.
|
Boolean |
isRunning()
Method which returns whether there are any item animations currently running. This method can be used to determine whether to delay other actions until animations end.
|
Boolean |
isRunning(listener: RecyclerView.ItemAnimator.ItemAnimatorFinishedListener?)
Like #isRunning() , this method returns whether there are any item animations currently running. Additionally, the listener passed in will be called when there are no item animations running, either immediately (before the method returns) if no animations are currently running, or when the currently running animations are finished .
Note that the listener is transient - it is either called immediately and not stored at all, or stored only until it is called when running animations are finished sometime later.
|
Unit |
dispatchAnimationsFinished()
This method should be called by ItemAnimator implementations to notify any listeners that all pending and active item animations are finished.
|
Unit |
endAnimation(item: RecyclerView.ViewHolder)
Method called when an animation on a view should be ended immediately. This could happen when other events, like scrolling, occur, so that animating views can be quickly put into their proper end locations. Implementations should ensure that any animations running on the item are canceled and affected properties are set to their end values. Also, #dispatchAnimationFinished(ViewHolder) should be called for each finished animation since the animations are effectively done when this method is called.
|
Unit |
setRemoveDuration(removeDuration: Long)
Sets the duration for which all remove animations will run.
|
Long |
getChangeDuration()
Gets the current duration for which all change animations will run.
|
Unit |
dispatchAnimationStarted(viewHolder: RecyclerView.ViewHolder)
Method to be called by subclasses when an animation is started.
For each call RecyclerView makes to animateAppearance() , animatePersistence() , or animateDisappearance() , there should be a matching #dispatchAnimationStarted(ViewHolder) call by the subclass.
For animateChange() , subclass should call this method for both the oldHolder and newHolder (if they are not the same instance).
If your ItemAnimator decides not to animate a ViewHolder, it should call #dispatchAnimationFinished(ViewHolder) without calling #dispatchAnimationStarted(ViewHolder) .
|
RecyclerView.ItemAnimator.ItemHolderInfo |
recordPostLayoutInformation(state: RecyclerView.State, viewHolder: RecyclerView.ViewHolder)
Called by the RecyclerView after the layout is complete. Item animator should record necessary information about the View's final state.
The data returned from this method will be passed to the related animate** methods.
The default implementation returns an ItemHolderInfo which holds the bounds of the View.
|
Unit |
onAnimationStarted(viewHolder: RecyclerView.ViewHolder)
Called when a new animation is started on the given ViewHolder.
|
RecyclerView.ItemAnimator.ItemHolderInfo |
obtainHolderInfo()
Returns a new ItemHolderInfo which will be used to store information about the ViewHolder. This information will later be passed into animate** methods.
You can override this method if you want to extend ItemHolderInfo and provide your own instances.
|
Unit |
setMoveDuration(moveDuration: Long)
Sets the duration for which all move animations will run.
|
Unit |
endAnimations()
Method called when all item animations should be ended immediately. This could happen when other events, like scrolling, occur, so that animating views can be quickly put into their proper end locations. Implementations should ensure that any animations running on any items are canceled and affected properties are set to their end values. Also, #dispatchAnimationFinished(ViewHolder) should be called for each finished animation since the animations are effectively done when this method is called.
|