Skip to content

Commit 7e9318e

Browse files
paulfthomaspekingme
authored andcommitted
[NTC][ProgressIndicator] Update documentation
PiperOrigin-RevId: 597032677
1 parent bb35129 commit 7e9318e

25 files changed

+49
-41
lines changed

docs/components/ProgressIndicator.md

Lines changed: 49 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ path: /catalog/progress-indicators/
1212
[Progress indicators](https://material.io/components/progress-indicators)
1313
express an unspecified wait time or display the length of a process.
1414

15-
![Animation of purple linear progress indicator beneath "My Recipes" top app bar](assets/progressindicator/indeterminate_hero.gif)
15+
![Animation of linear progress indicator beneath "Episodes" top app bar](assets/progressindicator/determinate_hero.gif)
1616

1717
**Contents**
1818

@@ -45,10 +45,6 @@ progress rather than the progress of each activity.
4545

4646
### Usage
4747

48-
![Animation of determinate linear and circular progress indicators: purple
49-
indicators fill up grey
50-
tracks](assets/progressindicator/determinate_composite.gif)
51-
5248
A determinate progress indicator can be added to a layout:
5349

5450
```xml
@@ -62,10 +58,6 @@ A determinate progress indicator can be added to a layout:
6258
android:layout_height="wrap_content" />
6359
```
6460

65-
![Animation of indeterminate linear and circular progress indicators: purple
66-
indicators travel along grey
67-
tracks](assets/progressindicator/indeterminate_composite.gif)
68-
6961
An indeterminate progress indicator can be added:
7062

7163
```xml
@@ -81,11 +73,13 @@ An indeterminate progress indicator can be added:
8173
android:indeterminate="true" />
8274
```
8375

84-
### Switching from indeterminate to determinate
76+
![Animation of determinate and indeterminate linear and circular progress indicators: red
77+
indicators travel along pink tracks](assets/progressindicator/linear_circular_composite.gif)
8578

86-
![Animation of linear and circular progress indicators: purple indicators travel
87-
along gray tracks then fill up
88-
tracks.](assets/progressindicator/switch_composite.gif)
79+
1. Determinate
80+
2. Indeterminate
81+
82+
### Switching from indeterminate to determinate
8983

9084
Indeterminate progress indicators can smoothly transit to determinate progress
9185
indicators by setting the `progress` programmatically:
@@ -131,6 +125,8 @@ The modes of behaviors are:
131125
edge and hides the view by collapsing to the baseline (bottom edge); for the
132126
circular type, shows the view by expanding from the outer edge and hides the
133127
view by collapsing to the inner edge.
128+
* `escape` - for the linear type, escapes in the progression direction; for the
129+
circular type, no effect.
134130

135131
When the hide animation behavior is not none, the visibility of the view will be
136132
changed after the animation finishes. Please use `setVisibilityAfterHide` method
@@ -139,9 +135,6 @@ to set the target visibility as `Visibility.INVISIBLE` (default) or
139135

140136
### Rounded corners
141137

142-
![Linear and circular progress indicators: tracks and indicators have rounded
143-
corners](assets/progressindicator/rounded_corner_composite.png)
144-
145138
Progress indicators can have rounded corners via `app:trackCornerRadius` or the
146139
`setTrackCornerRadius` method.
147140

@@ -155,7 +148,7 @@ Only one type should represent each kind of activity in an app. For example, if
155148
a refresh action displays a circular indicator on one screen, that same action
156149
shouldn’t use a linear indicator elsewhere in the app.
157150

158-
![Composite image of linear and circular progress indicator types](assets/progressindicator/types.gif)
151+
![Composite image of linear and circular progress indicator types](assets/progressindicator/types.png)
159152

160153
## Linear progress indicators
161154

@@ -181,7 +174,7 @@ The following example shows a determinate linear progress indicator.
181174

182175
![Determinate linear progress indicator animation: purple indicator fills up
183176
grey
184-
track](assets/progressindicator/linear_determinate_compact.gif){width="600"}
177+
track](assets/progressindicator/linear_determinate.gif){width="600"}
185178

186179
In the layout:
187180

@@ -195,7 +188,7 @@ The following example shows an indeterminate linear progress indicator.
195188

196189
![Indeterminate linear progress indicator animation: purple indicator travels
197190
along grey
198-
track](assets/progressindicator/linear_indeterminate_compact.gif){width="600"}
191+
track](assets/progressindicator/linear_indeterminate.gif){width="600"}
199192

200193
In the layout:
201194

@@ -211,17 +204,14 @@ In the layout:
211204
For linear progress indicator, there are two indeterminate animation types:
212205

213206
* `disjoint` - animates as repeated cycles with two disjoint segments in the
214-
same color at a time.
215-
216-
![Disjointed indeterminate linear progress indicator animation: red indicator
207+
same color at a time. ![Disjointed indeterminate linear progress indicator animation: red indicator
217208
travels along track 2x then switches to
218209
yellow](assets/progressindicator/linear_multicolor_disjoint.gif){width="600"}
219210

220211
* `contiguous` - animates as repeated cycles with three adjacent segments in
221212
different colors. ![Contiguous indeterminate linear progress indicator
222213
animation: red, yellow, blue indicators move sequentially and cover
223-
track](assets/progressindicator/linear_multicolor_contiguous.gif)
224-
{width="600"}
214+
track](assets/progressindicator/linear_multicolor_contiguous.gif){width="600"}
225215

226216
**Note:** There is a minimum requirement of 3 indicator colors to use the
227217
**contiguous** animation. Otherwise, an IllegalArgumentException will be thrown.
@@ -250,7 +240,7 @@ The following example shows a determinate circular progress indicator.
250240

251241
![Determinate circular progress indicator animation: purple indicator draws a
252242
circle clockwise from the
253-
top](assets/progressindicator/circular_determinate_compact.gif){width="600"}
243+
top](assets/progressindicator/circular_determinate.gif){width="600"}
254244

255245
In the layout:
256246

@@ -264,7 +254,7 @@ The following example shows an indeterminate circular progress indicator.
264254

265255
![Indeterminate circular progress indicator animation: purple indicator follows
266256
a circle clockwise from the
267-
top](assets/progressindicator/circular_indeterminate_compact.gif){width="600"}
257+
top](assets/progressindicator/circular_indeterminate.gif){width="600"}
268258

269259
In the layout:
270260

@@ -279,27 +269,28 @@ In the layout:
279269

280270
A progress indicator consists of a track and an indicator.
281271

282-
![Progress indicator anatomy composte](assets/progressindicator/anatomy.png)
272+
![Progress indicator anatomy composite](assets/progressindicator/anatomy.png)
283273

284-
1. Track
285-
2. Indicator
274+
1. Active indicator
275+
2. Track
276+
3. Stop indicator
286277

287278
#### Common attributes
288279

289280
The following attributes are shared between linear and circular progress
290281
indicators:
291282

292-
| Element | Attribute | Related method(s) | Default value |
293-
|-------------------------------|-----------------------------|-----------------------------------------------------------|-------------------------------------------------------------------------------------|
294-
| **Track thickness** | `app:trackThickness` | `setTrackThickness`</br>`getTrackThickness` | `4dp` |
295-
| **Indicator color** | `app:indicatorColor` | `setIndicatorColor`</br>`getIndicatorColor` | `colorPrimary` |
296-
| **Track color** | `app:trackColor` | `setTrackColor`</br>`getTrackColor` | `colorSurfaceContainerHighest` (linear)</br>`@android:color/transparent` (circular) |
297-
| **Track corner radius** | `app:trackCornerRadius` | `setTrackCornerRadius`</br>`getTrackCornerRadius` | `0dp` |
298-
| **Indicator track gap size** | `app:indicatorTrackGapSize` | `setIndicatorTrackGapSize`</br>`getIndicatorTrackGapSize` | `4dp` |
299-
| **Show animation behavior** | `app:showAnimationBehavior` | `setShowAnimationBehavior`</br>`getShowAnimationBehavior` | `none` |
300-
| **Hide animation behavior** | `app:hideAnimationBehavior` | `setHideAnimationBehavior`</br>`getHideAnimationBehavior` | `none` |
301-
| **Delay (in ms) to show** | `app:showDelay` | N/A | 0 |
302-
| **Min delay (in ms) to hide** | `app:minHideDelay` | N/A | 0 |
283+
| Element | Attribute | Related method(s) | Default value |
284+
|-------------------------------|-----------------------------|-----------------------------------------------------------|------------------------------------------------------------------------------|
285+
| **Track thickness** | `app:trackThickness` | `setTrackThickness`</br>`getTrackThickness` | `4dp` |
286+
| **Indicator color** | `app:indicatorColor` | `setIndicatorColor`</br>`getIndicatorColor` | `colorPrimary` |
287+
| **Track color** | `app:trackColor` | `setTrackColor`</br>`getTrackColor` | `colorPrimaryContainer` (linear)</br>`@android:color/transparent` (circular) |
288+
| **Track corner radius** | `app:trackCornerRadius` | `setTrackCornerRadius`</br>`getTrackCornerRadius` | `2dp` |
289+
| **Indicator track gap size** | `app:indicatorTrackGapSize` | `setIndicatorTrackGapSize`</br>`getIndicatorTrackGapSize` | `4dp` |
290+
| **Show animation behavior** | `app:showAnimationBehavior` | `setShowAnimationBehavior`</br>`getShowAnimationBehavior` | `none` |
291+
| **Hide animation behavior** | `app:hideAnimationBehavior` | `setHideAnimationBehavior`</br>`getHideAnimationBehavior` | `none` |
292+
| **Delay (in ms) to show** | `app:showDelay` | N/A | 0 |
293+
| **Min delay (in ms) to hide** | `app:minHideDelay` | N/A | 0 |
303294

304295
#### Linear type specific attributes
305296

@@ -340,6 +331,23 @@ See the full list of
340331
and
341332
[attributes](https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/progressindicator/res/values/attrs.xml).
342333

334+
#### Non-Text Contrast update
335+
336+
In order to comply with the latest accessibility requirements, the
337+
`LinearProgressIndicator` and `CircularProgressIndicator` have been updated with
338+
additional attributes:
339+
340+
- `app:indicatorTrackGapSize`: size of the gap between the indicator and the
341+
track, 4dp by default.
342+
- `app:trackStopIndicatorSize`: size of the stop at the end of the track, 4dp by
343+
default. Only applies to the linear determinate configuration.
344+
345+
`*.Legacy` styles have been added to revert to the previous behavior (**not
346+
recommended**):
347+
348+
- `Widget.Material3.LinearProgressIndicator.Legacy`
349+
- `Widget.Material3.CircularProgressIndicator.Legacy`
350+
343351
## Theming
344352

345353
Progress indicators support Material theming which can customize color and size.
@@ -382,7 +390,7 @@ all circular progress indicators but does not affect other components:
382390
<item name="circularProgressIndicatorStyle">@style/Widget.App.CircularProgressIndicator</item>
383391
</style>
384392

385-
<style name="Widget.App.CircularProgressIndicator" parent="Widget.Material3.CircularProgressIndicator">
393+
<style name="Widget.App.CircularProgressIndicator" parent="Widget.Material3.CircularProgressIndicator.Legacy">
386394
<item name="materialThemeOverlay">@style/ThemeOverlay.App.CircularProgressIndicator</item>
387395
<item name="trackThickness">20dp</item>
388396
</style>
-2.71 KB
Loading
52.4 KB
Loading
Binary file not shown.
83 KB
Loading
Binary file not shown.
-103 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
218 KB
Loading

0 commit comments

Comments
 (0)