From 0cfc9ab1ac6a26642c50afe01dca72815421539b Mon Sep 17 00:00:00 2001 From: Toshihiro Sekioka Date: Mon, 20 Apr 2020 14:12:50 +0900 Subject: [PATCH] Fixed issue with quick cancellation --- .../jorgecastilloprz/progressarc/ProgressArcView.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/github/jorgecastilloprz/progressarc/ProgressArcView.java b/library/src/main/java/com/github/jorgecastilloprz/progressarc/ProgressArcView.java index ae68442..aaf76ad 100644 --- a/library/src/main/java/com/github/jorgecastilloprz/progressarc/ProgressArcView.java +++ b/library/src/main/java/com/github/jorgecastilloprz/progressarc/ProgressArcView.java @@ -38,6 +38,7 @@ public final class ProgressArcView extends ProgressBar { private int arcColor; private int arcWidth; private boolean roundedStroke; + private boolean stopped; public ProgressArcView(Context context, int arcColor, int arcWidth, boolean roundedStroke) { super(context); @@ -62,15 +63,19 @@ public void setInternalListener(ArcListener internalListener) { } public void show() { + stopped = false; postDelayed(new Runnable() { @Override public void run() { - setAlpha(1); - getDrawable().reset(); + if(!stopped){ + setAlpha(1); + getDrawable().reset(); + } } }, SHOW_SCALE_ANIM_DELAY); } public void stop() { + stopped = true; getDrawable().stop(); ValueAnimator fadeOutAnim = ObjectAnimator.ofFloat(this, "alpha", 1, 0); fadeOutAnim.setDuration(100).start();