diff options
author | André <1729839+andre-m-dev@users.noreply.github.com> | 2024-06-18 22:57:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-18 22:57:54 +0200 |
commit | ee3c1646f3e98b41e1092bf8aa95a1ff436fdba7 (patch) | |
tree | e7f16dfe9ffa684161c850e470e23dad69c9e1cf | |
parent | 8da45100d400eb4fa14ae12f9806e971be02587c (diff) | |
download | AntennaPod-ee3c1646f3e98b41e1092bf8aa95a1ff436fdba7.zip |
Add "Remove all from inbox" to subscription overflow menu (#7252)
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemlistFragment.java | 19 | ||||
-rw-r--r-- | app/src/main/res/menu/feedlist.xml | 9 |
2 files changed, 27 insertions, 1 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemlistFragment.java index fbfb9fa0a..2c8be5390 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemlistFragment.java @@ -12,6 +12,7 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; +import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.content.res.AppCompatResources; @@ -22,6 +23,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; import com.google.android.material.appbar.MaterialToolbar; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.snackbar.Snackbar; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; @@ -257,6 +259,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem viewBinding.toolbar.getMenu().findItem(R.id.refresh_item).setVisible(false); viewBinding.toolbar.getMenu().findItem(R.id.rename_item).setVisible(false); viewBinding.toolbar.getMenu().findItem(R.id.remove_feed).setVisible(false); + viewBinding.toolbar.getMenu().findItem(R.id.remove_all_inbox_item).setVisible(false); viewBinding.toolbar.getMenu().findItem(R.id.action_search).setVisible(false); } } @@ -303,6 +306,8 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem // Make sure fragment is hidden before actually starting to delete getActivity().getSupportFragmentManager().executePendingTransactions(); }); + } else if (item.getItemId() == R.id.remove_all_inbox_item) { + showRemoveAllDialog(); } else if (item.getItemId() == R.id.action_search) { ((MainActivity) getActivity()).loadChildFragment(SearchFragment.newInstance(feed.getId(), feed.getTitle())); } else { @@ -555,6 +560,20 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem } } + private void showRemoveAllDialog() { + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext()); + builder.setTitle(R.string.remove_all_inbox_label); + builder.setMessage(R.string.remove_all_inbox_confirmation_msg); + + builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> { + dialog.dismiss(); + DBWriter.removeFeedNewFlag(feedID); + ((MainActivity) getActivity()).showSnackbarAbovePlayer(R.string.removed_all_inbox_msg, Toast.LENGTH_SHORT); + }); + builder.setNegativeButton(R.string.cancel_label, null); + builder.show(); + } + private void loadFeedImage() { Glide.with(this) .load(feed.getImageUrl()) diff --git a/app/src/main/res/menu/feedlist.xml b/app/src/main/res/menu/feedlist.xml index 0baf434f1..92a426b90 100644 --- a/app/src/main/res/menu/feedlist.xml +++ b/app/src/main/res/menu/feedlist.xml @@ -43,6 +43,13 @@ android:title="@string/share_label" /> <item + android:id="@+id/remove_all_inbox_item" + android:title="@string/remove_all_inbox_label" + android:menuCategory="container" + custom:showAsAction="collapseActionView" + android:icon="@drawable/ic_check"/> + + <item android:id="@+id/rename_item" android:menuCategory="container" android:title="@string/rename_feed_label" @@ -57,4 +64,4 @@ custom:showAsAction="collapseActionView"> </item> -</menu>
\ No newline at end of file +</menu> |