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);
}
});
}
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();
}
}
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();
}
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();
}
Aggregations