File tree 1 file changed +7
-3
lines changed
lib/java/com/google/android/material/navigationrail
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -419,17 +419,21 @@ public WindowInsetsCompat onApplyWindowInsets(
419
419
@ NonNull WindowInsetsCompat insets ,
420
420
@ NonNull RelativePadding initialPadding ) {
421
421
// 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
423
423
Insets systemBarInsets = insets .getInsets (WindowInsetsCompat .Type .systemBars ());
424
+ Insets displayCutoutInsets = insets .getInsets (WindowInsetsCompat .Type .displayCutout ());
424
425
if (shouldApplyWindowInsetPadding (paddingTopSystemWindowInsets )) {
425
426
initialPadding .top += systemBarInsets .top ;
426
427
}
427
428
if (shouldApplyWindowInsetPadding (paddingBottomSystemWindowInsets )) {
428
429
initialPadding .bottom += systemBarInsets .bottom ;
429
430
}
430
431
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
+ }
433
437
}
434
438
initialPadding .applyToView (view );
435
439
return insets ;
You can’t perform that action at this time.
0 commit comments