From 96145eed11328e2491a5966b205020afffb5d113 Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Thu, 27 Sep 2018 13:49:30 +0200 Subject: [PATCH] Add feed filter criteria 'is favorite' --- .../de/danoeh/antennapod/core/feed/FeedItemFilter.java | 8 ++++++++ core/src/main/res/values/arrays.xml | 2 ++ core/src/main/res/values/strings.xml | 1 + 3 files changed, 11 insertions(+) diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java index 200153876..719383d23 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java @@ -8,6 +8,8 @@ import java.util.List; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.util.LongList; +import static de.danoeh.antennapod.core.feed.FeedItem.TAG_FAVORITE; + public class FeedItemFilter { private final String[] mProperties; @@ -19,6 +21,7 @@ public class FeedItemFilter { private boolean showDownloaded = false; private boolean showNotDownloaded = false; private boolean showHasMedia = false; + private boolean showIsFavorite = false; public FeedItemFilter(String properties) { this(TextUtils.split(properties, ",")); @@ -53,6 +56,9 @@ public class FeedItemFilter { case "has_media": showHasMedia = true; break; + case "is_favorite": + showIsFavorite = true; + break; } } } @@ -88,6 +94,8 @@ public class FeedItemFilter { if (showHasMedia && !item.hasMedia()) continue; + if (showIsFavorite && !item.isTagged(TAG_FAVORITE)) continue; + // If the item reaches here, it meets all criteria result.add(item); } diff --git a/core/src/main/res/values/arrays.xml b/core/src/main/res/values/arrays.xml index d9009d9d5..c02b700e4 100644 --- a/core/src/main/res/values/arrays.xml +++ b/core/src/main/res/values/arrays.xml @@ -214,6 +214,7 @@ @string/hide_downloaded_episodes_label @string/hide_not_downloaded_episodes_label @string/hide_has_media_label + @string/hide_is_favorite_label @@ -225,6 +226,7 @@ downloaded not_downloaded has_media + is_favorite diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 244a69861..ca7c7e3c4 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -152,6 +152,7 @@ Downloaded Not downloaded Has media + Is favorite Filtered {fa-exclamation-circle} Last Refresh failed Open Podcast