Skip to content

Commit b1ef02a

Browse files
pekingmewcshi
authored andcommitted
[ProgressIndicator] Cleaned up deprecated class and resources.
PiperOrigin-RevId: 342076767
1 parent c76665b commit b1ef02a

File tree

14 files changed

+38
-341
lines changed

14 files changed

+38
-341
lines changed

catalog/java/io/material/catalog/progressindicator/ProgressIndicatorMainDemoFragment.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727
import androidx.annotation.Nullable;
2828
import com.google.android.material.progressindicator.CircularProgressIndicator;
2929
import com.google.android.material.progressindicator.LinearProgressIndicator;
30-
import com.google.android.material.progressindicator.ProgressIndicator;
3130
import io.material.catalog.feature.DemoFragment;
3231

33-
/** This is the fragment to briefly demo different types of {@link ProgressIndicator}. */
32+
/**
33+
* This is the fragment to demo simple use cases of {@link LinearProgressIndicator} and {@link
34+
* CircularProgressIndicator}.
35+
*/
3436
public class ProgressIndicatorMainDemoFragment extends DemoFragment {
3537
@Override
3638
@NonNull

docs/components/ProgressIndicator.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Progress Indicator
22

3-
<!-- TODO(b/169262619) Update API and style for sub-type progress indicator classes. -->
4-
53
Note: Due to an internal change of API, `ProgressIndicator` has been deprecated.
64
It will be removed in the near future after the internal migration process.
75

lib/java/com/google/android/material/progressindicator/BaseProgressIndicator.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@
4343
import java.util.Arrays;
4444

4545
/**
46-
* This class contains the common functions shared between ProgressIndicator in different types.
47-
* This is an abstract class which is meant for directly use.
46+
* This class contains the common functions shared in different types of progress indicators. This
47+
* is an abstract class which is meant for directly use.
4848
*
4949
* <p>With the default style {@link R.style#Widget_MaterialComponents_ProgressIndicator}, 4dp
5050
* indicator/track size and no animation is used for visibility change. Without customization,
5151
* primaryColor will be used as the indicator color; the indicator color applying disabledAlpha will
52-
* be used as the track color. The following attributes can be used to customize the
53-
* ProgressIndicator's appearance:
52+
* be used as the track color. The following attributes can be used to customize the progress
53+
* indicator's appearance:
5454
*
5555
* <ul>
5656
* <li>{@code indicatorSize}: the stroke width of the indicator and track.
@@ -93,9 +93,8 @@ public class BaseProgressIndicator extends ProgressBar {
9393

9494
/**
9595
* The minimum time, in milliseconds, that the requested hide action will wait to start once
96-
* {@link ProgressIndicator#show()} is called. If set to zero or negative values, the requested
97-
* hide action will start as soon as {@link ProgressIndicator#hide()} is called. This value is
98-
* capped to {@link #MAX_HIDE_DELAY}.
96+
* {@link #show()} is called. If set to zero or negative values, the requested hide action will
97+
* start as soon as {@link #hide()} is called. This value is capped to {@link #MAX_HIDE_DELAY}.
9998
*
10099
* @see #showDelay
101100
*/
@@ -258,7 +257,7 @@ protected void onWindowVisibilityChanged(int visibility) {
258257
}
259258

260259
/**
261-
* If it changes to visible, the start animation will be started if {@code growMode} indicates
260+
* If it changes to visible, the start animation will be started if {@code showBehavior} indicates
262261
* any. If it changes to invisible, hides the drawable immediately.
263262
*
264263
* @param animationDesired Whether to change the visibility with animation.
@@ -513,7 +512,7 @@ public synchronized void setIndeterminate(boolean indeterminate) {
513512
*
514513
* @see #setIndicatorSize(int)
515514
* @attr ref
516-
* com.google.android.material.progressindicator.R.stylable#ProgressIndicator_indicatorSize
515+
* com.google.android.material.progressindicator.R.stylable#BaseProgressIndicator_indicatorSize
517516
*/
518517
@Px
519518
public int getIndicatorSize() {
@@ -526,7 +525,7 @@ public int getIndicatorSize() {
526525
* @param indicatorSize The new indicator size in pixel.
527526
* @see #getIndicatorSize()
528527
* @attr ref
529-
* com.google.android.material.progressindicator.R.stylable#ProgressIndicator_indicatorSize
528+
* com.google.android.material.progressindicator.R.stylable#BaseProgressIndicator_indicatorSize
530529
*/
531530
public void setIndicatorSize(@Px int indicatorSize) {
532531
if (baseSpec.indicatorSize != indicatorSize) {
@@ -540,7 +539,7 @@ public void setIndicatorSize(@Px int indicatorSize) {
540539
*
541540
* @see #setIndicatorColor(int...)
542541
* @attr ref
543-
* com.google.android.material.progressindicator.R.stylable#ProgressIndicator_indicatorColor
542+
* com.google.android.material.progressindicator.R.stylable#BaseProgressIndicator_indicatorColor
544543
*/
545544
@NonNull
546545
public int[] getIndicatorColor() {
@@ -553,7 +552,7 @@ public int[] getIndicatorColor() {
553552
* @param indicatorColors The new colors used in indicator.
554553
* @see #getIndicatorColor()
555554
* @attr ref
556-
* com.google.android.material.progressindicator.R.stylable#ProgressIndicator_indicatorColor
555+
* com.google.android.material.progressindicator.R.stylable#BaseProgressIndicator_indicatorColor
557556
*/
558557
public void setIndicatorColor(@ColorInt int... indicatorColors) {
559558
if (indicatorColors.length == 0) {
@@ -571,7 +570,8 @@ public void setIndicatorColor(@ColorInt int... indicatorColors) {
571570
* Returns the color used in the track of this progress indicator.
572571
*
573572
* @see #setTrackColor(int)
574-
* @attr ref com.google.android.material.progressindicator.R.stylable#ProgressIndicator_trackColor
573+
* @attr ref
574+
* com.google.android.material.progressindicator.R.stylable#BaseProgressIndicator_trackColor
575575
*/
576576
@ColorInt
577577
public int getTrackColor() {
@@ -583,7 +583,8 @@ public int getTrackColor() {
583583
*
584584
* @param trackColor The new color used in the track of this progress indicator.
585585
* @see #getTrackColor()
586-
* @attr ref com.google.android.material.progressindicator.R.stylable#ProgressIndicator_trackColor
586+
* @attr ref
587+
* com.google.android.material.progressindicator.R.stylable#BaseProgressIndicator_trackColor
587588
*/
588589
public void setTrackColor(@ColorInt int trackColor) {
589590
if (baseSpec.trackColor != trackColor) {
@@ -597,7 +598,7 @@ public void setTrackColor(@ColorInt int trackColor) {
597598
*
598599
* @see #setIndicatorCornerRadius(int)
599600
* @attr ref
600-
* com.google.android.material.progressindicator.R.stylable#ProgressIndicator_indicatorCornerRadius
601+
* com.google.android.material.progressindicator.R.stylable#BaseProgressIndicator_indicatorCornerRadius
601602
*/
602603
@Px
603604
public int getIndicatorCornerRadius() {
@@ -610,7 +611,7 @@ public int getIndicatorCornerRadius() {
610611
* @param indicatorCornerRadius The new corner radius in pixels.
611612
* @see #getIndicatorCornerRadius()
612613
* @attr ref
613-
* com.google.android.material.progressindicator.R.stylable#ProgressIndicator_indicatorCornerRadius
614+
* com.google.android.material.progressindicator.R.stylable#BaseProgressIndicator_indicatorCornerRadius
614615
*/
615616
public void setIndicatorCornerRadius(@Px int indicatorCornerRadius) {
616617
if (baseSpec.indicatorCornerRadius != indicatorCornerRadius) {

lib/java/com/google/android/material/progressindicator/CircularDrawingDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import androidx.annotation.NonNull;
2626
import com.google.android.material.color.MaterialColors;
2727

28-
/** A delegate class to help draw the graphics for {@link ProgressIndicator} in circular types. */
28+
/** A delegate class to help draw the graphics for {@link CircularProgressIndicator}. */
2929
public final class CircularDrawingDelegate extends DrawingDelegate {
3030

3131
private final CircularProgressIndicatorSpec spec;

lib/java/com/google/android/material/progressindicator/CircularProgressIndicator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public int getIndicatorInset() {
137137
* @param indicatorInset The new inset in pixels.
138138
* @see #getIndicatorInset()
139139
* @attr ref
140-
* com.google.android.material.progressindicator.R.stylable#ProgressIndicator_circularInset
140+
* com.google.android.material.progressindicator.R.stylable#CircularProgressIndicator_indicatorInset
141141
*/
142142
public void setIndicatorInset(@Px int indicatorInset) {
143143
if (spec.indicatorInset != indicatorInset) {
@@ -151,7 +151,7 @@ public void setIndicatorInset(@Px int indicatorInset) {
151151
*
152152
* @see #setIndicatorRadius(int)
153153
* @attr ref
154-
* com.google.android.material.progressindicator.R.stylable#ProgressIndicator_circularRadius
154+
* com.google.android.material.progressindicator.R.stylable#CircularProgressIndicator_indicatorRadius
155155
*/
156156
@Px
157157
public int getIndicatorrRadius() {
@@ -164,7 +164,7 @@ public int getIndicatorrRadius() {
164164
* @param indicatorRadius The new radius in pixels.
165165
* @see #getIndicatorrRadius()
166166
* @attr ref
167-
* com.google.android.material.progressindicator.R.stylable#ProgressIndicator_circularRadius
167+
* com.google.android.material.progressindicator.R.stylable#CircularProgressIndicator_indicatorRadius
168168
* @throws IllegalArgumentException if new indicator radius is less than half of the indicator
169169
* size.
170170
*/

lib/java/com/google/android/material/progressindicator/CircularProgressIndicatorSpec.java

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import com.google.android.material.progressindicator.CircularProgressIndicator.HideBehavior;
3131
import com.google.android.material.progressindicator.CircularProgressIndicator.IndicatorDirection;
3232
import com.google.android.material.progressindicator.CircularProgressIndicator.ShowBehavior;
33-
import com.google.android.material.progressindicator.ProgressIndicator.GrowMode;
3433

3534
/**
3635
* This class contains the parameters for drawing a circular type progress indicator. The parameters
@@ -56,21 +55,6 @@ public class CircularProgressIndicatorSpec implements AnimatedVisibilityChangeBe
5655
/** The animation direction to hide the indicator and track. */
5756
@HideBehavior public int hideBehavior;
5857

59-
public CircularProgressIndicatorSpec(@NonNull ProgressIndicatorSpec progressIndicatorSpec) {
60-
// TODO(b/169262029) Remove this constructor once ProgressIndicator is removed.
61-
if (progressIndicatorSpec.indicatorType != ProgressIndicator.CIRCULAR) {
62-
throw new IllegalArgumentException(
63-
"Only CIRCULAR type ProgressIndicatorSpec can be converted into"
64-
+ " CircularProgressIndicatorSpec.");
65-
}
66-
baseSpec = progressIndicatorSpec.getBaseSpec();
67-
indicatorRadius = progressIndicatorSpec.circularRadius;
68-
indicatorInset = progressIndicatorSpec.circularInset;
69-
indicatorDirection = getIndicatorDirectionFromInverse(progressIndicatorSpec.inverse);
70-
showBehavior = getShowBehaviorFromGrowMode(progressIndicatorSpec.growMode);
71-
hideBehavior = getHideBehaviorFromGrowMode(progressIndicatorSpec.growMode);
72-
}
73-
7458
/**
7559
* Instantiates CircularProgressIndicatorSpec.
7660
*
@@ -79,8 +63,8 @@ public CircularProgressIndicatorSpec(@NonNull ProgressIndicatorSpec progressIndi
7963
* loaded. Attributes defined in {@link R.styleable#BaseProgressIndicator} will be loaded by
8064
* {@link BaseProgressIndicatorSpec#BaseProgressIndicatorSpec(Context, AttributeSet, int)}.
8165
*
82-
* <p>If there's an existing {@link BaseProgressIndicatorSpec}, please use
83-
* {@link #CircularProgressIndicatorSpec(Context, AttributeSet, BaseProgressIndicatorSpec)}.
66+
* <p>If there's an existing {@link BaseProgressIndicatorSpec}, please use {@link
67+
* #CircularProgressIndicatorSpec(Context, AttributeSet, BaseProgressIndicatorSpec)}.
8468
*
8569
* @param context Current themed context.
8670
* @param attrs Component's attributes set.
@@ -168,40 +152,4 @@ public boolean shouldAnimateToHide() {
168152
public BaseProgressIndicatorSpec getBaseSpec() {
169153
return baseSpec;
170154
}
171-
172-
// **************** Temporary methods ****************
173-
174-
// TODO(b/169262029) Remove once ProgressIndicator is removed.
175-
@IndicatorDirection
176-
protected static int getIndicatorDirectionFromInverse(boolean inverse) {
177-
return inverse
178-
? CircularProgressIndicator.INDICATOR_DIRECTION_COUNTERCLOCKWISE
179-
: CircularProgressIndicator.INDICATOR_DIRECTION_CLOCKWISE;
180-
}
181-
182-
// TODO(b/169262029) Remove once ProgressIndicator is removed.
183-
@ShowBehavior
184-
protected static int getShowBehaviorFromGrowMode(@GrowMode int growMode) {
185-
switch (growMode) {
186-
case ProgressIndicator.GROW_MODE_INCOMING:
187-
return CircularProgressIndicator.SHOW_INWARD;
188-
case ProgressIndicator.GROW_MODE_OUTGOING:
189-
return CircularProgressIndicator.SHOW_OUTWARD;
190-
default:
191-
return CircularProgressIndicator.SHOW_NONE;
192-
}
193-
}
194-
195-
// TODO(b/169262029) Remove once ProgressIndicator is removed.
196-
@HideBehavior
197-
protected static int getHideBehaviorFromGrowMode(@GrowMode int growMode) {
198-
switch (growMode) {
199-
case ProgressIndicator.GROW_MODE_INCOMING:
200-
return CircularProgressIndicator.HIDE_OUTWARD;
201-
case ProgressIndicator.GROW_MODE_OUTGOING:
202-
return CircularProgressIndicator.HIDE_INWARD;
203-
default:
204-
return CircularProgressIndicator.HIDE_NONE;
205-
}
206-
}
207155
}

lib/java/com/google/android/material/progressindicator/DeterminateDrawable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void setLevelByFraction(float fraction) {
9393
* spring animation for changing progress.
9494
* @param animationDesired Whether to change the visibility with animation. The spring animation
9595
* for changing progress only depends on system animator duration scale. Use {@link
96-
* ProgressIndicator#setProgress(int, boolean)} to change the progress without animation.
96+
* BaseProgressIndicator#setProgress(int, boolean)} to change the progress without animation.
9797
* @return {@code true}, if the visibility changes or will change after the animation; {@code
9898
* false}, otherwise.
9999
*/

lib/java/com/google/android/material/progressindicator/DrawingDelegate.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222
import androidx.annotation.FloatRange;
2323
import androidx.annotation.NonNull;
2424

25-
/**
26-
* A delegate abstract class for drawing the graphics in different drawable classes used in {@link
27-
* ProgressIndicator}.
28-
*/
25+
/** A delegate abstract class for drawing the graphics in different drawable classes. */
2926
abstract class DrawingDelegate {
3027

3128
protected DrawableWithAnimatedVisibilityChange drawable;

lib/java/com/google/android/material/progressindicator/IndeterminateAnimatorDelegate.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@
2121
import androidx.annotation.NonNull;
2222
import androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback;
2323

24-
/**
25-
* A delegate abstract class for animating properties used in drawing the graphics in different
26-
* drawable classes for {@link ProgressIndicator}.
27-
*/
24+
/** A delegate abstract class for animating properties used in drawing the graphics. */
2825
abstract class IndeterminateAnimatorDelegate<T extends Animator> {
2926

3027
// The drawable associated with this delegate.
@@ -73,8 +70,8 @@ protected void registerDrawable(@NonNull IndeterminateDrawable drawable) {
7370

7471
/**
7572
* Invalidates the spec values used by the animator delegate. When the spec values are changed in
76-
* {@link ProgressIndicator}, values assigned to animators or segments don't get updated until
77-
* they are explicitly reset. Call this to apply the changes immediately.
73+
* indicator class, values assigned to animators or segments don't get updated until they are
74+
* explicitly reset. Call this to apply the changes immediately.
7875
*/
7976
public abstract void invalidateSpecValues();
8077

lib/java/com/google/android/material/progressindicator/LinearDrawingDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import androidx.annotation.NonNull;
2828
import com.google.android.material.color.MaterialColors;
2929

30-
/** A delegate class to help draw the graphics for {@link ProgressIndicator} in linear types. */
30+
/** A delegate class to help draw the graphics for {@link LinearProgressIndicator}. */
3131
final class LinearDrawingDelegate extends DrawingDelegate {
3232

3333
private final LinearProgressIndicatorSpec spec;

0 commit comments

Comments
 (0)