summaryrefslogtreecommitdiff
path: root/storage/preferences
diff options
context:
space:
mode:
authorJared234 <jared@fantaye.de>2023-02-12 21:12:04 +0100
committerGitHub <noreply@github.com>2023-02-12 21:12:04 +0100
commit7a2f4771ecd327665497f21606ebc9d6c9415fd1 (patch)
tree6d26ea35891de0004ec04c7752c172c111cac85e /storage/preferences
parent8248bc6bb1f5f71a1e6be3101e1b2173948bf516 (diff)
downloadAntennaPod-7a2f4771ecd327665497f21606ebc9d6c9415fd1.zip
Add sorting options to downloads screen (#6210)
Diffstat (limited to 'storage/preferences')
-rw-r--r--storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java b/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java
index 895d0ab6f..8d9b099fc 100644
--- a/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java
+++ b/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java
@@ -66,6 +66,7 @@ public class UserPreferences {
public static final String PREF_QUEUE_KEEP_SORTED = "prefQueueKeepSorted";
public static final String PREF_QUEUE_KEEP_SORTED_ORDER = "prefQueueKeepSortedOrder";
+ private static final String PREF_DOWNLOADS_SORTED_ORDER = "prefDownloadSortedOrder";
// Playback
public static final String PREF_PAUSE_ON_HEADSET_DISCONNECT = "prefPauseOnHeadsetDisconnect";
@@ -926,6 +927,24 @@ public class UserPreferences {
.apply();
}
+ /**
+ * Returns the sort order for the downloads.
+ */
+ public static SortOrder getDownloadsSortedOrder() {
+ String sortOrderStr = prefs.getString(PREF_DOWNLOADS_SORTED_ORDER, "" + SortOrder.DATE_NEW_OLD.code);
+ return SortOrder.fromCodeString(sortOrderStr);
+ }
+
+ /**
+ * Sets the sort order for the downloads.
+ */
+ public static void setDownloadsSortedOrder(SortOrder sortOrder) {
+ if (sortOrder == null) {
+ return;
+ }
+ prefs.edit().putString(PREF_DOWNLOADS_SORTED_ORDER, "" + sortOrder.code).apply();
+ }
+
public static SubscriptionsFilter getSubscriptionsFilter() {
String value = prefs.getString(PREF_FILTER_FEED, "");
return new SubscriptionsFilter(value);