Use a dialog option instead of a checkbox
This commit is contained in:
parent
cfad3fb5de
commit
e4295fb3fa
3 changed files with 3 additions and 21 deletions
|
@ -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;
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="15dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/delete_files_checkbox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/delete_downloaded_files"/>
|
||||
|
||||
</FrameLayout>
|
|
@ -570,7 +570,7 @@
|
|||
<string name="error_timeout">Connection timeout</string>
|
||||
<string name="error_download_resource_gone">Cannot recover this download</string>
|
||||
<string name="clear_finished_download">Clear finished downloads</string>
|
||||
<string name="confirm_prompt">Are you sure?</string>
|
||||
<string name="confirm_prompt">Do you want to clear your download history or delete all downloaded files?</string>
|
||||
<string name="stop">Stop</string>
|
||||
<string name="max_retry_msg">Maximum retries</string>
|
||||
<string name="max_retry_desc">Maximum number of attempts before canceling the download</string>
|
||||
|
|
Loading…
Reference in a new issue