Merge pull request #2838 from AntennaPod/feature/2828-filter-favorites
Add feed filter criteria 'is favorite'
This commit is contained in:
commit
c5245f5081
|
@ -8,6 +8,8 @@ import java.util.List;
|
||||||
import de.danoeh.antennapod.core.storage.DBReader;
|
import de.danoeh.antennapod.core.storage.DBReader;
|
||||||
import de.danoeh.antennapod.core.util.LongList;
|
import de.danoeh.antennapod.core.util.LongList;
|
||||||
|
|
||||||
|
import static de.danoeh.antennapod.core.feed.FeedItem.TAG_FAVORITE;
|
||||||
|
|
||||||
public class FeedItemFilter {
|
public class FeedItemFilter {
|
||||||
private final String[] mProperties;
|
private final String[] mProperties;
|
||||||
|
|
||||||
|
@ -19,6 +21,7 @@ public class FeedItemFilter {
|
||||||
private boolean showDownloaded = false;
|
private boolean showDownloaded = false;
|
||||||
private boolean showNotDownloaded = false;
|
private boolean showNotDownloaded = false;
|
||||||
private boolean showHasMedia = false;
|
private boolean showHasMedia = false;
|
||||||
|
private boolean showIsFavorite = false;
|
||||||
|
|
||||||
public FeedItemFilter(String properties) {
|
public FeedItemFilter(String properties) {
|
||||||
this(TextUtils.split(properties, ","));
|
this(TextUtils.split(properties, ","));
|
||||||
|
@ -53,6 +56,9 @@ public class FeedItemFilter {
|
||||||
case "has_media":
|
case "has_media":
|
||||||
showHasMedia = true;
|
showHasMedia = true;
|
||||||
break;
|
break;
|
||||||
|
case "is_favorite":
|
||||||
|
showIsFavorite = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,6 +94,8 @@ public class FeedItemFilter {
|
||||||
|
|
||||||
if (showHasMedia && !item.hasMedia()) continue;
|
if (showHasMedia && !item.hasMedia()) continue;
|
||||||
|
|
||||||
|
if (showIsFavorite && !item.isTagged(TAG_FAVORITE)) continue;
|
||||||
|
|
||||||
// If the item reaches here, it meets all criteria
|
// If the item reaches here, it meets all criteria
|
||||||
result.add(item);
|
result.add(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,6 +214,7 @@
|
||||||
<item>@string/hide_downloaded_episodes_label</item>
|
<item>@string/hide_downloaded_episodes_label</item>
|
||||||
<item>@string/hide_not_downloaded_episodes_label</item>
|
<item>@string/hide_not_downloaded_episodes_label</item>
|
||||||
<item>@string/hide_has_media_label</item>
|
<item>@string/hide_has_media_label</item>
|
||||||
|
<item>@string/hide_is_favorite_label</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="episode_filter_values">
|
<string-array name="episode_filter_values">
|
||||||
|
@ -225,6 +226,7 @@
|
||||||
<item>downloaded</item>
|
<item>downloaded</item>
|
||||||
<item>not_downloaded</item>
|
<item>not_downloaded</item>
|
||||||
<item>has_media</item>
|
<item>has_media</item>
|
||||||
|
<item>is_favorite</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="image_cache_size_options">
|
<string-array name="image_cache_size_options">
|
||||||
|
|
|
@ -152,6 +152,7 @@
|
||||||
<string name="hide_downloaded_episodes_label">Downloaded</string>
|
<string name="hide_downloaded_episodes_label">Downloaded</string>
|
||||||
<string name="hide_not_downloaded_episodes_label">Not downloaded</string>
|
<string name="hide_not_downloaded_episodes_label">Not downloaded</string>
|
||||||
<string name="hide_has_media_label">Has media</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="filtered_label">Filtered</string>
|
||||||
<string name="refresh_failed_msg">{fa-exclamation-circle} Last Refresh failed</string>
|
<string name="refresh_failed_msg">{fa-exclamation-circle} Last Refresh failed</string>
|
||||||
<string name="open_podcast">Open Podcast</string>
|
<string name="open_podcast">Open Podcast</string>
|
||||||
|
|
Loading…
Reference in New Issue