FeedItemFilter Ids (#5231)

This commit is contained in:
ueen 2021-06-20 19:00:51 +02:00 committed by GitHub
parent 90fbe4177e
commit e26507e41d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 24 deletions

View File

@ -1,20 +1,21 @@
package de.danoeh.antennapod.core.feed; package de.danoeh.antennapod.core.feed;
import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.model.feed.FeedItemFilter;
public enum FeedItemFilterGroup { public enum FeedItemFilterGroup {
PLAYED(new ItemProperties(R.string.hide_played_episodes_label, "played"), PLAYED(new ItemProperties(R.string.hide_played_episodes_label, FeedItemFilter.PLAYED),
new ItemProperties(R.string.not_played, "unplayed")), new ItemProperties(R.string.not_played, FeedItemFilter.UNPLAYED)),
PAUSED(new ItemProperties(R.string.hide_paused_episodes_label, "paused"), PAUSED(new ItemProperties(R.string.hide_paused_episodes_label, FeedItemFilter.PAUSED),
new ItemProperties(R.string.not_paused, "not_paused")), new ItemProperties(R.string.not_paused, FeedItemFilter.NOT_PAUSED)),
FAVORITE(new ItemProperties(R.string.hide_is_favorite_label, "is_favorite"), FAVORITE(new ItemProperties(R.string.hide_is_favorite_label, FeedItemFilter.IS_FAVORITE),
new ItemProperties(R.string.not_favorite, "not_favorite")), new ItemProperties(R.string.not_favorite, FeedItemFilter.NOT_FAVORITE)),
MEDIA(new ItemProperties(R.string.has_media, "has_media"), MEDIA(new ItemProperties(R.string.has_media, FeedItemFilter.HAS_MEDIA),
new ItemProperties(R.string.no_media, "no_media")), new ItemProperties(R.string.no_media, FeedItemFilter.NO_MEDIA)),
QUEUED(new ItemProperties(R.string.queued_label, "queued"), QUEUED(new ItemProperties(R.string.queued_label, FeedItemFilter.QUEUED),
new ItemProperties(R.string.not_queued_label, "not_queued")), new ItemProperties(R.string.not_queued_label, FeedItemFilter.NOT_QUEUED)),
DOWNLOADED(new ItemProperties(R.string.hide_downloaded_episodes_label, "downloaded"), DOWNLOADED(new ItemProperties(R.string.hide_downloaded_episodes_label, FeedItemFilter.DOWNLOADED),
new ItemProperties(R.string.hide_not_downloaded_episodes_label, "not_downloaded")); new ItemProperties(R.string.hide_not_downloaded_episodes_label, FeedItemFilter.NOT_DOWNLOADED));
public final ItemProperties[] values; public final ItemProperties[] values;

View File

@ -11,6 +11,7 @@ public class FeedItemFilter {
public final boolean showUnplayed; public final boolean showUnplayed;
public final boolean showPaused; public final boolean showPaused;
public final boolean showNotPaused; public final boolean showNotPaused;
public final boolean showNew;
public final boolean showQueued; public final boolean showQueued;
public final boolean showNotQueued; public final boolean showNotQueued;
public final boolean showDownloaded; public final boolean showDownloaded;
@ -20,6 +21,20 @@ public class FeedItemFilter {
public final boolean showIsFavorite; public final boolean showIsFavorite;
public final boolean showNotFavorite; public final boolean showNotFavorite;
public static final String PLAYED = "played";
public static final String UNPLAYED = "unplayed";
public static final String NEW = "new";
public static final String PAUSED = "paused";
public static final String NOT_PAUSED = "not_paused";
public static final String IS_FAVORITE = "is_favorite";
public static final String NOT_FAVORITE = "not_favorite";
public static final String HAS_MEDIA = "has_media";
public static final String NO_MEDIA = "no_media";
public static final String QUEUED = "queued";
public static final String NOT_QUEUED = "not_queued";
public static final String DOWNLOADED = "downloaded";
public static final String NOT_DOWNLOADED = "not_downloaded";
public static FeedItemFilter unfiltered() { public static FeedItemFilter unfiltered() {
return new FeedItemFilter(""); return new FeedItemFilter("");
} }
@ -32,18 +47,19 @@ public class FeedItemFilter {
this.properties = properties; this.properties = properties;
// see R.arrays.feed_filter_values // see R.arrays.feed_filter_values
showUnplayed = hasProperty("unplayed"); showUnplayed = hasProperty(UNPLAYED);
showPaused = hasProperty("paused"); showPaused = hasProperty(PAUSED);
showNotPaused = hasProperty("not_paused"); showNotPaused = hasProperty(NOT_PAUSED);
showPlayed = hasProperty("played"); showPlayed = hasProperty(PLAYED);
showQueued = hasProperty("queued"); showQueued = hasProperty(QUEUED);
showNotQueued = hasProperty("not_queued"); showNotQueued = hasProperty(NOT_QUEUED);
showDownloaded = hasProperty("downloaded"); showDownloaded = hasProperty(DOWNLOADED);
showNotDownloaded = hasProperty("not_downloaded"); showNotDownloaded = hasProperty(NOT_DOWNLOADED);
showHasMedia = hasProperty("has_media"); showHasMedia = hasProperty(HAS_MEDIA);
showNoMedia = hasProperty("no_media"); showNoMedia = hasProperty(NO_MEDIA);
showIsFavorite = hasProperty("is_favorite"); showIsFavorite = hasProperty(IS_FAVORITE);
showNotFavorite = hasProperty("not_favorite"); showNotFavorite = hasProperty(NOT_FAVORITE);
showNew = hasProperty(NEW);
} }
private boolean hasProperty(String property) { private boolean hasProperty(String property) {