Add quick button to delete played downloaded episodes (#7437)
This commit is contained in:
parent
a671be2d79
commit
141cbe946c
|
@ -1,5 +1,6 @@
|
||||||
package de.danoeh.antennapod.ui.screen.download;
|
package de.danoeh.antennapod.ui.screen.download;
|
||||||
|
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
|
@ -18,6 +19,7 @@ import com.google.android.material.snackbar.Snackbar;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.event.FeedUpdateRunningEvent;
|
import de.danoeh.antennapod.event.FeedUpdateRunningEvent;
|
||||||
|
import de.danoeh.antennapod.ui.common.ConfirmationDialog;
|
||||||
import de.danoeh.antennapod.ui.episodeslist.EpisodeItemListAdapter;
|
import de.danoeh.antennapod.ui.episodeslist.EpisodeItemListAdapter;
|
||||||
import de.danoeh.antennapod.actionbutton.DeleteActionButton;
|
import de.danoeh.antennapod.actionbutton.DeleteActionButton;
|
||||||
import de.danoeh.antennapod.event.DownloadLogEvent;
|
import de.danoeh.antennapod.event.DownloadLogEvent;
|
||||||
|
@ -182,6 +184,23 @@ public class CompletedDownloadsFragment extends Fragment
|
||||||
} else if (item.getItemId() == R.id.downloads_sort) {
|
} else if (item.getItemId() == R.id.downloads_sort) {
|
||||||
new DownloadsSortDialog().show(getChildFragmentManager(), "SortDialog");
|
new DownloadsSortDialog().show(getChildFragmentManager(), "SortDialog");
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,11 @@
|
||||||
android:title="@string/downloads_log_label"
|
android:title="@string/downloads_log_label"
|
||||||
custom:showAsAction="always" />
|
custom:showAsAction="always" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_delete_downloads_played"
|
||||||
|
android:title="@string/delete_downloads_played"
|
||||||
|
custom:showAsAction="never" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/refresh_item"
|
android:id="@+id/refresh_item"
|
||||||
android:title="@string/refresh_label"
|
android:title="@string/refresh_label"
|
||||||
|
|
|
@ -216,6 +216,8 @@
|
||||||
<string name="rename_tag_label">Rename tag</string>
|
<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">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="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 -->
|
<!-- actions on feeditems -->
|
||||||
<string name="download_label">Download</string>
|
<string name="download_label">Download</string>
|
||||||
|
|
Loading…
Reference in New Issue