Skip to content

Commit

Permalink
[ProgressIndicator] Changed logic to guarantee the indeterminate arc …
Browse files Browse the repository at this point in the history
…fully collapsed before showing determinate arc.

PiperOrigin-RevId: 321613769
  • Loading branch information
pekingme authored and hunterstich committed Jul 20, 2020
1 parent fcf4b9f commit 764f063
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public final class CircularIndeterminateAnimatorDelegate

// For animator control.
boolean animatorCompleteEndRequested = false;
boolean indicatorWillFullyCollapsed = false;
AnimationCallback animatorCompleteCallback = null;

public CircularIndeterminateAnimatorDelegate() {
Expand All @@ -88,7 +87,6 @@ public void onAnimationEnd(Animator animation) {
if (animatorCompleteEndRequested) {
indicatorCollapsingAnimator.setFloatValues(
0f, 1f + INDICATOR_MIN_DEGREES / INDICATOR_DELTA_DEGREES);
indicatorWillFullyCollapsed = true;
}
}
});
Expand All @@ -107,17 +105,14 @@ public void onAnimationEnd(Animator animation) {
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);

if (animatorCompleteEndRequested && indicatorWillFullyCollapsed) {
if (animatorCompleteEndRequested && segmentPositions[0] == segmentPositions[1]) {
animatorCompleteCallback.onAnimationEnd(drawable);
animatorCompleteEndRequested = false;
resetPropertiesForNewStart();
} else {
// If the drawable is still visible, continues the main animator by restarting.
if (drawable.isVisible()) {
resetPropertiesForNextCycle();
startAnimator();
} else {
resetPropertiesForNewStart();
}
}
}
Expand Down

0 comments on commit 764f063

Please sign in to comment.