public void setProgressWithAnimation ( float progress , int duration ) { if ( progressAnimator != null ) { progressAnimator . cancel ( ) ; } progressAnimator = ValueAnimator . ofFloat ( this . progress , progress ) ; progressAnimator . setDuration ( duration ) ; progressAnimator . addUpdateListener ( new ValueAnimator . AnimatorUpdateListener ( ) { @ Override public void onAnimationUpdate ( ValueAnimator animation ) { float progress = ( Float ) animation . getAnimatedValue ( ) ; setProgress ( progress , true ) ; if ( indeterminateMode ) { float updateAngle = progress * 360 / 100 ; startAngle = DEFAULT_START_ANGLE + ( rightToLeft ? updateAngle : - updateAngle ) ; } } } ) ; progressAnimator . start ( ) ; }
Set the progress with an animation .