diff --git a/src/main/java/com/budiyev/android/circularprogressbar/CircularProgressBar.java b/src/main/java/com/budiyev/android/circularprogressbar/CircularProgressBar.java index 83ced68..7f18da9 100644 --- a/src/main/java/com/budiyev/android/circularprogressbar/CircularProgressBar.java +++ b/src/main/java/com/budiyev/android/circularprogressbar/CircularProgressBar.java @@ -162,8 +162,7 @@ public void setAnimateProgress(boolean animate) { } public void setIndeterminateMinimumAngle(float angle) { - boolean animating = - mIndeterminate && (mIndeterminateStartAnimator.isRunning() || mIndeterminateSweepAnimator.isRunning()); + boolean animating = isIndeterminateAnimating(); if (animating) { stopIndeterminateAnimations(); } @@ -176,8 +175,7 @@ public void setIndeterminateMinimumAngle(float angle) { } public void setIndeterminateRotationAnimationDuration(@IntRange(from = 0) long duration) { - boolean animating = - mIndeterminate && (mIndeterminateStartAnimator.isRunning() || mIndeterminateSweepAnimator.isRunning()); + boolean animating = isIndeterminateAnimating(); if (animating) { stopIndeterminateAnimations(); } @@ -189,8 +187,7 @@ public void setIndeterminateRotationAnimationDuration(@IntRange(from = 0) long d } public void setIndeterminateSweepAnimationDuration(@IntRange(from = 0) long duration) { - boolean animating = - mIndeterminate && (mIndeterminateStartAnimator.isRunning() || mIndeterminateSweepAnimator.isRunning()); + boolean animating = isIndeterminateAnimating(); if (animating) { stopIndeterminateAnimations(); } @@ -454,6 +451,10 @@ private void startIndeterminateAnimations() { } } + private boolean isIndeterminateAnimating() { + return mIndeterminate && (mIndeterminateStartAnimator.isRunning() || mIndeterminateSweepAnimator.isRunning()); + } + private final class ProgressUpdateListener implements ValueAnimator.AnimatorUpdateListener { @Override public void onAnimationUpdate(ValueAnimator animation) {