Skip to content

Commit

Permalink
[ProgressIndicator] Forward fixed "ripple" bug from the fix for indet…
Browse files Browse the repository at this point in the history
…erminate animation not respecting to system animator scale.

PiperOrigin-RevId: 320204213
  • Loading branch information
pekingme authored and ymarian committed Jul 8, 2020
1 parent e5f7951 commit cf98f94
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,6 @@ void resetPropertiesForNewStart() {

@Override
void resetPropertiesForNextCycle() {
// Don't reset animator controlled properties if at the end of the current cycle, the head of
// the arc is not animated to its start position for the next cycle.
if (!isArcHeadFullyAnimated()) {
return;
}
setIndicatorHeadChangeFraction(0f);
setIndicatorTailChangeFraction(0f);
setIndicatorStartOffset(
Expand Down Expand Up @@ -230,15 +225,6 @@ private void updateSegmentPositions() {
/ 360;
}

/**
* Returns whether the head of the arc is fully animated. If yes, it means the current head
* position can be directly used as the start offset for the next cycle.
*/
private boolean isArcHeadFullyAnimated() {
return segmentPositions[1]
== getIndicatorStartOffset() + INDICATOR_OFFSET_PER_COLOR_DEGREES + INDICATOR_DELTA_DEGREES;
}

// ******************* Getters and setters *******************

private int getDisplayedIndicatorColor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ public void onAnimationEnd(Animator animation) {
}
});
setGrowFraction(1f);
animatorDelegate.startAnimator();
}

@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ public void onAnimationEnd(Animator animation) {

@Override
public void startAnimator() {
resetPropertiesForNewStart();
animatorSet.start();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ public void onAnimationRepeat(Animator animation) {

@Override
public void startAnimator() {
resetPropertiesForNewStart();
animatorSet.start();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ private void initializeDrawables() {
? new LinearIndeterminateSeamlessAnimatorDelegate()
: new LinearIndeterminateNonSeamlessAnimatorDelegate(getContext());
setIndeterminateDrawable(new IndeterminateDrawable(this, drawingDelegate, animatorDelegate));
setProgressDrawable(new DeterminateDrawable(this, new LinearDrawingDelegate()));
setProgressDrawable(new DeterminateDrawable(this, drawingDelegate));
} else {
DrawingDelegate drawingDelegate = new CircularDrawingDelegate();
setIndeterminateDrawable(
Expand Down Expand Up @@ -452,7 +452,8 @@ public void hide() {
private void internalHide() {
// Hides animation should be used if it's visible to user and potentially can be hidden with
// animation, unless animators are disabled actively.
boolean shouldHideAnimated = visibleToUser() && growMode != GROW_MODE_NONE && !animatorDisabled;
boolean shouldHideAnimated =
visibleToUser() && growMode != GROW_MODE_NONE && !isAnimatorDisabled();

getCurrentDrawable().setVisible(false, shouldHideAnimated);

Expand Down Expand Up @@ -487,7 +488,7 @@ private void applyNewVisibility() {
// Sets the drawable to visible/invisible if the component is currently visible/invisible. Only
// show animation should be started (when the component is currently visible). Hide animation
// should have already ended or is not necessary at this point.
getCurrentDrawable().setVisible(visibleToUser, visibleToUser && !animatorDisabled);
getCurrentDrawable().setVisible(visibleToUser, visibleToUser && !isAnimatorDisabled());
}

@Override
Expand Down

0 comments on commit cf98f94

Please sign in to comment.