Search in sources :

Example 86 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project InstaMaterial by frogermcs.

the class SendingProgressView method setupDoneAnimators.

private void setupDoneAnimators() {
    doneBgAnimator = ObjectAnimator.ofFloat(this, "currentDoneBgOffset", MAX_DONE_BG_OFFSET, 0).setDuration(300);
    doneBgAnimator.setInterpolator(new DecelerateInterpolator());
    checkmarkAnimator = ObjectAnimator.ofFloat(this, "currentCheckmarkOffset", MAX_DONE_IMG_OFFSET, 0).setDuration(300);
    checkmarkAnimator.setInterpolator(new OvershootInterpolator());
    checkmarkAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            changeState(STATE_FINISHED);
        }
    });
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) OvershootInterpolator(android.view.animation.OvershootInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 87 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project LikeAnimation by frogermcs.

the class LikeButtonView method onClick.

@Override
public void onClick(View v) {
    isChecked = !isChecked;
    ivStar.setImageResource(isChecked ? R.drawable.ic_star_rate_on : R.drawable.ic_star_rate_off);
    if (animatorSet != null) {
        animatorSet.cancel();
    }
    if (isChecked) {
        ivStar.animate().cancel();
        ivStar.setScaleX(0);
        ivStar.setScaleY(0);
        vCircle.setInnerCircleRadiusProgress(0);
        vCircle.setOuterCircleRadiusProgress(0);
        vDotsView.setCurrentProgress(0);
        animatorSet = new AnimatorSet();
        ObjectAnimator outerCircleAnimator = ObjectAnimator.ofFloat(vCircle, CircleView.OUTER_CIRCLE_RADIUS_PROGRESS, 0.1f, 1f);
        outerCircleAnimator.setDuration(250);
        outerCircleAnimator.setInterpolator(DECCELERATE_INTERPOLATOR);
        ObjectAnimator innerCircleAnimator = ObjectAnimator.ofFloat(vCircle, CircleView.INNER_CIRCLE_RADIUS_PROGRESS, 0.1f, 1f);
        innerCircleAnimator.setDuration(200);
        innerCircleAnimator.setStartDelay(200);
        innerCircleAnimator.setInterpolator(DECCELERATE_INTERPOLATOR);
        ObjectAnimator starScaleYAnimator = ObjectAnimator.ofFloat(ivStar, ImageView.SCALE_Y, 0.2f, 1f);
        starScaleYAnimator.setDuration(350);
        starScaleYAnimator.setStartDelay(250);
        starScaleYAnimator.setInterpolator(OVERSHOOT_INTERPOLATOR);
        ObjectAnimator starScaleXAnimator = ObjectAnimator.ofFloat(ivStar, ImageView.SCALE_X, 0.2f, 1f);
        starScaleXAnimator.setDuration(350);
        starScaleXAnimator.setStartDelay(250);
        starScaleXAnimator.setInterpolator(OVERSHOOT_INTERPOLATOR);
        ObjectAnimator dotsAnimator = ObjectAnimator.ofFloat(vDotsView, DotsView.DOTS_PROGRESS, 0, 1f);
        dotsAnimator.setDuration(900);
        dotsAnimator.setStartDelay(50);
        dotsAnimator.setInterpolator(ACCELERATE_DECELERATE_INTERPOLATOR);
        animatorSet.playTogether(outerCircleAnimator, innerCircleAnimator, starScaleYAnimator, starScaleXAnimator, dotsAnimator);
        animatorSet.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationCancel(Animator animation) {
                vCircle.setInnerCircleRadiusProgress(0);
                vCircle.setOuterCircleRadiusProgress(0);
                vDotsView.setCurrentProgress(0);
                ivStar.setScaleX(1);
                ivStar.setScaleY(1);
            }
        });
        animatorSet.start();
    }
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AnimatorSet(android.animation.AnimatorSet)

Example 88 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project PaymentKit-Droid by brendanw.

the class CardIcon method flipToBack.

private void flipToBack() {
    ViewUtils.setHardwareLayer(mFrontFace);
    ObjectAnimator rotateFront = ObjectAnimator.ofFloat(mFrontFace, "scaleX", 1.0f, 0.0f);
    rotateFront.setDuration(HALF_FLIP_DURATION);
    ViewUtils.setHardwareLayer(mBackFace);
    final ObjectAnimator rotateBack = ObjectAnimator.ofFloat(mBackFace, "scaleX", 0.0f, 1.0f);
    rotateBack.setDuration(HALF_FLIP_DURATION);
    rotateBack.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator anim) {
            ViewUtils.setLayerTypeNone(mBackFace);
        }
    });
    rotateFront.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator anim) {
            alphaOut(mFrontFace);
            ViewUtils.setLayerTypeNone(mFrontFace);
            alphaIn(mBackFace);
            rotateBack.start();
        }
    });
    rotateFront.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 89 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project PaymentKit-Droid by brendanw.

the class CardIcon method flipToFront.

private void flipToFront() {
    ViewUtils.setHardwareLayer(mBackFace);
    ObjectAnimator rotateBackFace = ObjectAnimator.ofFloat(mBackFace, "scaleX", 1.0f, 0.0f);
    rotateBackFace.setDuration(HALF_FLIP_DURATION);
    ViewUtils.setLayerTypeNone(mFrontFace);
    final ObjectAnimator rotateFrontFace = ObjectAnimator.ofFloat(mFrontFace, "scaleX", 0.0f, 1.0f);
    rotateFrontFace.setDuration(HALF_FLIP_DURATION);
    rotateFrontFace.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator anim) {
            ViewUtils.setLayerTypeNone(mBackFace);
        }
    });
    rotateBackFace.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator anim) {
            alphaOut(mBackFace);
            ViewUtils.setLayerTypeNone(mBackFace);
            alphaIn(mFrontFace);
            rotateFrontFace.start();
        }
    });
    rotateBackFace.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 90 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project fresco by facebook.

the class AnimatedZoomableController method setTransformAnimated.

@SuppressLint("NewApi")
@Override
public void setTransformAnimated(final Matrix newTransform, long durationMs, @Nullable final Runnable onAnimationComplete) {
    FLog.v(getLogTag(), "setTransformAnimated: duration %d ms", durationMs);
    stopAnimation();
    Preconditions.checkArgument(durationMs > 0);
    Preconditions.checkState(!isAnimating());
    setAnimating(true);
    mValueAnimator.setDuration(durationMs);
    getTransform().getValues(getStartValues());
    newTransform.getValues(getStopValues());
    mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            calculateInterpolation(getWorkingTransform(), (float) valueAnimator.getAnimatedValue());
            AnimatedZoomableController.super.setTransform(getWorkingTransform());
        }
    });
    mValueAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationCancel(Animator animation) {
            FLog.v(getLogTag(), "setTransformAnimated: animation cancelled");
            onAnimationStopped();
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            FLog.v(getLogTag(), "setTransformAnimated: animation finished");
            onAnimationStopped();
        }

        private void onAnimationStopped() {
            if (onAnimationComplete != null) {
                onAnimationComplete.run();
            }
            setAnimating(false);
            getDetector().restartGesture();
        }
    });
    mValueAnimator.start();
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ValueAnimator(android.animation.ValueAnimator) SuppressLint(android.annotation.SuppressLint)

Aggregations

Animator (android.animation.Animator)868 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)868 ObjectAnimator (android.animation.ObjectAnimator)464 ValueAnimator (android.animation.ValueAnimator)459 AnimatorSet (android.animation.AnimatorSet)144 View (android.view.View)131 ViewGroup (android.view.ViewGroup)92 PropertyValuesHolder (android.animation.PropertyValuesHolder)70 StackStateAnimator (com.android.systemui.statusbar.stack.StackStateAnimator)70 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)62 ImageView (android.widget.ImageView)45 TextView (android.widget.TextView)43 Interpolator (android.view.animation.Interpolator)42 Paint (android.graphics.Paint)41 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)41 Rect (android.graphics.Rect)40 RenderNodeAnimator (android.view.RenderNodeAnimator)36 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)36 TimeAnimator (android.animation.TimeAnimator)30 TargetApi (android.annotation.TargetApi)30