summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hennen <TomHennen@users.noreply.github.com>2016-01-22 16:05:37 -0500
committerTom Hennen <TomHennen@users.noreply.github.com>2016-01-22 16:05:37 -0500
commit2b98aca2e2a64064ac65afbb91488720b43fbcb3 (patch)
tree34f2c076baa9d2c746f70ddca9dd66528100c130
parent6d6a8d2fcda2ba2c8d1ef51049403aa6b25d31f2 (diff)
parentbfac8f71a82ccc0361709c95f32a08a07b4b70a6 (diff)
downloadAntennaPod-2b98aca2e2a64064ac65afbb91488720b43fbcb3.zip
Merge pull request #1557 from mfietz/promote_sonic
Promote Sonic
-rw-r--r--app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java60
-rw-r--r--app/src/main/res/xml/preferences.xml17
-rw-r--r--core/src/main/res/values/strings.xml4
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
@@ -76,6 +76,12 @@
<PreferenceCategory android:title="@string/playback_pref">
<de.danoeh.antennapod.preferences.SwitchCompatPreference
android:defaultValue="true"
+ android:enabled="false"
+ android:key="prefSonic"
+ android:summary="@string/pref_sonic_message"
+ android:title="@string/pref_sonic_title"/>
+ <de.danoeh.antennapod.preferences.SwitchCompatPreference
+ android:defaultValue="true"
android:enabled="true"
android:key="prefPauseOnHeadsetDisconnect"
android:summary="@string/pref_pauseOnDisconnect_sum"
@@ -263,14 +269,5 @@
android:title="@string/crash_report_title"
android:summary="@string/crash_report_sum"/>
</PreferenceCategory>
-
- <PreferenceCategory android:title="@string/experimental_pref">
- <de.danoeh.antennapod.preferences.SwitchCompatPreference
- android:defaultValue="false"
- android:enabled="false"
- android:key="prefSonic"
- android:summary="@string/pref_sonic_message"
- android:title="@string/pref_sonic_title"/>
- </PreferenceCategory>
-
+
</PreferenceScreen>
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 @@
<!-- Variable Speed -->
<string name="download_plugin_label">Download Plugin</string>
<string name="no_playback_plugin_title">Plugin Not Installed</string>
- <string name="no_playback_plugin_or_sonic_msg">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.</string>
+ <string name="no_playback_plugin_or_sonic_msg">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 <i>Prestissimo</i> from the Play Store.\nAny problems with Prestissimo are not the responsibility of AntennaPod and should be reported to the plugin owner.</string>
<string name="set_playback_speed_label">Playback Speeds</string>
<string name="enable_sonic">Enable Sonic</string>
@@ -380,7 +380,7 @@
<string name="send_email">Send e-mail</string>
<string name="experimental_pref">Experimental</string>
<string name="pref_sonic_title">Sonic media player</string>
- <string name="pref_sonic_message">Use built-in sonic media player as a replacement for Prestissimo</string>
+ <string name="pref_sonic_message">Use built-in sonic media player as a replacement for Android\'s native mediaplayer and Prestissimo</string>
<string name="pref_current_value">Current value: %1$s</string>
<!-- Auto-Flattr dialog -->