Merge pull request #2838 from AntennaPod/feature/2828-filter-favorites

Add feed filter criteria 'is favorite'
This commit is contained in:
H. Lehmann 2018-09-30 14:06:03 +02:00 committed by GitHub
commit c5245f5081
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -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);
}

View File

@ -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">

View File

@ -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>