diff --git a/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java b/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java index 8420e343b..e20417aa9 100644 --- a/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java +++ b/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java @@ -19,6 +19,7 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.webkit.MimeTypeMap; +import android.widget.CheckBox; import android.widget.ImageView; import android.widget.PopupMenu; import android.widget.TextView; @@ -557,7 +558,16 @@ public class MissionAdapter extends Adapter implements Handler.Callb ); } - public void clearFinishedDownloads() { + public void clearFinishedDownloads(boolean delete) { + if (delete && mIterator.hasFinishedMissions()) { + for(int i=0; i mAdapter.clearFinishedDownloads()); + prompt.setView(checkBoxView); + prompt.setPositiveButton(android.R.string.ok, (dialog, which) -> { + CheckBox checkBox = checkBoxView.findViewById(R.id.delete_files_checkbox); + mAdapter.clearFinishedDownloads(checkBox.isChecked()); + }); prompt.setNegativeButton(R.string.cancel, null); prompt.create().show(); return true; diff --git a/app/src/main/res/layout/delete_files_checkbox.xml b/app/src/main/res/layout/delete_files_checkbox.xml new file mode 100644 index 000000000..cbc6ecd10 --- /dev/null +++ b/app/src/main/res/layout/delete_files_checkbox.xml @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 54ae40d1d..d3899583b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -587,5 +587,5 @@ Use SAF The Storage Access Framework allows downloads to an external SD card.\nNote: some devices are not compatible Choose an instance - + Delete downloaded files