summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/danoeh/antennapod/dialog
diff options
context:
space:
mode:
authorasdoi <asdoi@t-online.de>2020-09-03 14:07:57 +0200
committerasdoi <asdoi@t-online.de>2020-09-03 14:07:57 +0200
commit75be61ff6de87c7c1012c52258739a0be5fea1d2 (patch)
treebe7a9d6f2f1b139a5b3ab8dbab921bd76ead2eb2 /app/src/main/java/de/danoeh/antennapod/dialog
parentbd0d0b5008fe2735b335df03ffe16bdae73785d0 (diff)
downloadAntennaPod-75be61ff6de87c7c1012c52258739a0be5fea1d2.zip
fix FeedSortDialog
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/dialog')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/dialog/FeedSortDialog.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/FeedSortDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/FeedSortDialog.java
index e05cb034f..96d1b9b67 100644
--- a/app/src/main/java/de/danoeh/antennapod/dialog/FeedSortDialog.java
+++ b/app/src/main/java/de/danoeh/antennapod/dialog/FeedSortDialog.java
@@ -6,6 +6,9 @@ import androidx.appcompat.app.AlertDialog;
import org.greenrobot.eventbus.EventBus;
+import java.util.Arrays;
+import java.util.List;
+
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent;
import de.danoeh.antennapod.core.preferences.UserPreferences;
@@ -16,20 +19,15 @@ public class FeedSortDialog {
dialog.setTitle(context.getString(R.string.pref_nav_drawer_feed_order_title));
dialog.setNegativeButton(android.R.string.cancel, (d, listener) -> d.dismiss());
- int selectedIndexTemp = 0;
int selected = UserPreferences.getFeedOrder();
- String[] entryValues = context.getResources().getStringArray(R.array.nav_drawer_feed_order_values);
- for (int i = 0; i < entryValues.length; i++) {
- if (Integer.parseInt(entryValues[i]) == selected) {
- selectedIndexTemp = i;
- }
- }
+ List<String> entryValues =
+ Arrays.asList(context.getResources().getStringArray(R.array.nav_drawer_feed_order_values));
+ final int selectedIndex = entryValues.indexOf("" + selected);
- final int selectedIndex = selectedIndexTemp;
String[] items = context.getResources().getStringArray(R.array.nav_drawer_feed_order_options);
dialog.setSingleChoiceItems(items, selectedIndex, (d, which) -> {
if (selectedIndex != which) {
- UserPreferences.setFeedOrder(entryValues[which]);
+ UserPreferences.setFeedOrder(entryValues.get(which));
//Update subscriptions
EventBus.getDefault().post(new UnreadItemsUpdateEvent());
}