File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
lib/java/com/google/android/material/navigationrail Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -419,17 +419,21 @@ public WindowInsetsCompat onApplyWindowInsets(
419419 @ NonNull WindowInsetsCompat insets ,
420420 @ NonNull RelativePadding initialPadding ) {
421421 // Apply the top, bottom, and start padding for a start edge aligned
422- // NavigationRailView to dodge the system status and navigation bars
422+ // NavigationRailView to dodge the system status/navigation bars and display cutouts
423423 Insets systemBarInsets = insets .getInsets (WindowInsetsCompat .Type .systemBars ());
424+ Insets displayCutoutInsets = insets .getInsets (WindowInsetsCompat .Type .displayCutout ());
424425 if (shouldApplyWindowInsetPadding (paddingTopSystemWindowInsets )) {
425426 initialPadding .top += systemBarInsets .top ;
426427 }
427428 if (shouldApplyWindowInsetPadding (paddingBottomSystemWindowInsets )) {
428429 initialPadding .bottom += systemBarInsets .bottom ;
429430 }
430431 if (shouldApplyWindowInsetPadding (paddingStartSystemWindowInsets )) {
431- initialPadding .start +=
432- ViewUtils .isLayoutRtl (view ) ? systemBarInsets .right : systemBarInsets .left ;
432+ if (ViewUtils .isLayoutRtl (view )) {
433+ initialPadding .start += max (systemBarInsets .right , displayCutoutInsets .right );
434+ } else {
435+ initialPadding .start += max (systemBarInsets .left , displayCutoutInsets .left );
436+ }
433437 }
434438 initialPadding .applyToView (view );
435439 return insets ;
You can’t perform that action at this time.
0 commit comments