Add quick button to delete played downloaded episodes (#7437)

This commit is contained in:
Tony Tam 2024-10-04 12:30:03 -07:00 committed by GitHub
parent a671be2d79
commit 141cbe946c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 0 deletions

View File

@ -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;
}

View File

@ -16,6 +16,11 @@
android:title="@string/downloads_log_label"
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"

View File

@ -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>