viewProgress = progress * viewMax / maxProgress;
if (useAnimation) {
ValueAnimator valueAnimator = ValueAnimator.ofFloat(beforeProgress, viewProgress);
- valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- RingProgress.this.viewProgress = (float) animation.getAnimatedValue();
- RingProgress.this.scaleProgress = RingProgress.this.viewProgress * RingProgress.this.maxProgress / viewMax;
- invalidate();
- setRingProgress(RingProgress.this.scaleProgress, RingProgress.this.progress, RingProgress.this.maxProgress);
- }
+ valueAnimator.addUpdateListener(animation -> {
+ RingProgress.this.viewProgress = (float) animation.getAnimatedValue();
+ RingProgress.this.scaleProgress = RingProgress.this.viewProgress * RingProgress.this.maxProgress / viewMax;
+ invalidate();
+ setRingProgress(RingProgress.this.scaleProgress, RingProgress.this.progress, RingProgress.this.maxProgress);
});
valueAnimator.setInterpolator(new DecelerateInterpolator());
valueAnimator.setDuration(duration);