-
Notifications
You must be signed in to change notification settings - Fork 335
Add edge-to-edge support for the splash screen #558
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
Conversation
Splash screen uses deprecated APIs for setting status bar and navigation bar colors. This PR updates splash screen to use window insets and draw behind the system bars.
androidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/Utils.java
Show resolved
Hide resolved
...rc/main/java/com/google/androidbrowserhelper/trusted/splashscreens/EdgeToEdgeController.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/google/androidbrowserhelper/trusted/splashscreens/EdgeToEdgeController.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/google/androidbrowserhelper/trusted/splashscreens/EdgeToEdgeController.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/google/androidbrowserhelper/trusted/splashscreens/EdgeToEdgeController.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/google/androidbrowserhelper/trusted/splashscreens/EdgeToEdgeController.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/google/androidbrowserhelper/trusted/splashscreens/EdgeToEdgeController.java
Outdated
Show resolved
Hide resolved
...oidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/LauncherActivity.java
Outdated
Show resolved
Hide resolved
androidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/Utils.java
Show resolved
Hide resolved
androidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/Utils.java
Show resolved
Hide resolved
...rc/main/java/com/google/androidbrowserhelper/trusted/splashscreens/EdgeToEdgeController.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/google/androidbrowserhelper/trusted/splashscreens/EdgeToEdgeController.java
Outdated
Show resolved
Hide resolved
...oidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/LauncherActivity.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/google/androidbrowserhelper/trusted/splashscreens/EdgeToEdgeController.java
Outdated
Show resolved
Hide resolved
androidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/Utils.java
Show resolved
Hide resolved
...rc/main/java/com/google/androidbrowserhelper/trusted/splashscreens/EdgeToEdgeController.java
Outdated
Show resolved
Hide resolved
| ImmutableList.of(statusBarProtection, navigationBarProtection)); | ||
| rootView.addView(protectionLayout); | ||
| protectionLayout.setVisibility(View.VISIBLE); | ||
| protectionLayout.setElevation(1f); |
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.
Why is it needed?
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 splash screen ImageView is added later to this FrameLayout and it draws views by recency, unless we set z-index manually
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.
Removed manual elevation setting
| super.onCreate(savedInstanceState); | ||
|
|
||
| WindowCompat.enableEdgeToEdge(getWindow()); | ||
| getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); |
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 think it's better to move this to splash coordinator, otherwise we have a chance of getting obscured status bar icons.
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.
As we discussed offline, status bar icons are not getting obscured
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.
With a fresh look, let's move it to the splash controller and apply when we definitely set a color to system bars.
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 that case the bug that we have now with the behavior without the splash screen will not be fixed.
Right now the transparent activity without splash screen shows black system bars, instead of being transparent. Setting this flag fixes it.
|
@gstepniewski-google can you PTAL too? |
| super.onCreate(savedInstanceState); | ||
|
|
||
| WindowCompat.enableEdgeToEdge(getWindow()); | ||
| getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); |
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.
With a fresh look, let's move it to the splash controller and apply when we definitely set a color to system bars.
...rc/main/java/com/google/androidbrowserhelper/trusted/splashscreens/EdgeToEdgeController.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/google/androidbrowserhelper/trusted/splashscreens/EdgeToEdgeController.java
Show resolved
Hide resolved
...rc/main/java/com/google/androidbrowserhelper/trusted/splashscreens/EdgeToEdgeController.java
Show resolved
Hide resolved
...rc/main/java/com/google/androidbrowserhelper/trusted/splashscreens/EdgeToEdgeController.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/google/androidbrowserhelper/trusted/splashscreens/EdgeToEdgeController.java
Show resolved
Hide resolved
gstepniewski-google
left a comment
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.
Thanks, LGTM!
Splash screen uses deprecated APIs for setting status bar and navigation bar colors. This PR updates splash screen to use window insets and draw behind the system bars.