summaryrefslogtreecommitdiff
path: root/model/src
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2024-03-24 21:27:30 +0100
committerGitHub <noreply@github.com>2024-03-24 21:27:30 +0100
commit5c6000155cc8f2c6111301ceecae08bf41e0b735 (patch)
treef2433fb8c8f59e77b7ff25ac4296d82a3f318b07 /model/src
parent4078b3475e5140e6f5f9ef924bc8ff8d9e345113 (diff)
downloadAntennaPod-5c6000155cc8f2c6111301ceecae08bf41e0b735.zip
Let the database do the sorting (#7025)
Diffstat (limited to 'model/src')
-rw-r--r--model/src/main/java/de/danoeh/antennapod/model/feed/FeedItemFilter.java6
-rw-r--r--model/src/main/java/de/danoeh/antennapod/model/feed/SortOrder.java3
2 files changed, 8 insertions, 1 deletions
diff --git a/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItemFilter.java b/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItemFilter.java
index d46cf6081..95a7a6110 100644
--- a/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItemFilter.java
+++ b/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItemFilter.java
@@ -23,6 +23,7 @@ public class FeedItemFilter implements Serializable {
public final boolean showNoMedia;
public final boolean showIsFavorite;
public final boolean showNotFavorite;
+ public final boolean showInHistory;
public static final String PLAYED = "played";
public static final String UNPLAYED = "unplayed";
@@ -37,6 +38,7 @@ public class FeedItemFilter implements Serializable {
public static final String NOT_QUEUED = "not_queued";
public static final String DOWNLOADED = "downloaded";
public static final String NOT_DOWNLOADED = "not_downloaded";
+ public static final String IS_IN_HISTORY = "is_in_history";
public static FeedItemFilter unfiltered() {
return new FeedItemFilter("");
@@ -63,6 +65,7 @@ public class FeedItemFilter implements Serializable {
showIsFavorite = hasProperty(IS_FAVORITE);
showNotFavorite = hasProperty(NOT_FAVORITE);
showNew = hasProperty(NEW);
+ showInHistory = hasProperty(IS_IN_HISTORY);
}
private boolean hasProperty(String property) {
@@ -106,6 +109,9 @@ public class FeedItemFilter implements Serializable {
return false;
} else if (showNotFavorite && item.isTagged(FeedItem.TAG_FAVORITE)) {
return false;
+ } else if (showInHistory && item.getMedia() != null
+ && item.getMedia().getPlaybackCompletionDate().getTime() == 0) {
+ return false;
}
return true;
}
diff --git a/model/src/main/java/de/danoeh/antennapod/model/feed/SortOrder.java b/model/src/main/java/de/danoeh/antennapod/model/feed/SortOrder.java
index f6c90341a..fc2a4623b 100644
--- a/model/src/main/java/de/danoeh/antennapod/model/feed/SortOrder.java
+++ b/model/src/main/java/de/danoeh/antennapod/model/feed/SortOrder.java
@@ -26,7 +26,8 @@ public enum SortOrder {
FEED_TITLE_Z_A(102, INTER_FEED),
RANDOM(103, INTER_FEED),
SMART_SHUFFLE_OLD_NEW(104, INTER_FEED),
- SMART_SHUFFLE_NEW_OLD(105, INTER_FEED);
+ SMART_SHUFFLE_NEW_OLD(105, INTER_FEED),
+ COMPLETION_DATE_NEW_OLD(106, INTER_FEED);
public enum Scope {
INTRA_FEED, INTER_FEED