diff options
author | H. Lehmann <ByteHamster@users.noreply.github.com> | 2019-07-23 22:11:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-23 22:11:48 +0200 |
commit | f7251af8be4e7f0e0a04d114bac764ad72f5d504 (patch) | |
tree | 156a91aa8a9595eceb49a7dbf49ced978cc688b7 /core/src | |
parent | 8b7778234860ed7518999c8a64aece65e1600ee2 (diff) | |
parent | e2cf363cc442b5032111f256eb432fffbf954c86 (diff) | |
download | AntennaPod-f7251af8be4e7f0e0a04d114bac764ad72f5d504.zip |
Merge pull request #3284 from ByteHamster/default-exoplayer
Make ExoPlayer the default player
Diffstat (limited to 'core/src')
3 files changed, 6 insertions, 84 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/UpdateManager.java b/core/src/main/java/de/danoeh/antennapod/core/UpdateManager.java deleted file mode 100644 index 1b4cbc0ea..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/UpdateManager.java +++ /dev/null @@ -1,81 +0,0 @@ -package de.danoeh.antennapod.core; - - -import android.content.Context; -import android.content.SharedPreferences; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.os.Build; -import android.util.Log; - -import org.antennapod.audio.MediaPlayer; - -import de.danoeh.antennapod.core.preferences.UserPreferences; - -/* - * This class's job is do perform maintenance tasks whenever the app has been updated - */ -class UpdateManager { - - private UpdateManager(){} - - private static final String TAG = UpdateManager.class.getSimpleName(); - - private static final String PREF_NAME = "app_version"; - private static final String KEY_VERSION_CODE = "version_code"; - - private static int currentVersionCode; - - private static Context context; - private static SharedPreferences prefs; - - public static void init(Context context) { - UpdateManager.context = context; - prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); - PackageManager pm = context.getPackageManager(); - try { - PackageInfo info = pm.getPackageInfo(context.getPackageName(), 0); - currentVersionCode = info.versionCode; - } catch (PackageManager.NameNotFoundException e) { - Log.e(TAG, "Failed to obtain package info for package name: " + context.getPackageName(), e); - currentVersionCode = 0; - return; - } - final int oldVersionCode = getStoredVersionCode(); - Log.d(TAG, "old: " + oldVersionCode + ", current: " + currentVersionCode); - if(oldVersionCode < currentVersionCode) { - onUpgrade(oldVersionCode, currentVersionCode); - setCurrentVersionCode(); - } - } - - private static int getStoredVersionCode() { - return prefs.getInt(KEY_VERSION_CODE, -1); - } - - private static void setCurrentVersionCode() { - prefs.edit().putInt(KEY_VERSION_CODE, currentVersionCode).apply(); - } - - private static void onUpgrade(final int oldVersionCode, final int newVersionCode) { - if (oldVersionCode < 1050004) { - if(MediaPlayer.isPrestoLibraryInstalled(context) && Build.VERSION.SDK_INT >= 16) { - UserPreferences.enableSonic(); - } - } - - if (oldVersionCode < 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 (oldVersionCode < 1070197) { - if (prefs.getBoolean("prefMobileUpdate", false)) { - prefs.edit().putString(UserPreferences.PREF_MOBILE_UPDATE, "everything").apply(); - } - } - } - -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java index 817758545..8f5f5ae1e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java @@ -647,12 +647,16 @@ public class UserPreferences { return selectedSpeeds; } + public static String getMediaPlayer() { + return prefs.getString(PREF_MEDIA_PLAYER, PREF_MEDIA_PLAYER_EXOPLAYER); + } + public static boolean useSonic() { - return prefs.getString(PREF_MEDIA_PLAYER, "sonic").equals("sonic"); + return getMediaPlayer().equals("sonic"); } public static boolean useExoplayer() { - return prefs.getString(PREF_MEDIA_PLAYER, "sonic").equals(PREF_MEDIA_PLAYER_EXOPLAYER); + return getMediaPlayer().equals(PREF_MEDIA_PLAYER_EXOPLAYER); } public static void enableSonic() { diff --git a/core/src/play/java/de/danoeh/antennapod/core/ClientConfig.java b/core/src/play/java/de/danoeh/antennapod/core/ClientConfig.java index d3c517d68..862fe23f5 100644 --- a/core/src/play/java/de/danoeh/antennapod/core/ClientConfig.java +++ b/core/src/play/java/de/danoeh/antennapod/core/ClientConfig.java @@ -41,7 +41,6 @@ public class ClientConfig { } PodDBAdapter.init(context); UserPreferences.init(context); - UpdateManager.init(context); PlaybackPreferences.init(context); NetworkUtils.init(context); CastManager.init(context); |