Example usage for android.app Fragment onCreateAnimator

List of usage examples for android.app Fragment onCreateAnimator

Introduction

In this page you can find the example usage for android.app Fragment onCreateAnimator.

Prototype

public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) 

Source Link

Document

Called when a fragment loads an animation.

Usage

From source file:android.app.FragmentManager.java

Animator loadAnimator(Fragment fragment, int transit, boolean enter, int transitionStyle) {
    Animator animObj = fragment.onCreateAnimator(transit, enter, fragment.mNextAnim);
    if (animObj != null) {
        return animObj;
    }//from w w  w.j av a2s.  com

    if (fragment.mNextAnim != 0) {
        Animator anim = AnimatorInflater.loadAnimator(mActivity, fragment.mNextAnim);
        if (anim != null) {
            return anim;
        }
    }

    if (transit == 0) {
        return null;
    }

    int styleIndex = transitToStyleIndex(transit, enter);
    if (styleIndex < 0) {
        return null;
    }

    if (transitionStyle == 0 && mActivity.getWindow() != null) {
        transitionStyle = mActivity.getWindow().getAttributes().windowAnimations;
    }
    if (transitionStyle == 0) {
        return null;
    }

    TypedArray attrs = mActivity.obtainStyledAttributes(transitionStyle,
            com.android.internal.R.styleable.FragmentAnimation);
    int anim = attrs.getResourceId(styleIndex, 0);
    attrs.recycle();

    if (anim == 0) {
        return null;
    }

    return AnimatorInflater.loadAnimator(mActivity, anim);
}