Example usage for android.animation Animator end

List of usage examples for android.animation Animator end

Introduction

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

Prototype

public void end() 

Source Link

Document

Ends the animation.

Usage

From source file:android.support.graphics.drawable.AnimatedVectorDrawableCompat.java

@Override
public void stop() {
    if (mDelegateDrawable != null) {
        ((AnimatedVectorDrawable) mDelegateDrawable).stop();
        return;//from w  ww.j  a v  a 2  s .c o  m
    }
    final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators;
    final int size = animators.size();
    for (int i = 0; i < size; i++) {
        final Animator animator = animators.get(i);
        animator.end();
    }
}

From source file:com.android.clear.reminder.ItemAnimator.java

@Override
public void endAnimation(ViewHolder holder) {
    final Animator animator = mAnimators.get(holder);

    mAnimators.remove(holder);/* w  ww  .j  ava 2s.c o  m*/
    mAddAnimatorsList.remove(animator);
    mRemoveAnimatorsList.remove(animator);
    mChangeAnimatorsList.remove(animator);
    mMoveAnimatorsList.remove(animator);

    if (animator != null) {
        animator.end();
    }

    dispatchFinishedWhenDone();
}

From source file:com.conferenceengineer.android.iosched.ui.SessionDetailFragment.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void setOrAnimateIconTo(final ImageView imageView, final int imageResId, boolean animate) {
    if (UIUtils.hasICS() && imageView.getTag() != null) {
        if (imageView.getTag() instanceof Animator) {
            Animator anim = (Animator) imageView.getTag();
            anim.end();
            imageView.setAlpha(1f);/*from w w  w .ja  v  a 2  s.c  o m*/
        }
    }

    animate = animate && UIUtils.hasICS();
    if (animate) {
        int duration = getResources().getInteger(android.R.integer.config_shortAnimTime);

        Animator outAnimator = ObjectAnimator.ofFloat(imageView, View.ALPHA, 0f);
        outAnimator.setDuration(duration / 2);
        outAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setImageResource(imageResId);
            }
        });

        AnimatorSet inAnimator = new AnimatorSet();
        inAnimator.setDuration(duration);
        inAnimator.playTogether(ObjectAnimator.ofFloat(imageView, View.ALPHA, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_X, 0f, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_Y, 0f, 1f));

        AnimatorSet set = new AnimatorSet();
        set.playSequentially(outAnimator, inAnimator);
        set.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setTag(null);
            }
        });
        imageView.setTag(set);
        set.start();
    } else {
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                imageView.setImageResource(imageResId);
            }
        });
    }
}

From source file:com.flexible.flexibleadapter.AnimatorAdapter.java

/**
 * Cancels any existing animations for given View. Useful when fling.
 *///from ww w  .  j  a  v a  2s.c  o m
private void cancelExistingAnimation(final int hashCode) {
    Animator animator = mAnimators.get(hashCode);
    if (animator != null)
        animator.end();
}

From source file:com.gdgdevfest.android.apps.devfestbcn.ui.SessionDetailFragment.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void setOrAnimateIconTo(final ImageView imageView, final int imageResId, boolean animate) {
    if (UIUtils.hasICS() && imageView.getTag() != null) {
        if (imageView.getTag() instanceof Animator) {
            Animator anim = (Animator) imageView.getTag();
            anim.end();
            imageView.setAlpha(1f);/*from   w  ww  .j  a  va 2  s . com*/
        }
    }

    animate = animate && UIUtils.hasICS();
    if (animate) {
        int duration = getResources().getInteger(android.R.integer.config_shortAnimTime);

        Animator outAnimator = ObjectAnimator.ofFloat(imageView, View.ALPHA, 0f);
        outAnimator.setDuration(duration / 2);
        outAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setImageResource(imageResId);
            }
        });

        AnimatorSet inAnimator = new AnimatorSet();
        outAnimator.setDuration(duration);
        inAnimator.playTogether(ObjectAnimator.ofFloat(imageView, View.ALPHA, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_X, 0f, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_Y, 0f, 1f));

        AnimatorSet set = new AnimatorSet();
        set.playSequentially(outAnimator, inAnimator);
        set.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setTag(null);
            }
        });
        imageView.setTag(set);
        set.start();
    } else {
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                imageView.setImageResource(imageResId);
            }
        });
    }
}

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

/**
 * Resumes this transition, sending out calls to {@link
 * TransitionListener#onTransitionPause(TransitionPort)} to all listeners
 * and pausing all running animators started by this transition.
 *
 * @hide//  w  ww . ja  v  a  2s. c  o  m
 */
@RestrictTo(GROUP_ID)
public void resume(View sceneRoot) {
    if (mPaused) {
        if (!mEnded) {
            ArrayMap<Animator, AnimationInfo> runningAnimators = getRunningAnimators();
            int numOldAnims = runningAnimators.size();
            WindowIdPort windowId = WindowIdPort.getWindowId(sceneRoot);
            for (int i = numOldAnims - 1; i >= 0; i--) {
                AnimationInfo info = runningAnimators.valueAt(i);
                if (info.view != null && windowId.equals(info.windowId)) {
                    Animator anim = runningAnimators.keyAt(i);
                    anim.end(); // resume() is API Level 19
                }
            }
            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).onTransitionResume(this);
                }
            }
        }
        mPaused = false;
    }
}