Android: [Bug] App theme stays Light when system theme is set to automatically switch between Dark and Light themes
Describe the bug
When I set the system theme to be dark from sunset to sunrise, and set the DDG theme to system default, the app remains in light theme all the time.
How to Reproduce
- Set your phone’s dark mode to be automatically enabled from sunset to sunrise.
- Open DDG app.
- Go to Settings.
- Set Theme option to “System Default”.
- Observe that the app always stays in light mode, even during the night.
Expected behavior
The app should be in dark mode from sunset to sunrise in your geographical region, and in light mode from sunrise to sunset. All other apps behave accordingly (Firefox, Bitwarden, Aegis, and Signal are few OSS app examples that behave correctly, might be useful when investigating the root cause of the problem)
Environment
- DDG App Version: 5.111.0
- Device: OnePlus 7T Pro
- OS: Android 11
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 15 (4 by maintainers)
I think there is need just small fix in
Theming.kt:And, by the way, in
DuckDuckGoActivitythere isfun isDarkThemeEnabled(): Booleanwhich duplicate wrong logic fromapplyThemeand not in use.@malmstein cool theme refactoring, but please fix auto night mode, also this bug now in
getThemedDrawabletoo.UiModeManagerprovides only static information about night mode (yes/no/auto/custom), needs to get dynamic info about mode fromConfiguration. I’ll provide PR with fix.Fixed in https://github.com/duckduckgo/Android/pull/2447
@malmstein can you take a look to the comments inside this issue and the @simonvar proposal? Not sure if you are already addressing the issue inside your current project.
We faced this problem last week, our investigations leads us to appcompat library upgrade we did, apparently, this bug was happening due to our upgrade to 1.4.1 This bug is documented and reported here https://issuetracker.google.com/issues/188681415
Also, with
System Defaultweb content follows device theme. Only DDG UI does not.This issue occurs only below Android 12
Florisboard had the same issue, if that could help come up with a fix?
https://github.com/florisboard/florisboard/issues/1557