Example usage for android.animation Animator pause

List of usage examples for android.animation Animator pause

Introduction

In this page you can find the example usage for android.animation Animator pause.

Prototype

public void pause() 

Source Link

Document

Pauses a running animation.

Usage

From source file:Main.java

@SuppressLint("NewApi")
public static void pauseOrStopAnimator(Animator animator) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        animator.pause();
    } else {/*from ww w .  j a v  a2  s. c  o m*/
        animator.cancel();
    }
}

From source file:Main.java

/**
 * pause/*from  w  w w  . j  av a2s .c  o  m*/
 *
 * @param animator
 */
public static boolean pause(Animator animator) {
    if (animator != null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            if (!animator.isPaused()) {
                animator.pause();
                return true;
            }
        }
    }
    return false;
}

From source file:com.givewaygames.transition.Transition.java

/**
 * Pauses this transition, sending out calls to {@link
 * com.hirevue.manager.tmp.transition.Transition.TransitionListener#onTransitionPause(com.hirevue.manager.tmp.transition.Transition)} to all listeners
 * and pausing all running animators started by this transition.
 *
 * @hide//from  ww w.  java 2s  .c om
 */
public void pause() {
    if (!mEnded) {
        ArrayMap<Animator, AnimationInfo> runningAnimators = getRunningAnimators();
        int numOldAnims = runningAnimators.size();
        for (int i = numOldAnims - 1; i >= 0; i--) {
            Animator anim = runningAnimators.keyAt(i);
            anim.pause();
        }
        if (mListeners != null && mListeners.size() > 0) {
            ArrayList<TransitionListener> tmpListeners = (ArrayList<TransitionListener>) mListeners.clone();
            int numListeners = tmpListeners.size();
            for (int i = 0; i < numListeners; ++i) {
                tmpListeners.get(i).onTransitionPause(this);
            }
        }
        mPaused = true;
    }
}