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

View File

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