diff --git a/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java b/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java
index a0f2c17ea..909b7a5a2 100644
--- a/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java
+++ b/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java
@@ -409,7 +409,6 @@ public class PreferencesTest {
clickPreference(R.string.network_pref);
onView(withText(R.string.pref_automatic_download_title)).perform(click());
onView(withText(R.string.pref_episode_cleanup_title)).perform(click());
- onView(withId(R.id.select_dialog_listview)).perform(swipeUp());
onView(withText(R.string.episode_cleanup_after_listening)).perform(click());
Awaitility.await().atMost(1000, MILLISECONDS)
.until(() -> {
@@ -455,7 +454,6 @@ public class PreferencesTest {
// Find next value (wrapping around to next)
int newIndex = (currentIndex + 1) % deltas.length;
onView(withText(deltas[newIndex] + " seconds")).perform(click());
- onView(withText("Confirm")).perform(click());
Awaitility.await().atMost(1000, MILLISECONDS)
.until(() -> UserPreferences.getRewindSecs() == deltas[newIndex]);
@@ -477,7 +475,6 @@ public class PreferencesTest {
int newIndex = (currentIndex + 1) % deltas.length;
onView(withText(deltas[newIndex] + " seconds")).perform(click());
- onView(withText("Confirm")).perform(click());
Awaitility.await().atMost(1000, MILLISECONDS)
.until(() -> UserPreferences.getFastForwardSecs() == deltas[newIndex]);
diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/SkipPreferenceDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/SkipPreferenceDialog.java
index 28b48963c..a5eca4bc2 100644
--- a/app/src/main/java/de/danoeh/antennapod/dialog/SkipPreferenceDialog.java
+++ b/app/src/main/java/de/danoeh/antennapod/dialog/SkipPreferenceDialog.java
@@ -37,9 +37,7 @@ public class SkipPreferenceDialog {
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context);
builder.setTitle(direction == SkipDirection.SKIP_FORWARD ? R.string.pref_fast_forward : R.string.pref_rewind);
- builder.setSingleChoiceItems(choices, checked, null);
- builder.setNegativeButton(R.string.cancel_label, null);
- builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> {
+ builder.setSingleChoiceItems(choices, checked, (dialog, which) -> {
int choice = ((AlertDialog) dialog).getListView().getCheckedItemPosition();
if (choice < 0 || choice >= values.length) {
System.err.printf("Choice in showSkipPreference is out of bounds %d", choice);
@@ -53,9 +51,11 @@ public class SkipPreferenceDialog {
if (textView != null) {
textView.setText(NumberFormat.getInstance().format(seconds));
}
+ dialog.dismiss();
}
});
- builder.create().show();
+ builder.setNegativeButton(R.string.cancel_label, null);
+ builder.show();
}
public enum SkipDirection {
diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/MaterialListPreference.java b/app/src/main/java/de/danoeh/antennapod/preferences/MaterialListPreference.java
new file mode 100644
index 000000000..3ee08f369
--- /dev/null
+++ b/app/src/main/java/de/danoeh/antennapod/preferences/MaterialListPreference.java
@@ -0,0 +1,43 @@
+package de.danoeh.antennapod.preferences;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import androidx.preference.ListPreference;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+
+public class MaterialListPreference extends ListPreference {
+
+ public MaterialListPreference(Context context) {
+ super(context);
+ }
+
+ public MaterialListPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ protected void onClick() {
+ MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext());
+ builder.setTitle(getTitle());
+ builder.setIcon(getDialogIcon());
+ builder.setNegativeButton(getNegativeButtonText(), null);
+
+ CharSequence[] values = getEntryValues();
+ int selected = -1;
+ for (int i = 0; i < values.length; i++) {
+ if (values[i].toString().equals(getValue())) {
+ selected = i;
+ }
+ }
+ builder.setSingleChoiceItems(getEntries(), selected, (dialog, which) -> {
+ dialog.dismiss();
+ if (which >= 0 && getEntryValues() != null) {
+ String value = getEntryValues()[which].toString();
+ if (callChangeListener(value)) {
+ setValue(value);
+ }
+ }
+ });
+ builder.show();
+ }
+}
diff --git a/app/src/main/res/xml/feed_settings.xml b/app/src/main/res/xml/feed_settings.xml
index 007f084c9..a2ea42f01 100644
--- a/app/src/main/res/xml/feed_settings.xml
+++ b/app/src/main/res/xml/feed_settings.xml
@@ -40,7 +40,7 @@
android:summary="@string/pref_feed_skip_sum"
android:title="@string/pref_feed_skip" />
-
-
-
-
-
-
-
-
-
-
-
-