Example usage for android.animation ValueAnimator removeAllListeners

List of usage examples for android.animation ValueAnimator removeAllListeners

Introduction

In this page you can find the example usage for android.animation ValueAnimator removeAllListeners.

Prototype

public void removeAllListeners() 

Source Link

Document

Removes all #addListener(android.animation.Animator.AnimatorListener) listeners and #addPauseListener(android.animation.Animator.AnimatorPauseListener) pauseListeners from this object.

Usage

From source file:Main.java

public static void cancelWithoutListenersNotified(ValueAnimator animator) {
    animator.removeAllUpdateListeners();
    animator.removeAllListeners();
    animator.cancel();//from   w w  w. j  a  v a 2  s .c o  m
}

From source file:de.dreier.mytargets.views.MaterialTapTargetPrompt.java

@TargetApi(11)
private void startRevealAnimation() {
    mPaintSecondaryText.setAlpha(0);/*www .  ja  v a 2s  .com*/
    mPaintPrimaryText.setAlpha(0);
    mView.mPaintBackground.setAlpha(0);
    mView.mPaintFocal.setAlpha(0);
    mView.mFocalRadius = 0;
    mView.mBackgroundRadius = 0;
    if (mView.mIconDrawable != null) {
        mView.mIconDrawable.setAlpha(0);
    }
    mRevealedAmount = 0f;
    mAnimationCurrent = ValueAnimator.ofFloat(0f, 1f);
    mAnimationCurrent.setInterpolator(mAnimationInterpolator);
    mAnimationCurrent.setDuration(225);
    mAnimationCurrent.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @TargetApi(Build.VERSION_CODES.HONEYCOMB)
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mRevealedAmount = (float) animation.getAnimatedValue();
            mView.mBackgroundRadius = mBaseBackgroundRadius * mRevealedAmount;
            mView.mFocalRadius = mBaseFocalRadius * mRevealedAmount;
            mView.mPaintFocal.setAlpha((int) (255 * mRevealedAmount));
            mView.mPaintBackground.setAlpha((int) (244 * mRevealedAmount));
            mPaintSecondaryText.setAlpha((int) (mSecondaryTextColourAlpha * mRevealedAmount));
            mPaintPrimaryText.setAlpha((int) (mPrimaryTextColourAlpha * mRevealedAmount));
            if (mView.mIconDrawable != null) {
                mView.mIconDrawable.setAlpha(mView.mPaintBackground.getAlpha());
            }
            mView.invalidate();
        }
    });
    mAnimationCurrent.addListener(new AnimatorListener() {
        @TargetApi(Build.VERSION_CODES.HONEYCOMB)
        @Override
        public void onAnimationEnd(Animator animation) {
            animation.removeAllListeners();
            mAnimationCurrent = null;
            mRevealedAmount = 1;
            startIdleAnimations();
        }

        @TargetApi(Build.VERSION_CODES.HONEYCOMB)
        @Override
        public void onAnimationCancel(Animator animation) {
            animation.removeAllListeners();
            mRevealedAmount = 1;
            mAnimationCurrent = null;
        }
    });
    mAnimationCurrent.start();
}

From source file:uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt.java

@TargetApi(11)
void startRevealAnimation() {
    mPaintSecondaryText.setAlpha(0);//  w  w  w .  j  av  a  2s  .  c o  m
    mPaintPrimaryText.setAlpha(0);
    mView.mPaintBackground.setAlpha(0);
    mView.mPaintFocal.setAlpha(0);
    mView.mFocalRadius = 0;
    mView.mBackgroundRadius = 0;
    if (mView.mIconDrawable != null) {
        mView.mIconDrawable.setAlpha(0);
    }
    mRevealedAmount = 0f;
    mAnimationCurrent = ValueAnimator.ofFloat(0f, 1f);
    mAnimationCurrent.setInterpolator(mAnimationInterpolator);
    mAnimationCurrent.setDuration(225);
    mAnimationCurrent.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @TargetApi(Build.VERSION_CODES.HONEYCOMB)
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mRevealedAmount = (float) animation.getAnimatedValue();
            mView.mBackgroundRadius = mBaseBackgroundRadius * mRevealedAmount;
            mView.mFocalRadius = mBaseFocalRadius * mRevealedAmount;
            mView.mPaintFocal.setAlpha((int) (255 * mRevealedAmount));
            mView.mPaintBackground.setAlpha((int) (244 * mRevealedAmount));
            mPaintSecondaryText.setAlpha((int) (mSecondaryTextColourAlpha * mRevealedAmount));
            mPaintPrimaryText.setAlpha((int) (mPrimaryTextColourAlpha * mRevealedAmount));
            if (mView.mIconDrawable != null) {
                mView.mIconDrawable.setAlpha(mView.mPaintBackground.getAlpha());
            }
            mView.invalidate();
        }
    });
    mAnimationCurrent.addListener(new AnimatorListener() {
        @TargetApi(Build.VERSION_CODES.HONEYCOMB)
        @Override
        public void onAnimationEnd(Animator animation) {
            animation.removeAllListeners();
            mAnimationCurrent = null;
            mRevealedAmount = 1;
            startIdleAnimations();
        }

        @TargetApi(Build.VERSION_CODES.HONEYCOMB)
        @Override
        public void onAnimationCancel(Animator animation) {
            animation.removeAllListeners();
            mRevealedAmount = 1;
            mAnimationCurrent = null;
        }
    });
    mAnimationCurrent.start();
}