diff options
author | H. Lehmann <ByteHamster@users.noreply.github.com> | 2018-09-30 14:06:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-30 14:06:03 +0200 |
commit | c5245f50810fc9b957dc2986553687f6e964168d (patch) | |
tree | 06bc87c0b1ae903d2288b8c93ac78439d6e93865 /core | |
parent | c105a63165e6fcb42a3130153edfe24868956909 (diff) | |
parent | 96145eed11328e2491a5966b205020afffb5d113 (diff) | |
download | AntennaPod-c5245f50810fc9b957dc2986553687f6e964168d.zip |
Merge pull request #2838 from AntennaPod/feature/2828-filter-favorites
Add feed filter criteria 'is favorite'
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java | 8 | ||||
-rw-r--r-- | core/src/main/res/values/arrays.xml | 2 | ||||
-rw-r--r-- | core/src/main/res/values/strings.xml | 1 |
3 files changed, 11 insertions, 0 deletions
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 @@ <item>@string/hide_downloaded_episodes_label</item> <item>@string/hide_not_downloaded_episodes_label</item> <item>@string/hide_has_media_label</item> + <item>@string/hide_is_favorite_label</item> </string-array> <string-array name="episode_filter_values"> @@ -225,6 +226,7 @@ <item>downloaded</item> <item>not_downloaded</item> <item>has_media</item> + <item>is_favorite</item> </string-array> <string-array name="image_cache_size_options"> diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index b91c07648..8ae9957cb 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -152,6 +152,7 @@ <string name="hide_downloaded_episodes_label">Downloaded</string> <string name="hide_not_downloaded_episodes_label">Not downloaded</string> <string name="hide_has_media_label">Has media</string> + <string name="hide_is_favorite_label">Is favorite</string> <string name="filtered_label">Filtered</string> <string name="refresh_failed_msg">{fa-exclamation-circle} Last Refresh failed</string> <string name="open_podcast">Open Podcast</string> |