Skip to content
No description, website, or topics provided.
Java C++ Other
Branch: r19
Clone or download
Pull request Compare This branch is 87 commits ahead, 21719 commits behind CyanogenMod:cm-14.1.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea Add support for View Animations or Animators in FragmentTransaction.s… Mar 9, 2014
.settings removed actionbarsherlock Jun 29, 2013
maven_repo_3rd_party/android/android/4.4_r1 android-maven-plugin 3.8.0 Nov 27, 2013
sample added travis-ci configuration Mar 6, 2015
tests Generalize support library tests. May 30, 2013
v13 am e93b516: am d099474: am 86fb8ef: gradle for support lib. Sep 13, 2013
v4 added travis-ci configuration Mar 6, 2015
v7 Merge in android-4.4_r1 Nov 4, 2013
v8/renderscript am 29f6436: am 232f84a: am 8d63d10: Merge "Fix YUV to RGB intrinsic t… Sep 27, 2013
.gitignore Migrated to AAR packaging Sep 20, 2014
.project removed actionbarsherlock Jun 29, 2013
.travis.yml added travis-ci configuration Mar 6, 2015 Add media router picker UI. May 13, 2013 Add support for View Animations or Animators in FragmentTransaction.s… Mar 9, 2014
build.gradle gradle for support lib. Sep 13, 2013 gradle for support lib. Sep 13, 2013
parent.iml added IDEA project configuration. maven site to replace github generated Jul 1, 2013
pom.xml [maven-release-plugin] prepare for next development iteration Feb 21, 2015
sample.iml Add support for View Animations or Animators in FragmentTransaction.s… Mar 9, 2014
settings.gradle gradle for support lib. Sep 13, 2013
support-v4-animator.iml Add support for View Animations or Animators in FragmentTransaction.s… Mar 9, 2014

#Android Support Library v4 with NineOldAndroids

Allows using android Property Animations with Google's Support Library v4 Fragment transitions. Rely's on Jake Wharton's NineOldAndroids.

##Project Configuration

Your project must have NineOldAndroids in the classpath. This can be done with Maven or putting the jar into the /libs folder. This project is packaged as an APK Library to support style resources. Import it into eclipse and reference it as an Android Library. Right-click on project and Properties->Android. Finally remove Google's support v4 library from your classpath.

The latest version is available on the Maven Central Repo



Read Google's documentation about Property Animations. They are different from View animations. For example:

Create a file `res/animator/fade_in.xml'

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android=""

Look at the sample application for a complete example and read below for instructions.

###Animator Fragment Transitions

This fork allows using NineOldAndroids Object Animators for fragment transitions. View animations will also work but only for Custom Transitions.

####Standard Transitions

Specify standard transitions in the transaction.


####Custom Transitions

Specify custom transition animations in the transaction

//Assign Object Animators for transitions
tx.setCustomTransitions(R.animator.flip_left_in, R.animator.flip_left_out, R.animator.flip_right_in, R.animator.flip_right_out)

//View Animations also work
tx.setCustomTransitions(R.anim.slide_in_right, R.anim.slide_out_left, R.anim.slide_in_left, R.anim.slide_out_right)

####Fragment Implementation Specified Transitions

Specify animations in Fragment implementation

public class AnimatedFragment extends Fragment {

	//class contents removed

	public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) {
	   //If transaction specifies a custom animation, use it
		  return AnimatorInflater.loadAnimator(getActivity(), nextAnim);
		  return AnimatorInflater.loadAnimator(getActivity(), R.animator.fade_in);
		  return AnimatorInflater.loadAnimator(getActivity(), R.animator.fade_out);


####Transition style resources

Specify transition animations in a style resource.

Create a style resource `res/values/styles.xml'

<?xml version="1.0" encoding="utf-8"?>
 	<!-- Override standard Transitions with a Style -->
   	<style name="MyTransitionStyle">
	    <item name="fragmentFadeEnterAnimation">@animator/fade_enter</item>
	    <item name="fragmentFadeExitAnimation">@animator/fade_exit</item>
	    <item name="fragmentOpenEnterAnimation">@animator/flip_left_in</item>
	    <item name="fragmentOpenExitAnimation">@animator/flip_left_out</item>
	    <item name="fragmentCloseEnterAnimation">@animator/flip_right_in</item>
	    <item name="fragmentCloseExitAnimation">@animator/flip_right_out</item>

Specify the resource and transition in the transaction



The standard ViewPager ignores PageTransformers in pre-HoneyComb API levels. This library supports implementing PageTransformers with NineOldAndroids. Just use ViewHelper instead of the View properties. For example:

 * Implemented using NineOldAndroids ViewHelper instead of newer API View properties
public class ZoomOutPageTransformer implements PageTransformer {
    private static float MIN_SCALE = 0.85f;
    private static float MIN_ALPHA = 0.5f;

    public void transformPage(View view, float position) {
        int pageWidth = view.getWidth();
        int pageHeight = view.getHeight();
        if (position < -1) { // [-Infinity,-1)
            // This page is way off-screen to the left.
            ViewHelper.setAlpha(view, 0);
        } else if (position <= 1) { // [-1,1]
            // Modify the default slide transition to shrink the page as well
            float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
            float vertMargin = pageHeight * (1 - scaleFactor) / 2;
            float horzMargin = pageWidth * (1 - scaleFactor) / 2;
            if (position < 0) {
                ViewHelper.setTranslationX(view, horzMargin - vertMargin / 2);
            } else {
                ViewHelper.setTranslationX(view, -horzMargin + vertMargin / 2);

            // Scale the page down (between MIN_SCALE and 1)
            ViewHelper.setScaleX(view, scaleFactor);
            ViewHelper.setScaleY(view, scaleFactor);

            // Fade the page relative to its size.
            ViewHelper.setAlpha(view, MIN_ALPHA +
                    (scaleFactor - MIN_SCALE) /
                    (1 - MIN_SCALE) * (1 - MIN_ALPHA));

        } else { // (1,+Infinity]
            // This page is way off-screen to the right.
            ViewHelper.setAlpha(view, 0);

Set the PageTransformer as usual:

viewPager.setPageTransformer(new ZoomOutPageTransformer());

###ActionBarDrawerToggle for Drawer Navigation

Google Support Library r13 added the Navigation Drawer. See the android docs for Drawer Navigation for details. The ActionBarDrawerToggle may be used with ActionBarSherlock to change the up icon on the ActionBar on Gingerbread.

You can’t perform that action at this time.