Ahmed
04/05/2025, 2:51 PMval colourScheme = if (darkTheme) lightColourScheme else lightColourScheme
to enforce light colour scheme for now, but for obvious reasons this doesn't apply to res-night
and I can still see the dark icons and other dark mode artefacts here and there.
What is the ideal way to enforce light mode only across the app?Ahmed
04/05/2025, 2:54 PMTheme.MaterialComponents.Light
And one of the solution is to use:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
Stylianos Gakis
04/05/2025, 2:54 PMAppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
And uiModeManager?.setApplicationNightMode(UiModeManager.MODE_NIGHT_YES)
Ahmed
04/05/2025, 2:55 PMAppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
recreates he activity, so I was wondering if it was the ideal way to go ..
I guess I will just call thisAhmed
04/05/2025, 3:00 PMAhmed
04/05/2025, 3:01 PMonCreate
of my launcher activityStylianos Gakis
04/05/2025, 3:11 PMAhmed
04/05/2025, 3:13 PMStylianos Gakis
04/05/2025, 3:16 PMAhmed
04/05/2025, 3:17 PMAppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
In onCreate()
of Application and in onCreate()
of my Launcher Activity (Main).
But the icons are still from the res-night
if I dark mode is selected.Ian Lake
04/05/2025, 3:21 PMAhmed
04/05/2025, 3:22 PMComponentActivity
…Ahmed
04/05/2025, 3:25 PMAppCompatActivity
for my use-case?Ian Lake
04/05/2025, 3:27 PMAndroidView
and want it themed correctly, you should probably be using AppCompatActivity, yes.Ahmed
04/05/2025, 3:29 PMNativeAdView
. But yes, I can see nothing going wrong with using AppCompatActivity
Ian Lake
04/05/2025, 3:31 PMres-night
. Only resource worth using in a 100% Compose app are stringsAhmed
04/05/2025, 3:32 PMAhmed
04/05/2025, 3:38 PMclass LightDrawables: Drawables
class DarkDrawables: Drawables
fun getDrawable(darkTheme: Boolean = isSystemInDarkTheme(), @DrawableRes drawableRes: Int) = if(darkTheme) DarkDrawables.xy else LightDrawables.xy
Ian Lake
04/05/2025, 3:45 PMColton Idle
04/05/2025, 10:19 PMAndroidView used being NativeAdViewStill can't believe there's no first class support for google ads w/ compose