1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-29 11:15:51 +00:00

Prevent crash

This commit is contained in:
M66B 2021-01-29 18:08:40 +01:00
parent 3271c04743
commit 804e348c0e

View file

@ -132,14 +132,15 @@ public class FragmentOperations extends FragmentBase {
@NonNull @NonNull
@Override @Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
final View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_delete_operations, null); final Context context = getContext();
final View dview = LayoutInflater.from(context).inflate(R.layout.dialog_delete_operations, null);
final CheckBox cbError = dview.findViewById(R.id.cbError); final CheckBox cbError = dview.findViewById(R.id.cbError);
final CheckBox cbFetch = dview.findViewById(R.id.cbFetch); final CheckBox cbFetch = dview.findViewById(R.id.cbFetch);
final CheckBox cbMove = dview.findViewById(R.id.cbMove); final CheckBox cbMove = dview.findViewById(R.id.cbMove);
final CheckBox cbFlag = dview.findViewById(R.id.cbFlag); final CheckBox cbFlag = dview.findViewById(R.id.cbFlag);
final CheckBox cbDelete = dview.findViewById(R.id.cbDelete); final CheckBox cbDelete = dview.findViewById(R.id.cbDelete);
return new AlertDialog.Builder(getContext()) return new AlertDialog.Builder(context)
.setView(dview) .setView(dview)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override @Override
@ -154,7 +155,7 @@ public class FragmentOperations extends FragmentBase {
new SimpleTask<Integer>() { new SimpleTask<Integer>() {
@Override @Override
protected void onPostExecute(Bundle args) { protected void onPostExecute(Bundle args) {
ToastEx.makeText(getContext(), R.string.title_executing, Toast.LENGTH_LONG).show(); ToastEx.makeText(context, R.string.title_executing, Toast.LENGTH_LONG).show();
} }
@Override @Override
@ -222,7 +223,7 @@ public class FragmentOperations extends FragmentBase {
if (deleted == null) if (deleted == null)
deleted = -1; deleted = -1;
ToastEx.makeText( ToastEx.makeText(
getContext(), context,
getString(R.string.title_delete_operation_deleted, deleted), getString(R.string.title_delete_operation_deleted, deleted),
Toast.LENGTH_LONG).show(); Toast.LENGTH_LONG).show();
} }
@ -236,7 +237,7 @@ public class FragmentOperations extends FragmentBase {
if (sublist != null) if (sublist != null)
list.addAll(sublist); list.addAll(sublist);
} }
}.execute(getContext(), getActivity(), args, "operations:delete"); }.execute(context, getActivity(), args, "operations:delete");
} }
}) })
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null)