Implement Hierarchical Timing specification for all animators in accordance with Google Material Design motion guidelines #66
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal
Adhere to the Google Material Design Hierarchical Timing spec, illustrated in this video.
Motivation
The Google Material Design spec for recycler view animations specifies:
Pull Request
In this PR, I've implemented the Hierarchical Timing specification for all animators, achieving the cool effect that the spec video shows.
Here's a video of my implementation in action, in my app:
https://www.dropbox.com/s/gxiw63pn7ljv3if/recyclerview-animation.mp4?dl=0
Implementation details
I achieved this by adding a
.setStartDelay
call to each Animator'sanimateAddImpl
andanimateRemoveImpl
method. They call two new methods onBaseAnimator
:getAddDelay
andgetRemoveDelay
respectively. These methods will determine the delay based on:.setAddDuration
orsetRemoveDuration
(currently, this is retrieved and then divided by 4 - I found this gives the best result and provides smooth, overlapping animations that are closest to the spec video.)Let me know if you need more information to merge this. Thanks for the great library!