Search in sources :

Example 1 with SimpleAnimationListener

use of com.mingle.SimpleAnimationListener in project AndroidSweetSheet by zzz40500.

the class Delegate method dismissShowdown.

/**
     * 隐藏模糊背景
     */
protected void dismissShowdown() {
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mBg, "alpha", 1, 0);
    objectAnimator.setDuration(400);
    objectAnimator.start();
    objectAnimator.addListener(new SimpleAnimationListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mParentVG.removeView(mBg);
        }
    });
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) SimpleAnimationListener(com.mingle.SimpleAnimationListener)

Example 2 with SimpleAnimationListener

use of com.mingle.SimpleAnimationListener in project AndroidSweetSheet by zzz40500.

the class CircleRevealHelper method circularReveal.

public void circularReveal(int centerX, int centerY, float startRadius, float endRadius, long duration, Interpolator interpolator) {
    mAnchorX = centerX;
    mAnchorY = centerY;
    if (mView.getParent() == null) {
        return;
    }
    if (Build.VERSION.SDK_INT >= 21) {
        Animator animator = ViewAnimationUtils.createCircularReveal(mView, mAnchorX, mAnchorY, startRadius, endRadius);
        animator.setInterpolator(interpolator);
        animator.setDuration(duration);
        animator.start();
    } else {
        ValueAnimator valueAnimator = ValueAnimator.ofFloat(startRadius, endRadius);
        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                mRadius = (float) animation.getAnimatedValue();
                mView.invalidate();
            }
        });
        valueAnimator.setInterpolator(interpolator);
        valueAnimator.addListener(new SimpleAnimationListener() {

            @Override
            public void onAnimationStart(com.nineoldandroids.animation.Animator animation) {
                isCircularReveal = true;
            }

            @Override
            public void onAnimationEnd(com.nineoldandroids.animation.Animator animation) {
                isCircularReveal = false;
            }

            @Override
            public void onAnimationCancel(com.nineoldandroids.animation.Animator animation) {
                isCircularReveal = false;
            }
        });
        valueAnimator.setDuration(duration);
        valueAnimator.start();
    }
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator) Animator(android.animation.Animator) SimpleAnimationListener(com.mingle.SimpleAnimationListener) ValueAnimator(com.nineoldandroids.animation.ValueAnimator)

Example 3 with SimpleAnimationListener

use of com.mingle.SimpleAnimationListener in project AndroidSweetSheet by zzz40500.

the class Delegate method dismiss.

/**
     * 消失
     */
protected void dismiss() {
    if (getStatus() == SweetSheet.Status.DISMISS) {
        return;
    }
    mBg.setClickable(false);
    dismissShowdown();
    ObjectAnimator translationOut = ObjectAnimator.ofFloat(mRootView, "translationY", 0, mRootView.getHeight());
    translationOut.setDuration(600);
    translationOut.setInterpolator(new DecelerateInterpolator());
    translationOut.addListener(new SimpleAnimationListener() {

        @Override
        public void onAnimationStart(Animator animation) {
            mStatus = SweetSheet.Status.DISMISSING;
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mStatus = SweetSheet.Status.DISMISS;
            mParentVG.removeView(mRootView);
        }
    });
    translationOut.start();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) SimpleAnimationListener(com.mingle.SimpleAnimationListener)

Example 4 with SimpleAnimationListener

use of com.mingle.SimpleAnimationListener in project AndroidSweetSheet by zzz40500.

the class SweetView method duang.

public void duang() {
    mStatus = Status.STATUS_DOWN;
    ValueAnimator valueAnimator = ValueAnimator.ofInt(mMaxArcHeight, 0);
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mArcHeight = (int) animation.getAnimatedValue();
            invalidate();
        }
    });
    valueAnimator.addListener(new SimpleAnimationListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (mAnimationListener != null) {
                mAnimationListener.onEnd();
            }
        }
    });
    valueAnimator.setDuration(500);
    valueAnimator.setInterpolator(new OvershootInterpolator(4f));
    valueAnimator.start();
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator) Animator(com.nineoldandroids.animation.Animator) OvershootInterpolator(android.view.animation.OvershootInterpolator) SimpleAnimationListener(com.mingle.SimpleAnimationListener) ValueAnimator(com.nineoldandroids.animation.ValueAnimator)

Aggregations

SimpleAnimationListener (com.mingle.SimpleAnimationListener)4 Animator (com.nineoldandroids.animation.Animator)3 ObjectAnimator (com.nineoldandroids.animation.ObjectAnimator)2 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)2 Animator (android.animation.Animator)1 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)1 OvershootInterpolator (android.view.animation.OvershootInterpolator)1