Skip to content

Commit

Permalink
[BottomSheet] Fixed IME bottom padding is ignored in edge-to-edge case.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pekingme committed Feb 4, 2022
1 parent d66676f commit 6454b87
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -1494,7 +1494,8 @@ public WindowInsetsCompat onApplyWindowInsets(
int rightPadding = view.getPaddingRight();

if (paddingBottomSystemWindowInsets) {
insetBottom = systemBarInsets.bottom;
Insets imeInsets = insets.getInsets(WindowInsetsCompat.Type.ime());
insetBottom = systemBarInsets.bottom + imeInsets.bottom;
bottomPadding = initialPadding.bottom + insetBottom;
}

Expand Down

0 comments on commit 6454b87

Please sign in to comment.