Merge pull request #2141 from mfietz/2079-has-media-filter
Add "has media" filter
This commit is contained in:
commit
fcf888237f
|
@ -225,6 +225,9 @@ public class EpisodesApplyActionFragment extends Fragment {
|
|||
checkQueued(false);
|
||||
resId = R.string.selected_not_queued_label;
|
||||
break;
|
||||
case R.id.check_has_media:
|
||||
checkWithMedia();
|
||||
resId = R.string.selected_has_media_label;
|
||||
case R.id.sort_title_a_z:
|
||||
sortByTitle(false);
|
||||
return true;
|
||||
|
@ -357,6 +360,17 @@ public class EpisodesApplyActionFragment extends Fragment {
|
|||
refreshCheckboxes();
|
||||
}
|
||||
|
||||
private void checkWithMedia() {
|
||||
for (FeedItem episode : episodes) {
|
||||
if(episode.hasMedia()) {
|
||||
checkedIds.add(episode.getId());
|
||||
} else {
|
||||
checkedIds.remove(episode.getId());
|
||||
}
|
||||
}
|
||||
refreshCheckboxes();
|
||||
}
|
||||
|
||||
private void refreshTitles() {
|
||||
titles.clear();
|
||||
for(FeedItem episode : episodes) {
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
android:title="@string/queued_label"/>
|
||||
<item android:id="@+id/check_not_queued"
|
||||
android:title="@string/not_queued_label"/>
|
||||
<item android:id="@+id/check_has_media"
|
||||
android:title="@string/has_media"/>
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ public class FeedItemFilter {
|
|||
private boolean showNotQueued = false;
|
||||
private boolean showDownloaded = false;
|
||||
private boolean showNotDownloaded = false;
|
||||
private boolean showHasMedia = false;
|
||||
|
||||
public FeedItemFilter(String properties) {
|
||||
this(TextUtils.split(properties, ","));
|
||||
|
@ -49,6 +50,9 @@ public class FeedItemFilter {
|
|||
case "not_downloaded":
|
||||
showNotDownloaded = true;
|
||||
break;
|
||||
case "has_media":
|
||||
showHasMedia = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +86,8 @@ public class FeedItemFilter {
|
|||
if (showDownloaded && !downloaded) continue;
|
||||
if (showNotDownloaded && downloaded) continue;
|
||||
|
||||
if (showHasMedia && !item.hasMedia()) continue;
|
||||
|
||||
// If the item reaches here, it meets all criteria
|
||||
result.add(item);
|
||||
}
|
||||
|
|
|
@ -185,6 +185,7 @@
|
|||
<item>@string/hide_not_queued_episodes_label</item>
|
||||
<item>@string/hide_downloaded_episodes_label</item>
|
||||
<item>@string/hide_not_downloaded_episodes_label</item>
|
||||
<item>@string/hide_has_media_label</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="episode_filter_values">
|
||||
|
@ -195,6 +196,7 @@
|
|||
<item>not_queued</item>
|
||||
<item>downloaded</item>
|
||||
<item>not_downloaded</item>
|
||||
<item>has_media</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="image_cache_size_options">
|
||||
|
|
|
@ -131,6 +131,7 @@
|
|||
<string name="hide_not_queued_episodes_label">Not queued</string>
|
||||
<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="filtered_label">Filtered</string>
|
||||
<string name="refresh_failed_msg">{fa-exclamation-circle} Last Refresh failed</string>
|
||||
<string name="open_podcast">Open Podcast</string>
|
||||
|
@ -587,6 +588,8 @@
|
|||
<string name="selected_queued_label">Selected queued Episodes</string>
|
||||
<string name="not_queued_label">Not queued</string>
|
||||
<string name="selected_not_queued_label">Selected not queued Episodes</string>
|
||||
<string name="has_media">Has media</string>
|
||||
<string name="selected_has_media_label">Selected episodes with media</string>
|
||||
|
||||
<!-- Sort -->
|
||||
<string name="sort_title_a_z">Title (A \u2192 Z)</string>
|
||||
|
|
Loading…
Reference in New Issue