diff options
author | ByteHamster <info@bytehamster.com> | 2019-07-23 20:46:44 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2019-07-23 21:22:27 +0200 |
commit | e2cf363cc442b5032111f256eb432fffbf954c86 (patch) | |
tree | 9e482fccf749ffaa4bd378ba5a8aace980070cbc /app/src/main/java/de | |
parent | 0e1cac909807a75517a7536f5c9189c3a7cc7d5f (diff) | |
download | AntennaPod-e2cf363cc442b5032111f256eb432fffbf954c86.zip |
Make ExoPlayer the default player
Diffstat (limited to 'app/src/main/java/de')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java | 1 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java | 29 |
2 files changed, 26 insertions, 4 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index 85abf9411..728019196 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -208,7 +208,6 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi checkFirstLaunch(); PreferenceUpgrader.checkUpgrades(this); - NotificationUtils.createChannels(this); } private void saveLastNavFragment(String tag) { diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java index 93b326698..5866f8715 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java @@ -2,28 +2,51 @@ package de.danoeh.antennapod.preferences; import android.content.Context; import android.content.SharedPreferences; +import android.preference.PreferenceManager; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.util.gui.NotificationUtils; public class PreferenceUpgrader { private static final String PREF_CONFIGURED_VERSION = "configuredVersion"; private static final String PREF_NAME = "PreferenceUpgrader"; + private static SharedPreferences prefs; public static void checkUpgrades(Context context) { - SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); - int oldVersion = prefs.getInt(PREF_CONFIGURED_VERSION, 1070200); + prefs = PreferenceManager.getDefaultSharedPreferences(context); + SharedPreferences upgraderPrefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); + int oldVersion = upgraderPrefs.getInt(PREF_CONFIGURED_VERSION, 1070200); int newVersion = BuildConfig.VERSION_CODE; if (oldVersion != newVersion) { - prefs.edit().putInt(PREF_CONFIGURED_VERSION, newVersion).apply(); + NotificationUtils.createChannels(context); + + upgraderPrefs.edit().putInt(PREF_CONFIGURED_VERSION, newVersion).apply(); upgrade(oldVersion); } } private static void upgrade(int oldVersion) { + if (oldVersion < 1070196) { + // migrate episode cleanup value (unit changed from days to hours) + int oldValueInDays = UserPreferences.getEpisodeCleanupValue(); + if (oldValueInDays > 0) { + UserPreferences.setEpisodeCleanupValue(oldValueInDays * 24); + } // else 0 or special negative values, no change needed + } + if (oldVersion < 1070197) { + if (prefs.getBoolean("prefMobileUpdate", false)) { + prefs.edit().putString(UserPreferences.PREF_MOBILE_UPDATE, "everything").apply(); + } + } if (oldVersion < 1070300) { UserPreferences.restartUpdateAlarm(); + + if (UserPreferences.getMediaPlayer().equals("builtin")) { + prefs.edit().putString(UserPreferences.PREF_MEDIA_PLAYER, + UserPreferences.PREF_MEDIA_PLAYER_EXOPLAYER).apply(); + } } } } |