Skip to content

Commit

Permalink
Fixed fresh installs on A12 not using Monet theme by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Jays2Kings committed Jul 23, 2021
1 parent c3fd434 commit 72ffc9a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 72ffc9a

Please sign in to comment.