Use a dialog option instead of a checkbox

This commit is contained in:
Kamil Szczęk 2019-12-13 11:48:01 +01:00
parent cfad3fb5de
commit e4295fb3fa
3 changed files with 3 additions and 21 deletions

View file

@ -190,14 +190,10 @@ public class MissionsFragment extends Fragment {
return true;
case R.id.clear_list:
AlertDialog.Builder prompt = new AlertDialog.Builder(mContext);
View checkBoxView = View.inflate(this.getContext(), R.layout.delete_files_checkbox, null);
prompt.setTitle(R.string.clear_finished_download);
prompt.setMessage(R.string.confirm_prompt);
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.setPositiveButton(R.string.clear_finished_download, (dialog, which) -> mAdapter.clearFinishedDownloads(false));
prompt.setNeutralButton(R.string.delete_downloaded_files, (dialog, which) -> mAdapter.clearFinishedDownloads(true));
prompt.setNegativeButton(R.string.cancel, null);
prompt.create().show();
return true;