From bfac8f71a82ccc0361709c95f32a08a07b4b70a6 Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Sat, 16 Jan 2016 10:58:33 +0100 Subject: Enable Sonic by default --- .../antennapod/dialog/VariableSpeedDialog.java | 60 +++++++++++----------- app/src/main/res/xml/preferences.xml | 17 +++--- core/src/main/res/values/strings.xml | 4 +- 3 files changed, 40 insertions(+), 41 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java index f2e8b6f7a..6d19b0612 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java @@ -24,14 +24,15 @@ public class VariableSpeedDialog { private static final String TAG = VariableSpeedDialog.class.getSimpleName(); private static final Intent playStoreIntent = new Intent(Intent.ACTION_VIEW, - Uri.parse("market://details?id=com.falconware.prestissimo")); + Uri.parse("market://details?id=com.falconware.prestissimo")); private VariableSpeedDialog() { } public static void showDialog(final Context context) { if (org.antennapod.audio.MediaPlayer.isPrestoLibraryInstalled(context) - || UserPreferences.useSonic()) { + || UserPreferences.useSonic() + || Build.VERSION.SDK_INT >= 23) { showSpeedSelectorDialog(context); } else { showGetPluginDialog(context); @@ -42,10 +43,16 @@ public class VariableSpeedDialog { MaterialDialog.Builder builder = new MaterialDialog.Builder(context); builder.title(R.string.no_playback_plugin_title); builder.content(R.string.no_playback_plugin_or_sonic_msg); - builder.positiveText(R.string.download_plugin_label); - builder.negativeText(R.string.enable_sonic); + builder.positiveText(R.string.enable_sonic); + builder.negativeText(R.string.download_plugin_label); builder.neutralText(R.string.close_label); builder.onPositive((dialog, which) -> { + if (Build.VERSION.SDK_INT >= 16) { // just to be safe + UserPreferences.enableSonic(true); + showSpeedSelectorDialog(context); + } + }); + builder.onNegative((dialog, which) -> { try { context.startActivity(playStoreIntent); } catch (ActivityNotFoundException e) { @@ -53,18 +60,13 @@ public class VariableSpeedDialog { Log.e(TAG, Log.getStackTraceString(e)); } }); - builder.onNegative((dialog, which) -> { - if (Build.VERSION.SDK_INT >= 16) { // just to be safe - UserPreferences.enableSonic(true); - showSpeedSelectorDialog(context); - } - }); + builder.forceStacking(true); MaterialDialog dialog = builder.show(); - if(!IntentUtils.isCallable(context.getApplicationContext(), playStoreIntent)) { + if (Build.VERSION.SDK_INT < 16) { View pos = dialog.getActionButton(DialogAction.POSITIVE); pos.setEnabled(false); } - if (Build.VERSION.SDK_INT < 16) { + if(!IntentUtils.isCallable(context.getApplicationContext(), playStoreIntent)) { View pos = dialog.getActionButton(DialogAction.NEGATIVE); pos.setEnabled(false); } @@ -87,29 +89,29 @@ public class VariableSpeedDialog { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(R.string.set_playback_speed_label); builder.setMultiChoiceItems(R.array.playback_speed_values, - speedChecked, (dialog, which, isChecked) -> { - speedChecked[which] = isChecked; - }); + speedChecked, (dialog, which, isChecked) -> { + speedChecked[which] = isChecked; + }); builder.setNegativeButton(android.R.string.cancel, null); builder.setPositiveButton(android.R.string.ok, - (dialog, which) -> { - int choiceCount = 0; - for (int i = 0; i < speedChecked.length; i++) { - if (speedChecked[i]) { - choiceCount++; - } + (dialog, which) -> { + int choiceCount = 0; + for (int i = 0; i < speedChecked.length; i++) { + if (speedChecked[i]) { + choiceCount++; } - String[] newSpeedValues = new String[choiceCount]; - int newSpeedIndex = 0; - for (int i = 0; i < speedChecked.length; i++) { - if (speedChecked[i]) { - newSpeedValues[newSpeedIndex++] = speedValues[i]; - } + } + String[] newSpeedValues = new String[choiceCount]; + int newSpeedIndex = 0; + for (int i = 0; i < speedChecked.length; i++) { + if (speedChecked[i]) { + newSpeedValues[newSpeedIndex++] = speedValues[i]; } + } - UserPreferences.setPlaybackSpeedArray(newSpeedValues); + UserPreferences.setPlaybackSpeedArray(newSpeedValues); - }); + }); builder.create().show(); } diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index b2a28e871..3ecd79b1e 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -74,6 +74,12 @@ + - - - - - + diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 91a77e6e2..50100e56b 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -267,7 +267,7 @@ Download Plugin Plugin Not Installed - For variable speed playback to work, you have to install a third party library or enable the experimental Sonic player [Android 4.1+].\n\nTap \'Download Plugin\' to download a free plugin from the Play Store.\n\nAny problems found using this plugin are not the responsibility of AntennaPod and should be reported to the plugin owner. + For variable speed playback to work, we recommend to enable the built-in Sonic mediaplayer [Android 4.1+].\n\nAlternatively, you can download the third party plugin Prestissimo from the Play Store.\nAny problems with Prestissimo are not the responsibility of AntennaPod and should be reported to the plugin owner. Playback Speeds Enable Sonic @@ -380,7 +380,7 @@ Send e-mail Experimental Sonic media player - Use built-in sonic media player as a replacement for Prestissimo + Use built-in sonic media player as a replacement for Android\'s native mediaplayer and Prestissimo Current value: %1$s -- cgit v1.2.3