-
Notifications
You must be signed in to change notification settings - Fork 554
5.x | Adapter Animations
Scroll animation is created in the method scrollAnimators()
of FlexibleViewHolder
.
The method scrollAnimators()
is always called by the Adapter if animations have been activated. The view will animate when scrolling, you just need to override it by adding new animators to the list of Animators. Usually animation is applied to itemView
but you can apply to any view in the itemView.
Activation and configuration is done by calling the following methods of FlexibleAdapter
:
Method name | Description |
---|---|
setAnimationOnScrolling() |
Enable/Disable item animation while scrolling and on loading. Enabling scrolling will disable onlyEntryAnimation. Disabling scrolling will disable also reverse scrolling! Default value is false . |
setAnimationOnReverseScrolling() |
Enable reverse scrolling animation if AnimationOnScrolling is also enabled! Value is ignored if basic animation on scrolling is disabled. Default value is false (only forward). |
setOnlyEntryAnimation() |
Performs only entry animation during the initial loading. Stops the animation after the last visible item in the RecyclerView has been animated. Note: Loading animation can only be performed if the Adapter is initialized with some items using the Constructor. Default value is false . |
setAnimationEntryStep() |
If initial loading animation should use step delay between an item animation and the next. When false, all items are animated with no delay. Better to disable when using Grid layouts. Default value is true . |
setAnimationInitialDelay() |
Customize the initial delay for the first item animation. Default value is 0ms . |
setAnimationDelay() |
Customize the step delay between an animation and the next to be added to the initial delay. The delay is added on top of the previous delay. Default value is 100ms . |
setAnimationDuration() |
Customize the duration of the animation for ALL items. Default value is 300ms . |
setAnimationInterpolator() |
Define a custom interpolator for ALL items. Default value is LinearInterpolator . |
ℹ️ Tip:
AnimatorHelper
simplifies the creation of basic animations, such as: Alpha, Scale, Flip, SlideInFromLeft, SlideInFromRight, SlideInFromBottom, SlideInFromTop.
These animations occur when adding/removing/moving/changing notifications are triggered on an item. This library has a custom implementation of SimpleItemAnimator
, named FlexibleItemAnimator
available in UI Extension library.
FlexibleItemAnimator
class has more options than recyclerview-animators library. It allows to set a delay based on the index
of the items to animate and has the possibility to be overridden by the animation implemented in the ViewHolder.
🍒 Tip:
AnimatorSubItem
class (from the demoApp) has specific animation implemented that you can take as working example.Suppose you want different and unique add/remove animation on subItems when they are collapsed or expanded. Normally, those animation are performed on all items if an ItemAnimator (for instance
LandingAnimator
) is assigned to the RecyclerView. Now, specific Animation can be performed on the singleViewHolder
if the ViewHolder implementsAnimatedViewHolder
and the methods returntrue
, then the general ItemAnimator is therefore overridden.
- Update Data Set
- Selection modes
- Headers and Sections
- Scrollable Headers and Footers
- Expandable items
- Drag&Drop and Swipe
- EndlessScroll / On Load More
- Search Filter
- FastScroller
- Adapter Animations
- Third party Layout Managers
- Payload
- Smooth Layout Managers
- Flexible Item Decoration
- Utils
- ActionModeHelper
- AnimatorHelper
- EmptyViewHelper
- UndoHelper
* = Under revision!