summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2022-05-08 11:46:21 +0200
committerByteHamster <info@bytehamster.com>2022-05-08 21:28:59 +0200
commit850529856a0dfdab701b6720f35f15ee13a090c2 (patch)
tree6a2ef8321725d65045f1883c59380849c70fb825 /app
parent934e2802f8a6f9552489726ef1a43f1476eda233 (diff)
downloadAntennaPod-850529856a0dfdab701b6720f35f15ee13a090c2.zip
Confirm mark as played/unplayed
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/EpisodesListFragment.java60
1 files changed, 41 insertions, 19 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/EpisodesListFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/EpisodesListFragment.java
index 0f75c2fb7..03dbc6ae4 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/EpisodesListFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/EpisodesListFragment.java
@@ -232,31 +232,53 @@ public abstract class EpisodesListFragment extends Fragment implements EpisodeIt
}
});
speedDialView.setOnActionSelectedListener(actionItem -> {
- EpisodeMultiSelectActionHandler handler =
- new EpisodeMultiSelectActionHandler(((MainActivity) getActivity()), actionItem.getId());
- Completable.fromAction(
- () -> {
- handler.handleAction(listAdapter.getSelectedItems());
- if (listAdapter.shouldSelectLazyLoadedItems()) {
- int applyPage = page + 1;
- List<FeedItem> nextPage;
- do {
- nextPage = loadMoreData(applyPage);
- handler.handleAction(nextPage);
- applyPage++;
- } while (nextPage.size() == EPISODES_PER_PAGE);
- }
- })
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(() -> listAdapter.endSelectMode(),
- error -> Log.e(TAG, Log.getStackTraceString(error)));
+ int confirmationString = 0;
+ if (listAdapter.getSelectedItems().size() >= 25 || listAdapter.shouldSelectLazyLoadedItems()) {
+ // Should ask for confirmation
+ if (actionItem.getId() == R.id.mark_read_batch) {
+ confirmationString = R.string.multi_select_mark_played_confirmation;
+ } else if (actionItem.getId() == R.id.mark_unread_batch) {
+ confirmationString = R.string.multi_select_mark_unplayed_confirmation;
+ }
+ }
+ if (confirmationString == 0) {
+ performMultiSelectAction(actionItem.getId());
+ } else {
+ new ConfirmationDialog(getActivity(), R.string.multi_select, confirmationString) {
+ @Override
+ public void onConfirmButtonPressed(DialogInterface dialog) {
+ performMultiSelectAction(actionItem.getId());
+ }
+ }.createNewDialog().show();
+ }
return true;
});
return root;
}
+ private void performMultiSelectAction(int actionItemId) {
+ EpisodeMultiSelectActionHandler handler =
+ new EpisodeMultiSelectActionHandler(((MainActivity) getActivity()), actionItemId);
+ Completable.fromAction(
+ () -> {
+ handler.handleAction(listAdapter.getSelectedItems());
+ if (listAdapter.shouldSelectLazyLoadedItems()) {
+ int applyPage = page + 1;
+ List<FeedItem> nextPage;
+ do {
+ nextPage = loadMoreData(applyPage);
+ handler.handleAction(nextPage);
+ applyPage++;
+ } while (nextPage.size() == EPISODES_PER_PAGE);
+ }
+ })
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(() -> listAdapter.endSelectMode(),
+ error -> Log.e(TAG, Log.getStackTraceString(error)));
+ }
+
private void setupLoadMoreScrollListener() {
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override