From 5c471ea1d15628d3e54e5d163df535fa542e4350 Mon Sep 17 00:00:00 2001 From: Brook Mezgebu Date: Fri, 2 Oct 2020 00:25:17 +0300 Subject: [PATCH] fix: correct `setProgressWithAnimation` function to consider the progress direction --- .../mikhaellopez/circularprogressbar/CircularProgressBar.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/circularprogressbar/src/main/java/com/mikhaellopez/circularprogressbar/CircularProgressBar.kt b/circularprogressbar/src/main/java/com/mikhaellopez/circularprogressbar/CircularProgressBar.kt index 7033d9f..f4a7e4d 100755 --- a/circularprogressbar/src/main/java/com/mikhaellopez/circularprogressbar/CircularProgressBar.kt +++ b/circularprogressbar/src/main/java/com/mikhaellopez/circularprogressbar/CircularProgressBar.kt @@ -309,10 +309,11 @@ class CircularProgressBar(context: Context, attrs: AttributeSet? = null) : View( * @param startDelay [Long] optional, null by default. */ @JvmOverloads - fun setProgressWithAnimation(progress: Float, + fun setProgressWithAnimation(rawProgress: Float, duration: Long? = null, interpolator: TimeInterpolator? = null, startDelay: Long? = null) { + val progress = if (progressDirection.isToRight()) rawProgress * -1 else rawProgress progressAnimator?.cancel() progressAnimator = ValueAnimator.ofFloat(if (indeterminateMode) progressIndeterminateMode else this.progress, progress) duration?.also { progressAnimator?.duration = it }