[#11] Add a small delay before applying theme so compose has enough time to update remember states before the theme is applied.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-01-22 20:45:45 +01:00
parent 9ca830a707
commit f40b66077b

View File

@@ -94,9 +94,13 @@ class MainActivity : AppCompatActivity(), ISettingsChangeListener {
} }
if (themeValue != AppCompatDelegate.getDefaultNightMode()) { if (themeValue != AppCompatDelegate.getDefaultNightMode()) {
lifecycleScope.launch {
// Give compose a bit of time to update the state.
delay(50)
AppCompatDelegate.setDefaultNightMode(themeValue) AppCompatDelegate.setDefaultNightMode(themeValue)
} }
} }
}
override fun onScreenOnChanged(keepOn: KeepScreenOn) { override fun onScreenOnChanged(keepOn: KeepScreenOn) {
if (keepOn.value) { if (keepOn.value) {