So after seeing this post on reddit the other day, I decided I'd try and utilize Rebound for the link drawer in my Hacker News app. Currently, the app uses a basic translate animation on the StoryLinkFragment when the "Show Link" button is pressed.
The simple translate animation is as follows:
1
2
3
4
5
6<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate android:fromXDelta="0%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="-100%"
android:duration="@integer/fragment_animation_times"/>
</set>
The animation ends up looking like this:
I consider this a bare minimum animation, gets the job done in showing the user a new view, but has no easing or natural motion to it.
Rebound handles this issue by utilizing spring physics on the views, as seen here. In order to improve the earlier animation, I created a RelativeLayout that has the spring physics built in.
The code for ReboundRevealRelativeLayout follows (it could probably use a bit of cleanup):
Using this layout for the link view ends up looking like this:
Comparing the two, it's easy to see the improvement in the motion on the drawer reveal. It's a simple animation but the little things count towards creating a pleasing user experience.
The fragment code that controls this view can be found here.