From 141cbe946c7ee1b21a55391bec5a1f008d90c221 Mon Sep 17 00:00:00 2001 From: Tony Tam <149837+tonytamsf@users.noreply.github.com> Date: Fri, 4 Oct 2024 12:30:03 -0700 Subject: [PATCH] Add quick button to delete played downloaded episodes (#7437) --- .../download/CompletedDownloadsFragment.java | 19 +++++++++++++++++++ app/src/main/res/menu/downloads_completed.xml | 5 +++++ ui/i18n/src/main/res/values/strings.xml | 2 ++ 3 files changed, 26 insertions(+) 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 @@ -16,6 +16,11 @@ android:title="@string/downloads_log_label" custom:showAsAction="always" /> + + Rename tag Refreshing podcasts over mobile data connection is disabled in the settings.\n\nDo you want to refresh anyway? 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. + Delete played + Please confirm that you want to delete all played downloads. Download