Example usage for android.animation Animator isStarted

List of usage examples for android.animation Animator isStarted

Introduction

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

Prototype

public boolean isStarted() 

Source Link

Document

Returns whether this Animator has been started and not yet ended.

Usage

From source file:Main.java

public static boolean start(Animator animator) {
    if (animator != null && animator.isStarted() == false) {
        animator.setupStartValues();/*from ww  w  .  ja v a2 s .c  o m*/
        animator.start();
        return true;
    }
    return false;
}

From source file:Main.java

/**
 * call function and end/*from   w  w  w. j  a v a 2 s. c  o  m*/
 *
 * @param animator
 * @return
 */
public static boolean end(Animator animator) {
    if (animator != null && animator.isStarted()) {
        animator.end();
        return true;
    }
    return false;
}

From source file:com.hippo.vectorold.drawable.AnimatedVectorDrawable.java

private boolean isStarted() {
    final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators;
    final int size = animators.size();
    for (int i = 0; i < size; i++) {
        final Animator animator = animators.get(i);
        if (animator.isStarted()) {
            return true;
        }/*ww  w . ja  va2 s .co  m*/
    }
    return false;
}

From source file:com.hippo.vectorold.drawable.AnimatedVectorDrawable.java

@Override
public void start() {
    final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators;
    final int size = animators.size();
    for (int i = 0; i < size; i++) {
        final Animator animator = animators.get(i);
        if (!animator.isStarted()) {
            animator.start();//from  ww w.j av a  2 s.  c  o m
        }
    }
    invalidateSelf();
}

From source file:im.ene.lab.design.widget.vector.AnimatedVectorDrawable.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private boolean isStarted() {
    final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators;
    final int size = animators.size();
    for (int i = 0; i < size; i++) {
        final Animator animator = animators.get(i);
        if (animator.isStarted()) {
            return true;
        }/*from   ww w.ja  v a 2 s.c  o  m*/
    }
    return false;
}

From source file:im.ene.lab.design.widget.vector.AnimatedVectorDrawable.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override/*  w w  w . j a v  a2s .com*/
public void start() {
    final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators;
    final int size = animators.size();
    for (int i = 0; i < size; i++) {
        final Animator animator = animators.get(i);
        if (!animator.isStarted()) {
            animator.start();
        }
    }
    invalidateSelf();
}

From source file:com.wnafee.vector.compat.AnimatedVectorDrawable.java

public void startTarget(String targetId) {
    for (Map.Entry<Animator, String> set : mAnimatedVectorState.mTargetNameMap.entrySet()) {
        final Animator animator = set.getKey();
        if (set.getValue().equals(targetId) && !animator.isStarted()) {
            animator.start();//  ww  w  . j  a v a 2  s  . c o m
        }
    }
    invalidateSelf();
}

From source file:android.support.transition.TransitionPort.java

/**
 * Called by TransitionManager to play the transition. This calls
 * createAnimators() to set things up and create all of the animations and then
 * runAnimations() to actually start the animations.
 *//*from   ww w.  j ava  2 s. c  om*/
void playTransition(ViewGroup sceneRoot) {
    ArrayMap<Animator, AnimationInfo> runningAnimators = getRunningAnimators();
    int numOldAnims = runningAnimators.size();
    for (int i = numOldAnims - 1; i >= 0; i--) {
        Animator anim = runningAnimators.keyAt(i);
        if (anim != null) {
            AnimationInfo oldInfo = runningAnimators.get(anim);
            if (oldInfo != null && oldInfo.view != null
                    && oldInfo.view.getContext() == sceneRoot.getContext()) {
                boolean cancel = false;
                TransitionValues oldValues = oldInfo.values;
                View oldView = oldInfo.view;
                TransitionValues newValues = mEndValues.viewValues != null ? mEndValues.viewValues.get(oldView)
                        : null;
                if (newValues == null) {
                    newValues = mEndValues.idValues.get(oldView.getId());
                }
                if (oldValues != null) {
                    // if oldValues null, then transition didn't care to stash values,
                    // and won't get canceled
                    if (newValues != null) {
                        for (String key : oldValues.values.keySet()) {
                            Object oldValue = oldValues.values.get(key);
                            Object newValue = newValues.values.get(key);
                            if (oldValue != null && newValue != null && !oldValue.equals(newValue)) {
                                cancel = true;
                                if (DBG) {
                                    Log.d(LOG_TAG, "Transition.playTransition: " + "oldValue != newValue for "
                                            + key + ": old, new = " + oldValue + ", " + newValue);
                                }
                                break;
                            }
                        }
                    }
                }
                if (cancel) {
                    if (anim.isRunning() || anim.isStarted()) {
                        if (DBG) {
                            Log.d(LOG_TAG, "Canceling anim " + anim);
                        }
                        anim.cancel();
                    } else {
                        if (DBG) {
                            Log.d(LOG_TAG, "removing anim from info list: " + anim);
                        }
                        runningAnimators.remove(anim);
                    }
                }
            }
        }
    }

    createAnimators(sceneRoot, mStartValues, mEndValues);
    runAnimators();
}

From source file:android.support.transition.Transition.java

/**
 * Called by TransitionManager to play the transition. This calls
 * createAnimators() to set things up and create all of the animations and then
 * runAnimations() to actually start the animations.
 *//*  ww w  . jav a  2s.com*/
void playTransition(ViewGroup sceneRoot) {
    ArrayMap<Animator, AnimationInfo> runningAnimators = getRunningAnimators();
    int numOldAnims = runningAnimators.size();
    for (int i = numOldAnims - 1; i >= 0; i--) {
        Animator anim = runningAnimators.keyAt(i);
        if (anim != null) {
            AnimationInfo oldInfo = runningAnimators.get(anim);
            if (oldInfo != null) {
                boolean cancel = false;
                TransitionValues oldValues = oldInfo.values;
                View oldView = oldInfo.view;
                TransitionValues newValues = mEndValues.viewValues != null ? mEndValues.viewValues.get(oldView)
                        : null;
                if (newValues == null) {
                    newValues = mEndValues.idValues.get(oldView.getId());
                }
                if (oldValues != null) {
                    // if oldValues null, then transition didn't care to stash values,
                    // and won't get canceled
                    if (newValues != null) {
                        for (String key : oldValues.values.keySet()) {
                            Object oldValue = oldValues.values.get(key);
                            Object newValue = newValues.values.get(key);
                            if (oldValue != null && newValue != null && !oldValue.equals(newValue)) {
                                cancel = true;
                                if (DBG) {
                                    Log.d(LOG_TAG, "Transition.playTransition: " + "oldValue != newValue for "
                                            + key + ": old, new = " + oldValue + ", " + newValue);
                                }
                                break;
                            }
                        }
                    }
                }
                if (cancel) {
                    if (anim.isRunning() || anim.isStarted()) {
                        if (DBG) {
                            Log.d(LOG_TAG, "Canceling anim " + anim);
                        }
                        anim.cancel();
                    } else {
                        if (DBG) {
                            Log.d(LOG_TAG, "removing anim from info list: " + anim);
                        }
                        runningAnimators.remove(anim);
                    }
                }
            }
        }
    }

    createAnimators(sceneRoot, mStartValues, mEndValues);
    runAnimators();
}