Skip to content

Commit

Permalink
[ProgressIndicator] Updated system animation duration scale more freq…
Browse files Browse the repository at this point in the history
…uently.

PiperOrigin-RevId: 321407050
  • Loading branch information
pekingme authored and hunterstich committed Jul 16, 2020
1 parent 28177cb commit 92aca74
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.os.Parcelable;
import android.os.SystemClock;
import android.provider.Settings.Global;
import android.provider.Settings.System;
Expand Down Expand Up @@ -346,7 +345,7 @@ private void unregisterAnimationCallbacks() {
}
}

private void updateProgressDrawableAnimationScale() {
private void updateAnimationScale() {
systemAnimationScale = getSystemAnimatorDurationScale();
if (systemAnimationScale > 0) {
if (getProgressDrawable() != null) {
Expand Down Expand Up @@ -436,6 +435,8 @@ private void applyNewVisibility() {
return;
}

updateAnimationScale();

boolean visibleToUser = visibleToUser();

// Sets the drawable to visible/invisible if the component is currently visible/invisible. Only
Expand Down Expand Up @@ -463,13 +464,6 @@ protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
}

@Override
public void onRestoreInstanceState(Parcelable state) {
super.onRestoreInstanceState(state);

updateProgressDrawableAnimationScale();
}

// ******************** Draw methods **********************

@Override
Expand Down Expand Up @@ -1019,6 +1013,9 @@ public void setProgressCompat(int progress, boolean animated) {
// mode.
storedProgress = progress;
storedProgressAnimated = animated;

updateAnimationScale();

if (isAnimatorDisabled()) {
switchIndeterminateModeCallback.onAnimationEnd(getIndeterminateDrawable());
} else {
Expand Down

0 comments on commit 92aca74

Please sign in to comment.