From 5c6000155cc8f2c6111301ceecae08bf41e0b735 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sun, 24 Mar 2024 21:27:30 +0100 Subject: Let the database do the sorting (#7025) --- .../main/java/de/danoeh/antennapod/model/feed/FeedItemFilter.java | 6 ++++++ model/src/main/java/de/danoeh/antennapod/model/feed/SortOrder.java | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'model/src') 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 -- cgit v1.2.3