Skip to content

Commit ea9cce8

Browse files
pekingmedsn5ft
authored andcommitted
[ProgressIndicator] Fixed incorrect visibility change when the component's parent is not visible.
PiperOrigin-RevId: 322771684
1 parent 5229b3f commit ea9cce8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ protected void onAttachedToWindow() {
350350
protected void onDetachedFromWindow() {
351351
// Removes the delayedHide runnable from the queue if it has been scheduled.
352352
removeCallbacks(delayedHide);
353-
getCurrentDrawable().setVisible(/*visible=*/ false, /*restart=*/ false);
353+
getCurrentDrawable().hideNow();
354354
unregisterAnimationCallbacks();
355355
super.onDetachedFromWindow();
356356
}
@@ -1005,9 +1005,9 @@ public void onAnimationEnd(Drawable drawable) {
10051005
@Override
10061006
public void onAnimationEnd(Drawable drawable) {
10071007
super.onAnimationEnd(drawable);
1008-
if (!isIndeterminateModeChangeRequested) {
1008+
if (!isIndeterminateModeChangeRequested && visibleToUser()) {
10091009
// Don't hide the component if under transition from indeterminate mode to
1010-
// determinate mode.
1010+
// determinate mode or the component is current not visible to users.
10111011
setVisibility(INVISIBLE);
10121012
}
10131013
}

0 commit comments

Comments
 (0)