diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2022-09-10 12:44:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-10 12:44:57 +0200 |
commit | 54bf4d149fce198d2e926b86f399c84ac3fa3853 (patch) | |
tree | 92daad61f355c5516fdddd5e44d9e4960f48df24 /app | |
parent | 539d0c928d22a534eff08a35f0df1015c190284c (diff) | |
parent | d8ecda1b6297205b678342e6ef42f54e32e7504e (diff) | |
download | AntennaPod-54bf4d149fce198d2e926b86f399c84ac3fa3853.zip |
Merge pull request #6056 from ByteHamster/multi-select-remove-inbox
Multi-select to remove from inbox
Diffstat (limited to 'app')
6 files changed, 47 insertions, 18 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java index fd0a32e03..6849e641b 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java @@ -60,13 +60,15 @@ public class SwipeActionsDialog { switch (tag) { case InboxFragment.TAG: forFragment = context.getString(R.string.inbox_label); - keys = Stream.of(keys).filter(a -> !a.getId().equals(SwipeAction.TOGGLE_PLAYED)).toList(); + keys = Stream.of(keys).filter(a -> !a.getId().equals(SwipeAction.TOGGLE_PLAYED) + && !a.getId().equals(SwipeAction.DELETE)).toList(); break; case AllEpisodesFragment.TAG: forFragment = context.getString(R.string.episodes_label); break; case CompletedDownloadsFragment.TAG: forFragment = context.getString(R.string.downloads_label); + keys = Stream.of(keys).filter(a -> !a.getId().equals(SwipeAction.REMOVE_FROM_INBOX)).toList(); break; case FeedItemlistFragment.TAG: forFragment = context.getString(R.string.feeds_label); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java index 6e993eab6..b781659dc 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java @@ -106,6 +106,7 @@ public class CompletedDownloadsFragment extends Fragment speedDialView.removeActionItemById(R.id.mark_read_batch); speedDialView.removeActionItemById(R.id.mark_unread_batch); speedDialView.removeActionItemById(R.id.remove_from_queue_batch); + speedDialView.removeActionItemById(R.id.remove_all_inbox_item); speedDialView.setOnChangeListener(new SpeedDialView.OnChangeListener() { @Override public boolean onMainActionSelected() { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java index bf8a3e958..87a9516bb 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java @@ -371,6 +371,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem speedDialBinding.fabSD.removeActionItemById(R.id.download_batch); speedDialBinding.fabSD.removeActionItemById(R.id.delete_batch); } + speedDialBinding.fabSD.removeActionItemById(R.id.remove_all_inbox_item); speedDialBinding.fabSD.setVisibility(View.VISIBLE); updateToolbar(); } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index 713cb594f..70378a4a9 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -490,6 +490,7 @@ public class QueueFragment extends Fragment implements Toolbar.OnMenuItemClickLi speedDialView.removeActionItemById(R.id.mark_read_batch); speedDialView.removeActionItemById(R.id.mark_unread_batch); speedDialView.removeActionItemById(R.id.add_to_queue_batch); + speedDialView.removeActionItemById(R.id.remove_all_inbox_item); speedDialView.setOnChangeListener(new SpeedDialView.OnChangeListener() { @Override public boolean onMainActionSelected() { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/actions/EpisodeMultiSelectActionHandler.java b/app/src/main/java/de/danoeh/antennapod/fragment/actions/EpisodeMultiSelectActionHandler.java index 0dc416e0e..0e7c019f1 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/actions/EpisodeMultiSelectActionHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/actions/EpisodeMultiSelectActionHandler.java @@ -35,6 +35,8 @@ public class EpisodeMultiSelectActionHandler { queueChecked(items); } else if (actionId == R.id.remove_from_queue_batch) { removeFromQueueChecked(items); + } else if (actionId == R.id.remove_from_inbox_batch) { + removeFromInboxChecked(items); } else if (actionId == R.id.mark_read_batch) { markedCheckedPlayed(items); } else if (actionId == R.id.mark_unread_batch) { @@ -66,6 +68,17 @@ public class EpisodeMultiSelectActionHandler { showMessage(R.plurals.removed_from_queue_batch_label, checkedIds.length); } + private void removeFromInboxChecked(List<FeedItem> items) { + LongList markUnplayed = new LongList(); + for (FeedItem episode : items) { + if (episode.isNew()) { + markUnplayed.add(episode.getId()); + } + } + DBWriter.markItemPlayed(FeedItem.UNPLAYED, markUnplayed.toArray()); + showMessage(R.plurals.removed_from_inbox_batch_label, markUnplayed.size()); + } + private void markedCheckedPlayed(List<FeedItem> items) { long[] checkedIds = getSelectedIds(items); DBWriter.markItemPlayed(FeedItem.PLAYED, checkedIds); diff --git a/app/src/main/res/menu/episodes_apply_action_speeddial.xml b/app/src/main/res/menu/episodes_apply_action_speeddial.xml index 0ebcb238c..944d2e7c9 100644 --- a/app/src/main/res/menu/episodes_apply_action_speeddial.xml +++ b/app/src/main/res/menu/episodes_apply_action_speeddial.xml @@ -1,34 +1,45 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu + xmlns:android="http://schemas.android.com/apk/res/android"> + <!-- the order is opposite of the typical menu: catered to FAB speed dial, which somehow shows the item in reverse. E.g., item @id/delete_batch is the first in the xml, visually it will be shown at the bottom of the list of actions. --> - <item android:id="@+id/delete_batch" + <item + android:id="@+id/delete_batch" android:icon="@drawable/ic_delete" - android:title="@string/delete_episode_label" - /> - <item android:id="@+id/download_batch" + android:title="@string/delete_episode_label" /> + + <item + android:id="@+id/download_batch" android:icon="@drawable/ic_download" - android:title="@string/download_label" - /> - <item android:id="@+id/mark_unread_batch" + android:title="@string/download_label" /> + + <item + android:id="@+id/mark_unread_batch" android:icon="@drawable/ic_mark_unplayed" - android:title="@string/mark_unread_label" - /> + android:title="@string/mark_unread_label" /> + <item android:id="@+id/mark_read_batch" android:icon="@drawable/ic_mark_played" - android:title="@string/mark_read_label" - /> - <item android:id="@+id/remove_from_queue_batch" + android:title="@string/mark_read_label" /> + + <item + android:id="@+id/remove_from_queue_batch" android:icon="@drawable/ic_playlist_remove" - android:title="@string/remove_from_queue_label" - /> + android:title="@string/remove_from_queue_label" /> + <item android:id="@+id/add_to_queue_batch" android:icon="@drawable/ic_playlist_play" - android:title="@string/add_to_queue_label" - /> + android:title="@string/add_to_queue_label" /> + + <item + android:id="@+id/remove_from_inbox_batch" + android:icon="@drawable/ic_check" + android:title="@string/remove_inbox_label" /> + </menu> |