Skip to content

Commit 21a7aff

Browse files
imhappipaulfthomas
authored andcommitted
[AppBarLayout] Fix bug in AppBarLayout that refreshes all its children's drawables instead of just its own
Resolves #3233 PiperOrigin-RevId: 512678371
1 parent d8c01c1 commit 21a7aff

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/java/com/google/android/material/appbar/AppBarLayout.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2214,7 +2214,15 @@ private void updateAppBarLayoutDrawableState(
22142214
if (forceJump || (changed && shouldJumpElevationState(parent, layout))) {
22152215
// If the collapsed state changed, we may need to
22162216
// jump to the current state if we have an overlapping view
2217-
layout.jumpDrawablesToCurrentState();
2217+
if (layout.getBackground() != null) {
2218+
layout.getBackground().jumpToCurrentState();
2219+
}
2220+
if (VERSION.SDK_INT >= VERSION_CODES.M && layout.getForeground() != null) {
2221+
layout.getForeground().jumpToCurrentState();
2222+
}
2223+
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP && layout.getStateListAnimator() != null) {
2224+
layout.getStateListAnimator().jumpToCurrentState();
2225+
}
22182226
}
22192227
}
22202228

0 commit comments

Comments
 (0)