Java Code Examples for android.animation.Animator#isStarted()

The following examples show how to use android.animation.Animator#isStarted() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnimatedVectorDrawable.java    From ElasticProgressBar with Apache License 2.0 6 votes vote down vote up
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 (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            if (animator.isStarted()) {
                return true;
            }
        }else {
            if (animator.isRunning()) {
                return true;
            }
        }
    }
    return false;
}
 
Example 2
Source File: AnimatedVectorDrawable.java    From ElasticProgressBar with Apache License 2.0 6 votes vote down vote up
@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 (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            if (!animator.isStarted()) {
                animator.start();
            }
        }else {
            if (!animator.isRunning()) {
                animator.start();
            }
        }
    }
    invalidateSelf();
}
 
Example 3
Source File: AnimatorUtil.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 启动
 *
 * @param animator
 */
public static boolean start(Animator animator) {
    if (animator != null && !animator.isStarted()) {
        animator.setupStartValues();
        animator.start();
        return true;
    }
    return false;
}
 
Example 4
Source File: AnimatorUtil.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
/**
 * call function and end
 *
 * @param animator
 * @return
 */
public static boolean end(Animator animator) {
    if (animator != null && animator.isStarted()) {
        animator.end();
        return true;
    }
    return false;
}
 
Example 5
Source File: AnimatableIconView.java    From GeometricWeather with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void startAnimators() {
    for (Animator a : iconAnimators) {
        if (a != null && a.isStarted()) {
            // animating.
            return;
        }
    }
    for (int i = 0; i < iconAnimators.length; i ++) {
        if (iconAnimators[i] != null && iconImageViews[i].getVisibility() == VISIBLE) {
            iconAnimators[i].start();
        }
    }
}
 
Example 6
Source File: AnimatedSVGDrawable.java    From SVG-Android with Apache License 2.0 5 votes vote down vote up
private boolean isStarted() {
    final ArrayList<Animator> animators = mAnimatedSVGState.mAnimators;
    if (animators == null || animators.isEmpty()) {
        return false;
    }
    final int size = animators.size();
    for (int i = 0; i < size; i++) {
        final Animator animator = animators.get(i);
        if (animator.isStarted()) {
            return true;
        }
    }
    return false;
}
 
Example 7
Source File: BaseIndeterminateProgressDrawable.java    From MaterialProgressBar with Apache License 2.0 5 votes vote down vote up
private boolean isStarted() {
    for (Animator animator : mAnimators) {
        if (animator.isStarted()) {
            return true;
        }
    }
    return false;
}
 
Example 8
Source File: Transition.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * 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.
 */
void playTransition(ViewGroup sceneRoot) {
    mStartValuesList = new ArrayList<TransitionValues>();
    mEndValuesList = new ArrayList<TransitionValues>();
    matchStartAndEnd(mStartValues, mEndValues);

    ArrayMap<Animator, AnimationInfo> runningAnimators = getRunningAnimators();
    int numOldAnims = runningAnimators.size();
    WindowId windowId = sceneRoot.getWindowId();
    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.windowId == windowId) {
                TransitionValues oldValues = oldInfo.values;
                View oldView = oldInfo.view;
                TransitionValues startValues = getTransitionValues(oldView, true);
                TransitionValues endValues = getMatchedTransitionValues(oldView, true);
                if (startValues == null && endValues == null) {
                    endValues = mEndValues.viewValues.get(oldView);
                }
                boolean cancel = (startValues != null || endValues != null) &&
                        oldInfo.transition.isTransitionRequired(oldValues, endValues);
                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, mStartValuesList, mEndValuesList);
    runAnimators();
}
 
Example 9
Source File: AnimationUtils.java    From RxTools-master with Apache License 2.0 4 votes vote down vote up
public static void start(Animator animator) {
    if (animator != null && !animator.isStarted()) {
        animator.start();
    }
}
 
Example 10
Source File: AnimatorUtils.java    From Transitions-Everywhere with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isAnimatorStarted(@NonNull Animator anim) {
    return anim.isStarted();
}