Fixed fresh installs on A12 not using Monet theme by default

This commit is contained in:
Jays2Kings 2021-07-23 14:54:11 -04:00
parent c3fd4349fe
commit 72ffc9abd0
2 changed files with 4 additions and 3 deletions

View File

@ -116,7 +116,7 @@ class PreferencesHelper(val context: Context) {
fun clear() = prefs.edit().clear().apply() fun clear() = prefs.edit().clear().apply()
fun oldTheme() = prefs.getInt(Keys.theme, 5) fun oldTheme() = flowPrefs.getInt(Keys.theme, 5)
fun nightMode() = flowPrefs.getInt(Keys.nightMode, AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM) fun nightMode() = flowPrefs.getInt(Keys.nightMode, AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)

View File

@ -87,8 +87,9 @@ object ThemeUtil {
} }
fun AppCompatActivity.setThemeAndNight(preferences: PreferencesHelper) { fun AppCompatActivity.setThemeAndNight(preferences: PreferencesHelper) {
if (preferences.nightMode().isNotSet()) { if (preferences.nightMode().isNotSet() && preferences.oldTheme().isSet()) {
ThemeUtil.convertTheme(preferences, preferences.oldTheme()) ThemeUtil.convertTheme(preferences, preferences.oldTheme().get())
preferences.oldTheme().delete()
} }
if (AppCompatDelegate.getDefaultNightMode() != preferences.nightMode().get()) { if (AppCompatDelegate.getDefaultNightMode() != preferences.nightMode().get()) {
AppCompatDelegate.setDefaultNightMode(preferences.nightMode().get()) AppCompatDelegate.setDefaultNightMode(preferences.nightMode().get())