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
Owl is laid out edge-to-edge in 2 & 3-button navigation mode #1265
Closed
Closed
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8939c31
Owl is laid out edge-to-edge in 2 & 3-button navigation mode
manabu-nakamura 445f89a
Owl is laid out edge-to-edge in 2 & 3-button navigation mode
manabu-nakamura be6d66a
Owl is laid out edge-to-edge in 2 & 3-button navigation mode
manabu-nakamura 7b2e232
Owl is laid out edge-to-edge in 2 & 3-button navigation mode
manabu-nakamura 809309f
Owl is laid out edge-to-edge in 2 & 3-button navigation mode
manabu-nakamura 13546f6
Owl is laid out edge-to-edge in 2 & 3-button navigation mode
manabu-nakamura c9fbab9
Owl is laid out edge-to-edge in 2 & 3-button navigation mode
manabu-nakamura a1e7c59
Owl is laid out edge-to-edge in 2 & 3-button navigation mode
manabu-nakamura File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets the inset and return it without doing anything. It seems to me that it doesn't do what the before/after screenshots do.
Is the PR missing some commits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it isn't.
The MDC Catalog app does the same thing for edge-to-edge layout.
https://github.com/material-components/material-components-android/blob/master/catalog/java/io/material/catalog/windowpreferences/WindowPreferencesManager.java#L80-L81
https://github.com/material-components/material-components-android/blob/master/catalog/java/io/material/catalog/windowpreferences/WindowPreferencesManager.java#L41-L46
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The listener in that code is doing a lot.
https://github.com/material-components/material-components-android/blob/dd8f6bebdd45c2875fab6574376a604a7d40061a/catalog/java/io/material/catalog/windowpreferences/WindowPreferencesManager.java#L42
This code only returns the passed parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In portrait orientation, the listener in MDC Catalog app only returns the passed parameter, too. This causes that it is drawn behind the system navigation bar in 2 & 3-button navigation mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, so this is for disabling the contrast enforcement for the 3-button navbar. That is a side effect of preventing the original
onApplyWindowInsets
of thedecorView
.https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/com/android/internal/policy/DecorView.java;l=1030
The problem is that it also prevents other things done in that method. For example,
R.color.immersive_sys_ui
set above won't be used.If you want the 3-button nav to be transparent, you should use the
navigationBarStyle
parameter inenableEdgeToEdge
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. But, I don't understand that window.isNavigationBarContrastEnforced = false when navigationBarStyle = SystemBarStyle.dark() or SystemBarStyle.light().
Does this PR still need fixing?
P.S.
Should we use the navigationBarStyle parameter in enableEdgeToEdge instead of ViewCompat.setOnApplyWindowInsetsListener() inside other apps (Jetchat, Jetsnack, and Reply)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SystemBarStyle.auto
sets up with the recommended style (transparent gesture nav and translucent 3-button nav). The color parameters are for backward compatibility, and not suitable for color customization.If you really want the bar to be transparent on 3-button nav, then you can use either
SystemBarStyle.light
orSystemBarStyle.dark
. This app seems to change the background between the light/dark modes, so you need to call the right one based on the mode. I would leave thisenableEdgeToEdge
as is, and add a second call inThemes.kt
because the modeisDarkMode
is available there.I don't recommend using
ViewCompat.setOnApplyWindowInsetsListener
for suppressing the DecorView's default behavior.And the same goes for all the other PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I tried writing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a1e7c59:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this implementation redundant?
P.S.
It would be nice to have a function to select SystemBarStyle.dark() or SystemBarStyle.light().
This can be executed in Java:
This can't be executed in Kotlin: