diff options
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java index 2d6d4cac1..830e9d419 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java @@ -68,8 +68,8 @@ public class FeedMenuHandler { case R.id.refresh_complete_item: DBTasks.refreshCompleteFeed(context, selectedFeed); break; - case R.id.hide_items: - showHideDialog(context, selectedFeed); + case R.id.filter_items: + showFilterDialog(context, selectedFeed); break; case R.id.mark_all_read_item: ConfirmationDialog conDialog = new ConfirmationDialog(context, @@ -110,14 +110,13 @@ public class FeedMenuHandler { return true; } - private static void showHideDialog(final Context context, final Feed feed) { - - final String[] items = context.getResources().getStringArray(R.array.episode_hide_options); - final String[] values = context.getResources().getStringArray(R.array.episode_hide_values); + private static void showFilterDialog(final Context context, final Feed feed) { + final String[] items = context.getResources().getStringArray(R.array.episode_filter_options); + final String[] values = context.getResources().getStringArray(R.array.episode_filter_values); final boolean[] checkedItems = new boolean[items.length]; - final Set<String> hidden = new HashSet<String>(Arrays.asList(feed.getItemFilter().getValues())); - Iterator<String> it = hidden.iterator(); + final Set<String> filter = new HashSet<>(Arrays.asList(feed.getItemFilter().getValues())); + Iterator<String> it = filter.iterator(); while(it.hasNext()) { // make sure we have no empty strings in the filter list if(TextUtils.isEmpty(it.next())) { @@ -126,23 +125,23 @@ public class FeedMenuHandler { } for(int i=0; i < values.length; i++) { String value = values[i]; - if(hidden.contains(value)) { + if(filter.contains(value)) { checkedItems[i] = true; } } AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(R.string.hide_episodes_title); + builder.setTitle(R.string.filter); builder.setMultiChoiceItems(items, checkedItems, (dialog, which, isChecked) -> { if (isChecked) { - hidden.add(values[which]); + filter.add(values[which]); } else { - hidden.remove(values[which]); + filter.remove(values[which]); } }); builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> { - feed.setHiddenItemProperties(hidden.toArray(new String[hidden.size()])); - DBWriter.setFeedItemsFilter(feed.getId(), hidden); + feed.setItemFilter(filter.toArray(new String[filter.size()])); + DBWriter.setFeedItemsFilter(feed.getId(), filter); }); builder.setNegativeButton(R.string.cancel_label, null); builder.create().show(); |