From 72ffc9abd072022f8b0fcd684a46d8015f293343 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Fri, 23 Jul 2021 14:54:11 -0400 Subject: [PATCH] Fixed fresh installs on A12 not using Monet theme by default --- .../eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt | 2 +- .../main/java/eu/kanade/tachiyomi/util/system/ThemeUtil.kt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt index 1824968f05..87975c25fd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt @@ -116,7 +116,7 @@ class PreferencesHelper(val context: Context) { 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) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ThemeUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ThemeUtil.kt index 0da1946ca4..cc952841b9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ThemeUtil.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ThemeUtil.kt @@ -87,8 +87,9 @@ object ThemeUtil { } fun AppCompatActivity.setThemeAndNight(preferences: PreferencesHelper) { - if (preferences.nightMode().isNotSet()) { - ThemeUtil.convertTheme(preferences, preferences.oldTheme()) + if (preferences.nightMode().isNotSet() && preferences.oldTheme().isSet()) { + ThemeUtil.convertTheme(preferences, preferences.oldTheme().get()) + preferences.oldTheme().delete() } if (AppCompatDelegate.getDefaultNightMode() != preferences.nightMode().get()) { AppCompatDelegate.setDefaultNightMode(preferences.nightMode().get())