summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Tam <149837+tonytamsf@users.noreply.github.com>2024-10-04 12:30:03 -0700
committerGitHub <noreply@github.com>2024-10-04 21:30:03 +0200
commit141cbe946c7ee1b21a55391bec5a1f008d90c221 (patch)
tree03d0ac797d8f83bffaabb1ab07570c55f31c12c4
parenta671be2d792a4a5951993af437950d41fb88fc7b (diff)
downloadAntennaPod-141cbe946c7ee1b21a55391bec5a1f008d90c221.zip
Add quick button to delete played downloaded episodes (#7437)
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/download/CompletedDownloadsFragment.java19
-rw-r--r--app/src/main/res/menu/downloads_completed.xml5
-rw-r--r--ui/i18n/src/main/res/values/strings.xml2
3 files changed, 26 insertions, 0 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/download/CompletedDownloadsFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/download/CompletedDownloadsFragment.java
index cd7681bf9..27bd0ccb4 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/download/CompletedDownloadsFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/download/CompletedDownloadsFragment.java
@@ -1,5 +1,6 @@
package de.danoeh.antennapod.ui.screen.download;
+import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
import android.view.ContextMenu;
@@ -18,6 +19,7 @@ import com.google.android.material.snackbar.Snackbar;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.event.FeedUpdateRunningEvent;
+import de.danoeh.antennapod.ui.common.ConfirmationDialog;
import de.danoeh.antennapod.ui.episodeslist.EpisodeItemListAdapter;
import de.danoeh.antennapod.actionbutton.DeleteActionButton;
import de.danoeh.antennapod.event.DownloadLogEvent;
@@ -182,6 +184,23 @@ public class CompletedDownloadsFragment extends Fragment
} else if (item.getItemId() == R.id.downloads_sort) {
new DownloadsSortDialog().show(getChildFragmentManager(), "SortDialog");
return true;
+ } else if (item.getItemId() == R.id.action_delete_downloads_played) {
+ ConfirmationDialog dialog = new ConfirmationDialog(getActivity(),
+ R.string.delete_downloads_played, R.string.delete_downloads_played_confirmation) {
+ @Override
+ public void onConfirmButtonPressed(DialogInterface clickedDialog) {
+ clickedDialog.dismiss();
+ Observable.fromCallable(() -> DBReader.getEpisodes(0, Integer.MAX_VALUE,
+ new FeedItemFilter(FeedItemFilter.DOWNLOADED, FeedItemFilter.INCLUDE_NOT_SUBSCRIBED,
+ FeedItemFilter.PLAYED), SortOrder.DATE_OLD_NEW))
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(items -> new EpisodeMultiSelectActionHandler(getActivity(), R.id.remove_item)
+ .handleAction(items), error -> Log.e(TAG, Log.getStackTraceString(error)));
+ }
+ };
+ dialog.createNewDialog().show();
+ return true;
}
return false;
}
diff --git a/app/src/main/res/menu/downloads_completed.xml b/app/src/main/res/menu/downloads_completed.xml
index a7753d080..c2c08f75a 100644
--- a/app/src/main/res/menu/downloads_completed.xml
+++ b/app/src/main/res/menu/downloads_completed.xml
@@ -17,6 +17,11 @@
custom:showAsAction="always" />
<item
+ android:id="@+id/action_delete_downloads_played"
+ android:title="@string/delete_downloads_played"
+ custom:showAsAction="never" />
+
+ <item
android:id="@+id/refresh_item"
android:title="@string/refresh_label"
android:menuCategory="container"
diff --git a/ui/i18n/src/main/res/values/strings.xml b/ui/i18n/src/main/res/values/strings.xml
index 70628a198..1aa93c312 100644
--- a/ui/i18n/src/main/res/values/strings.xml
+++ b/ui/i18n/src/main/res/values/strings.xml
@@ -216,6 +216,8 @@
<string name="rename_tag_label">Rename tag</string>
<string name="confirm_mobile_feed_refresh_dialog_message">Refreshing podcasts over mobile data connection is disabled in the settings.\n\nDo you want to refresh anyway?</string>
<string name="confirm_mobile_feed_refresh_dialog_message_vpn">Your VPN app pretends to be a mobile network (metered connection). Refreshing podcasts over mobile data connection is disabled in the settings.\n\nDo you want to refresh anyway? If you want this problem to be fixed, contact the creators of your VPN app.</string>
+ <string name="delete_downloads_played">Delete played</string>
+ <string name="delete_downloads_played_confirmation">Please confirm that you want to delete all played downloads.</string>
<!-- actions on feeditems -->
<string name="download_label">Download</string>