Jorge Domínguez
03/08/2024, 2:39 PMdrawable-night
resource set are not used, and instead the regular drawable
resources are used, which leads to a very weird-looking UI. I know I can inform the system of the selected theme by doing either UiModeManager.setApplicationNightMode()
or AppCompatDelegate.setDefaultNightMode()
, and it seems to work, but for some reason it breaks the theme change when the users selects the system default option. Are there additional considerations for doing this in Compose that I’m missing?Alex Vanyo
03/08/2024, 4:33 PMActivity
is your Compose app using? If you are using AppCompatDelegate
, you will need to use AppCompatActivity
to get all of the backporting in behavior that AppCompatDelegate
applies.Jorge Domínguez
03/08/2024, 4:39 PMComponentActivity
as base, and I’m only using AppCompatDelegate
if the API is lower than 31Alex Vanyo
03/08/2024, 4:40 PMAppCompatActivity
to get the right behaviorJorge Domínguez
03/08/2024, 4:42 PMAlex Vanyo
03/08/2024, 4:55 PMJorge Domínguez
03/08/2024, 5:01 PMisSystemInDarkTheme()
returns to set MODE_NIGHT_YES
or MODE_NIGHT_NO
respectively.Alex Vanyo
03/08/2024, 5:02 PMUiModeManager
or https://developer.android.com/reference/androidx/appcompat/app/AppCompatDelegate#MODE_NIGHT_FOLLOW_SYSTEM() for AppCompatDelegate
Jorge Domínguez
03/08/2024, 5:04 PMandroid:configChanges="uiMode"
in my manifest, and noticed that the onConfigurationChanged
callback is not giving me the right UI_MODE value when I change it in the device’s settingsJorge Domínguez
03/08/2024, 5:13 PMAlex Vanyo
03/08/2024, 5:16 PMUiModeManager
or AppCompatDelegate
to “yes” or “no”, you won’t be following the system as that changes, you have to explicity switch back to the setting which follows the systemJorge Domínguez
03/08/2024, 5:28 PM