Cherrysh, the app for planning the perfect date, just got some beautiful animations with surprisingly little code. The Android Design site has been recommending that we enchant users with subtle effects like animation and have clear layout transitions. It turns out that modern versions of Android supply the tools to do this easily!
The app has always allowed users to close date spot recommendations they weren’t interested in to improve and personalize results. This transition used to happen instantly with another recommendation taking the place of the previous one:
With a single line of code, however, you can fade out the item being removed and slide in the new content from the bottom:
To do this you enable layout transitions by the animateLayoutChanges property on the containing layout:
<!-- recommendation items get inserted here -->
This capability has improved along with Android. In 4.0, Ice Cream Sandwich, it animates changes related to the parent container as well such as the width of the changed container. In 4.1, Jelly Bean, all animations on the system run smoother by triple buffering and synchronizing work with the refresh of the screen. This prevents calculating animations multiple times or piecemeal with some work never even being shown by the screen and makes things much smoother. Also checkout the LayoutTransition.CHANGING constant which defines extra animation that can optionally be enabled in JellyBean to animate more than just add/remove/show/hide.
Hope this helps in your own coding adventures. Check out Cherrysh if you are looking for a place to go out to tonight or want to see the animation in action!