Skip to content

Commit 6454b87

Browse files
committed
[BottomSheet] Fixed IME bottom padding is ignored in edge-to-edge case.
The regression on BottomSheet was introduced in 1.6.0-alpha01. Before this version, the bottom padding in edge-to-edge mode is calculated by getSystemWindowInsetBottom(). https://developer.android.com/reference/android/view/WindowInsets#getSystemWindowInsetBottom() This is deprecated in newer APIs. According to deprecation message, the replacement is to use getInsets(int) with Type#systemBars(). But this is not completely true, because it doesn't contain IME insets. https://developer.android.com/reference/android/view/WindowInsets.Type#systemBars() Resolves: #2543 PiperOrigin-RevId: 426304311
1 parent d66676f commit 6454b87

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,8 @@ public WindowInsetsCompat onApplyWindowInsets(
14941494
int rightPadding = view.getPaddingRight();
14951495

14961496
if (paddingBottomSystemWindowInsets) {
1497-
insetBottom = systemBarInsets.bottom;
1497+
Insets imeInsets = insets.getInsets(WindowInsetsCompat.Type.ime());
1498+
insetBottom = systemBarInsets.bottom + imeInsets.bottom;
14981499
bottomPadding = initialPadding.bottom + insetBottom;
14991500
}
15001501

0 commit comments

Comments
 (0)