-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[NavigationRailView] Start insets only use the system bars instead of the system bar and display cutout insets #3990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There's been an unresolved bug since version 1.10.0 Details: material-components/material-components-android#3990
There's been an unresolved bug since version 1.10.0 Details: material-components/material-components-android#3990
@drchen @manabu-nakamura Please fix this. Thank you very much :) |
Sorry, I can't understand this issue. |
See here: |
I don't know whether NavigationRailView itself have to dodge the display cutout or not. Tell me some documentation. Test10.zip |
#4006 ([Catalog] window overlaps with cutout area in landscape mode) was committed 1 year ago... |
Thank you. But it's not clear from just looking at this screenshot whether the NavigationRailView itself automatically have to dodge the display cutout or not. https://developer.android.com/develop/ui/views/layout/display-cutout#best-practices:
We (app developers) may need to manually dodge the display cutout if necessary... |
Thats' right but if we want to handle it by ourself we need to do it like this:
and then:
But why should we do it like this if a fix of the wrong values see here: is enough? |
How about this? ViewCompat.setOnApplyWindowInsetsListener(getWindow().getDecorView(), (v, insets) -> {
Insets cutout = insets.getInsets(WindowInsetsCompat.Type.displayCutout());
v.setPadding(cutout.left, 0, cutout.right, 0);
return insets;
}); https://github.com/material-components/material-components-android/commits/master/lib/java/com/google/android/material/navigationrail/NavigationRailView.java: |
if I may add my very humble opinion... (and please correct me if you think I'm wrong!) The main issue is that the component handles the system-bars, but does not handle the cutouts (or gesture) insets. Fundamentally the component should handle all if fitsSystemWindows==true, and none if fitsSystemWindows=false. As you already handle systembars, then in-the-name-of backwards compatibility, you should also handle cutouts/gestures (fitsSystemWindows==true)... or give users the option to handle them themselves ( fitsSystemWindows=false) Personally I gave up, and either use fitsSystemWindows=false + handle insets myself; and don't use partially broken components at all. |
Thats correct. Not only cutout area but also systembars. Then it is working fine. |
Just got caught up on the discussion here. I see that I failed to properly communicate the original issue and I've updated titles/descriptions to make things more clear. My main issue was that you used to be able to use Also, sorry for the error on my PR that allowed the rail to go "under" the navigation bar. I've updated it to align with the previous behavior while avoiding those deprecated methods (Ex: |
Hi all, sorry catching up on the discussion here as well. Is the issue then that the cutout display doesn't add extra padding to the nav rail, so that the cutout is overlaid on top of the content? If so, then this PR #3991 looks good to me. I'll push it through this week |
Correct. The missing padding is the bug. |
Thank you for your explanation, @imhappi. I understand the spec. |
Description: The navigation rail applies start insets only based on the system bars. This results in the rail appearing behind display cutouts. This component used to change its start insets based on the system bars and the display cutout.
Expected behavior: Apply start insets based on the system bars and display cutout
Source code:
material-components-android/lib/java/com/google/android/material/navigationrail/NavigationRailView.java
Line 216 in a2309ce
Minimal sample app repro:
https://github.com/t895/yuzu/tree/material-updateAndroid API version: API 34
Material Library version: 1.10.0+ The bug was introduced with this commit
Device: Samsung Galaxy S21 and Google Pixel 7 both running their latest stable software updates as of 1/11/24
The text was updated successfully, but these errors were encountered: