Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public LoadingIndicator(
drawable.setCallback(this);

specs = drawable.getDrawingDelegate().specs;
setAnimatorDurationScaleProvider(new AnimatorDurationScaleProvider());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@

/** This class draws the graphics for a loading indicator. */
public final class LoadingIndicatorDrawable extends Drawable implements Drawable.Callback {
AnimatorDurationScaleProvider animatorDurationScaleProvider;

@NonNull private final Context context;
@NonNull private final LoadingIndicatorSpec specs;
@NonNull private LoadingIndicatorDrawingDelegate drawingDelegate;
@NonNull private LoadingIndicatorAnimatorDelegate animatorDelegate;

@NonNull Paint paint;
@NonNull AnimatorDurationScaleProvider animatorDurationScaleProvider;

@IntRange(from = 0, to = 255)
int alpha;
Expand Down Expand Up @@ -68,6 +68,7 @@ public static LoadingIndicatorDrawable create(
this.animatorDelegate = animatorDelegate;

this.paint = new Paint();
this.animatorDurationScaleProvider = new AnimatorDurationScaleProvider();

animatorDelegate.registerDrawable(this);
setAlpha(255);
Expand Down Expand Up @@ -187,13 +188,9 @@ public void unscheduleDrawable(@NonNull Drawable who, @NonNull Runnable what) {
// ******************* Utility functions *******************

private boolean isSystemAnimatorDisabled() {
if (animatorDurationScaleProvider != null) {
float systemAnimatorDurationScale =
animatorDurationScaleProvider.getSystemAnimatorDurationScale(
context.getContentResolver());
return systemAnimatorDurationScale == 0;
}
return false;
float systemAnimatorDurationScale =
animatorDurationScaleProvider.getSystemAnimatorDurationScale(context.getContentResolver());
return systemAnimatorDurationScale == 0;
}

// ******************* Setter and getter *******************
Expand Down