A colleague of mine tested one of my compose apps ...
# compose
j
A colleague of mine tested one of my compose apps on a “Moto Z2 Play” running Android 9.0 and it turned out all composables render always in dark mode. Android 9 didn’t have dark mode yet but it had a “device theme” setting under “settings -> display -> advanced”. It seems changing that has no effect whatsoever. Every composable in the app is always displayed as if
isSystemInDarkTheme()
always returned
true
. I have tested on an API28 emulator and can’t reproduce: the composables are always rendered in light mode (as they are supposed to). Has anyone encountered a similar situation?
c
My guess is that some app has called
UiModeManager.setNightMode()
. That API was a global toggle up until API 29 so is likely to be the reason
1
today i learned 1
🙏 1
If they run an app and call the following, it will reset the value:
Copy code
val mgr = getSystemService(Context.UI_MODE_SERVICE) as UiModeManager
mgr.nightMode = UiModeManager.MODE_NIGHT_NO
n
On OnePlus devices, dark mode is linked to the "tone" of the screen : https://oneplus.gadgethacks.com/how-to/enable-dark-mode-your-oneplus-with-android-10-0242966/ I wonder if there is something similar on the moto z2