Status Update
Comments
jb...@google.com <jb...@google.com>
ya...@google.com <ya...@google.com> #2
ya...@google.com <ya...@google.com> #4
ya...@google.com <ya...@google.com> #6
I see, so it has in-app light/dark setting.
On API 31+, apps with custom in-app light/dark settings should call UiModeManager.setApplicationNightMode
enableEdgeToEdge
as well.
On API <31, it's easy if you can use AppCompatDelegate.setDefaultNightMode(int)
So, custom mode is useful for apps that:
- Provide in-app light/dark mode settings on API <31.
- Don't want to depend on appcompat
I'm not sure if it's super common, but I guess the feature is worth implementing. I'll put it during the next alpha phase.
For Now in Android, I recommend you still call setApplicationNightMode
on API 31+ regardless of enableEdgeToEdge
. On API <31, just for the time being, you can either use the current e2e implementation, hide the setting, depend on appcompat, or just bear with the minor UI glitch. None of these are great, but I don't have a good solution now.
ap...@google.com <ap...@google.com> #7
Branch: androidx-main
commit 27e7d52e8604a080133e8b842db10c89b4482598
Author: Yuichi Araki <yaraki@google.com>
Date: Wed Apr 19 12:56:59 2023
Add SystemBarStyle.custom
Relnote: "Add an optional parameter `detectDarkMode` to SystemBarStyle.auto for detecting night mode by custom logic"
Test: androidx.activity.EdgeToEdgeTest.enableCustom
Bug: 278263793
Change-Id: I78322867ba3940939e137479383eca08efc9a2b6
M activity/activity/api/current.txt
M activity/activity/api/restricted_current.txt
M activity/activity/src/androidTest/java/androidx/activity/EdgeToEdgeTest.kt
M activity/activity/src/main/java/androidx/activity/EdgeToEdge.kt
M activity/integration-tests/testapp/src/main/java/androidx/activity/integration/testapp/EdgeToEdgeActivity.kt
M activity/integration-tests/testapp/src/main/res/layout/edge_to_edge_activity.xml
va...@google.com <va...@google.com>
ya...@google.com <ya...@google.com>
pr...@google.com <pr...@google.com> #8
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.activity:activity:1.8.0-alpha06
Description
Version used: 1.8.0-alpha03
When trying out the new `enableEdgeToEdge` method, I ran into one slightly annoying aspect.
When apps have their own theme picker for choosing dark mode and light mode, the resulting UI them (light vs dark) that the app uses may differ from the system theme, as passed down via the `Configuration`.
`enableEdgeToEdge` always looks at the system theme via the `Configuration`, so there isn't a good way to have a different source of truth for choosing whether to show a dark or light theme.
It also doesn't directly work to have an `if` statement and call `SystemBarStyle.light` or `SystemBarStyle.dark`, because those don't have the transparent behavior that `SystemBarStyle.auto` does on API 29 and above.
Maybe `enableEdgeToEdge` could take an optional lambda for `isShowingDarkTheme`, with a default implementation that uses the `Configuration`.