How to use honeycomb animation APIs for compat fragment

Tutorials with advanced 'difficulty' and more Lines of Code.

How to use honeycomb animation APIs for compat fragment

Postby voidmain » Fri Aug 23, 2013 2:17 am

As we all know, since Google released Honeycomb (API level 11), a new set of APIs are introduced, like Fragment, ActionBar and Property Animation. In order for older devices to use these APIs, google also released a support library that provides some compatibility version of a subset of the new APIs, including compat fragment.

I've been using the compat version of fragment for a while, and found out that it is kind of tough to use the new animation APIs for compat fragment. The blame is on compatibility. Even though the support library do have a method named
Code: Select all
FragmentTransaction#setCustomAnimations
, but this method only takes the old animation XML resource id as parameters. If you try to set some xml with
Code: Select all
<objectAnimator>
stuff in it, the app will simply crash.

I WILL NOT give up take full advantage of the new APIs, so after reading through the API samples, as well as googling around, I finally work it out. And here's a blog on how did I make it work: http://blog.voidmain.me/android/animator/fragment/2013/08/22/how-to-use-new-android-animation-api-for-compat-fragment.html, also, I've open sourced the sample project on github: https://github.com/void-main/FragmentCompatAnimator.

Note that, the sample project is not quite robust. It is a quick sample anyway, so, don't ask for too much. :D

Hope this is useful for someone.

Have a nice day!
voidmain
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Aug 23, 2013 2:04 am

Top

Return to Advanced Tutorials

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests