Use dialog fragment for unexpected errors

pull/157/head
M66B 6 years ago
parent b855358169
commit 9f5a829206

@ -195,7 +195,7 @@ abstract class ActivityBilling extends ActivityBase implements PurchasesUpdatedL
}
} catch (NoSuchAlgorithmException ex) {
Log.e(ex);
Helper.unexpectedError(this, this, ex);
Helper.unexpectedError(getSupportFragmentManager(), ex);
}
}

@ -105,7 +105,7 @@ public class ActivityDSN extends ActivityBase {
if (ex instanceof IllegalArgumentException)
Snackbar.make(findViewById(android.R.id.content), ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(ActivityDSN.this, ActivityDSN.this, ex);
Helper.unexpectedError(getSupportFragmentManager(), ex);
}
}.execute(this, args, "disposition:decode");
}

@ -157,7 +157,7 @@ public class ActivityEml extends ActivityBase {
if (ex instanceof IllegalArgumentException)
Snackbar.make(findViewById(android.R.id.content), ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(ActivityEml.this, ActivityEml.this, ex);
Helper.unexpectedError(getSupportFragmentManager(), ex);
}
}.execute(this, args, "eml:decode");
}

@ -89,7 +89,7 @@ public class ActivityMain extends AppCompatActivity implements FragmentManager.O
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(ActivityMain.this, ActivityMain.this, ex);
Helper.unexpectedError(getSupportFragmentManager(), ex);
}
}.execute(this, new Bundle(), "main:accounts");
} else {

@ -378,7 +378,7 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
try {
askPassword(true);
} catch (Throwable ex) {
Helper.unexpectedError(this, this, ex);
Helper.unexpectedError(getSupportFragmentManager(), ex);
}
}
@ -386,7 +386,7 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
try {
askPassword(false);
} catch (Throwable ex) {
Helper.unexpectedError(this, this, ex);
Helper.unexpectedError(getSupportFragmentManager(), ex);
}
}
@ -451,7 +451,7 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(ActivitySetup.this, ActivitySetup.this, ex);
Helper.unexpectedError(getSupportFragmentManager(), ex);
}
}.execute(this, new Bundle(), "cleanup:run");
}
@ -620,7 +620,7 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(ActivitySetup.this, ActivitySetup.this, ex);
Helper.unexpectedError(getSupportFragmentManager(), ex);
}
}.execute(this, args, "setup:export");
}
@ -898,7 +898,7 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
else if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(ActivitySetup.this, ActivitySetup.this, ex);
Helper.unexpectedError(getSupportFragmentManager(), ex);
}
}.execute(this, args, "setup:import");
}
@ -1061,7 +1061,7 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
else {
if (!export || password1.equals(password2)) {
((ActivitySetup) getActivity()).password = password1;
getActivity().startActivityForResult(
startActivityForResult(
Helper.getChooser(getContext(),
export ? getIntentExport() : getIntentImport()),
export ? REQUEST_EXPORT : REQUEST_IMPORT);

@ -729,7 +729,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
if (ex instanceof IllegalArgumentException || ex instanceof IOException)
Toast.makeText(ActivityView.this, ex.getMessage(), Toast.LENGTH_LONG).show();
else
Helper.unexpectedError(ActivityView.this, ActivityView.this, ex);
Helper.unexpectedError(getSupportFragmentManager(), ex);
}
}.execute(this, args, "update:check");
}
@ -780,9 +780,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(ActivityView.this, ActivityView.this, ex);
Helper.unexpectedError(getSupportFragmentManager(), ex);
}
}.execute(this, args, "menu:inbox");
}.execute(this, args, "menu:outbox");
}
private void onMenuOperations() {

@ -256,7 +256,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "account:enable");
}

@ -154,7 +154,7 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "rule:enable");
}
@ -166,7 +166,7 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
}
}
AdapterAnswer(Fragment parentFragment) {
AdapterAnswer(final Fragment parentFragment) {
this.parentFragment = parentFragment;
this.context = parentFragment.getContext();
@ -199,7 +199,7 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(AdapterAnswer.this.context, AdapterAnswer.this.owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, new Bundle(), "answer:composable");
}

@ -185,7 +185,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "attachment:delete");
}
@ -265,7 +265,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "attachment:fetch");
}

@ -189,7 +189,7 @@ public class AdapterContact extends RecyclerView.Adapter<AdapterContact.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "contact:state");
}
@ -223,7 +223,7 @@ public class AdapterContact extends RecyclerView.Adapter<AdapterContact.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "contact:delete");

@ -333,7 +333,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "folder:collapse");
}
@ -519,7 +519,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "folder:enable");
}

@ -199,7 +199,7 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "identitty:enable");
}

@ -174,7 +174,7 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "image:fetch");
}

@ -750,7 +750,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, aargs, "message:avatar");
} else
@ -1086,7 +1086,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, sargs, "message:actions");
@ -1222,7 +1222,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:calendar");
}
@ -1349,7 +1349,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:participation");
}
@ -1470,7 +1470,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:seen");
}
@ -1546,7 +1546,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:flag");
}
@ -1591,7 +1591,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:search");
}
@ -1771,7 +1771,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:attachment:download");
}
@ -1893,7 +1893,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:full");
}
@ -2018,7 +2018,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "show:images");
}
@ -2149,7 +2149,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
};
@ -2340,7 +2340,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:unseen");
}
@ -2373,7 +2373,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:delete");
}
@ -2428,7 +2428,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:share");
}
@ -2480,7 +2480,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:keywords");
}
@ -2537,7 +2537,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:share");
}
@ -2601,7 +2601,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:headers");
} else
@ -2639,7 +2639,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:raw");
} else {
@ -2830,7 +2830,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:move:draft");
}
@ -2914,7 +2914,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "message:reply");
}
@ -2979,7 +2979,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, new Bundle(), "message:answer");
}
@ -3727,7 +3727,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getActivity(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(getContext(), getActivity(), args, "message:keywords:manage");
}
@ -3791,7 +3791,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getActivity(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(getContext(), getActivity(), args, "message:keyword:add");
}

@ -144,7 +144,7 @@ public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.View
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "operation:open:folder");
} else {
@ -171,7 +171,7 @@ public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.View
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "operation:open:message");
}
@ -204,7 +204,7 @@ public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.View
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "operation:delete");

@ -218,7 +218,7 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "rule:enable");
}
@ -273,7 +273,7 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
}
}.execute(context, owner, args, "rule:execute");
}

@ -439,7 +439,7 @@ public class FragmentAccount extends FragmentBase {
if (ex instanceof IllegalArgumentException || ex instanceof UnknownHostException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentAccount.this, args, "account:config");
}
@ -1175,7 +1175,7 @@ public class FragmentAccount extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentAccount.this, new Bundle(), "account:primary");
} else {
@ -1221,14 +1221,14 @@ public class FragmentAccount extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentAccount.this, args, "account:folders");
}
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "account:get");
}
@ -1291,7 +1291,7 @@ public class FragmentAccount extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentAccount.this, args, "account:delete");
}

@ -138,7 +138,7 @@ public class FragmentAccounts extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentAccounts.this, args, "account:drafts");

@ -137,7 +137,7 @@ public class FragmentAnswer extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "answer:get");
}
@ -176,7 +176,7 @@ public class FragmentAnswer extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentAnswer.this, args, "answer:delete");
}
@ -235,7 +235,7 @@ public class FragmentAnswer extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "answer:save");
}

@ -626,7 +626,7 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentCompose.this, args, "compose:refedit");
}
@ -1079,7 +1079,7 @@ public class FragmentCompose extends FragmentBase {
if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
else {
Snackbar snackbar = Snackbar.make(view, R.string.title_no_openpgp, Snackbar.LENGTH_LONG);
@ -1248,7 +1248,7 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "compose:picked");
}
@ -1291,7 +1291,7 @@ public class FragmentCompose extends FragmentBase {
if (ex instanceof SecurityException)
handleFileShare();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "compose:attachment:add");
}
@ -1487,7 +1487,7 @@ public class FragmentCompose extends FragmentBase {
null, 0, 0, 0, null);
} catch (IntentSender.SendIntentException ex) {
Log.e(ex);
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}
@ -1496,7 +1496,7 @@ public class FragmentCompose extends FragmentBase {
if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "compose:encrypt");
}
@ -1544,7 +1544,7 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentCompose.this, args, "compose:send:after");
}
@ -1640,7 +1640,7 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(getContext(), getViewLifecycleOwner(), args, "compose:picked");
}
@ -2254,7 +2254,7 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentCompose.this, new Bundle(), "compose:identities");
@ -2324,7 +2324,7 @@ public class FragmentCompose extends FragmentBase {
else if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
};
@ -2719,7 +2719,7 @@ public class FragmentCompose extends FragmentBase {
else if (ex instanceof IllegalArgumentException || ex instanceof AddressException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
String getActionName(int id) {
@ -2773,7 +2773,7 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "compose:check");
}
@ -2796,7 +2796,7 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentCompose.this, args, "compose:show");
}
@ -2925,7 +2925,7 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentCompose.this, args, "compose:show");
}
@ -2997,7 +2997,7 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentCompose.this, args, "compose:cid:" + source);
}
@ -3332,7 +3332,7 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getActivity(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(getContext(), getActivity(), new Bundle(), "compose:answer");
@ -3340,7 +3340,7 @@ public class FragmentCompose extends FragmentBase {
.setAdapter(adapter, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
dismiss();
EntityAnswer answer = adapter.getItem(which);
String text = EntityAnswer.replacePlaceholders(

@ -205,7 +205,7 @@ public class FragmentContacts extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getActivity(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(getContext(), getActivity(), new Bundle(), "contacts:delete");
}

@ -97,7 +97,7 @@ public class FragmentDialogFolder extends DialogFragment {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getActivity(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(getContext(), getActivity(), args, "folder:select");

@ -232,7 +232,7 @@ public class FragmentFolder extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "folder:get");
}
@ -313,7 +313,7 @@ public class FragmentFolder extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "folder:subscribe");
}
@ -510,7 +510,7 @@ public class FragmentFolder extends FragmentBase {
if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentFolder.this, args, "folder:save");
}
@ -553,7 +553,7 @@ public class FragmentFolder extends FragmentBase {
if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentFolder.this, args, "folder:delete");
}

@ -203,7 +203,7 @@ public class FragmentFolders extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentFolders.this, new Bundle(), "folders:drafts");
@ -363,7 +363,7 @@ public class FragmentFolders extends FragmentBase {
} else if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "folders:refresh");
}
@ -516,7 +516,7 @@ public class FragmentFolders extends FragmentBase {
} else if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "folder:sync");
}
@ -541,7 +541,7 @@ public class FragmentFolders extends FragmentBase {
@Override
public void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "folder:delete:local");
}
@ -576,7 +576,7 @@ public class FragmentFolders extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "folder:delete");
}

@ -468,7 +468,7 @@ public class FragmentIdentity extends FragmentBase {
if (ex instanceof IllegalArgumentException || ex instanceof UnknownHostException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentIdentity.this, args, "identity:config");
}
@ -890,7 +890,7 @@ public class FragmentIdentity extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentIdentity.this, new Bundle(), "identity:count");
} else {
@ -973,14 +973,14 @@ public class FragmentIdentity extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentIdentity.this, args, "identity:accounts:get");
}
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "identity:get");
}
@ -1043,7 +1043,7 @@ public class FragmentIdentity extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentIdentity.this, args, "identity:delete");
}

@ -635,7 +635,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentMessages.this, args, "messages:move");
}
@ -694,7 +694,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentMessages.this, args, "messages:drafts");
@ -755,7 +755,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentMessages.this, args, "messages:search");
} else
@ -1048,7 +1048,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
} else if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "messages:refresh");
}
@ -1167,7 +1167,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentMessages.this, args, "messages:move");
}
@ -1432,7 +1432,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentMessages.this, args, "messages:swipe");
}
@ -1617,7 +1617,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "messages:more");
}
@ -1670,7 +1670,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "messages:seen");
}
@ -1725,7 +1725,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "messages:flag");
}
@ -1784,7 +1784,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "messages:delete:ask");
}
@ -1850,7 +1850,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "messages:move");
}
@ -1913,7 +1913,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "messages:move");
}
@ -2302,7 +2302,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentMessages.this, args, "messages:accounts");
return true;
@ -2541,7 +2541,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "messages:all");
}
@ -2637,7 +2637,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, new Bundle(), "search:reset");
} else
@ -2907,7 +2907,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "messages:navigation");
}
@ -2954,7 +2954,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "messages:expand");
}
@ -3019,7 +3019,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "messages:navigate");
}
@ -3078,7 +3078,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "messages:move");
}
@ -3113,7 +3113,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentMessages.this, args, "messages:undo");
}
@ -3461,7 +3461,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "raw:save");
}
@ -3534,7 +3534,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "attachment:save");
}
@ -3607,7 +3607,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "attachments:save");
}
@ -3779,7 +3779,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
null, 0, 0, 0, null);
} catch (IntentSender.SendIntentException ex) {
Log.e(ex);
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}
@ -3788,7 +3788,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "decrypt");
}
@ -3837,7 +3837,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "message:delete");
}
@ -3873,7 +3873,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "messages:delete:execute");
}
@ -3908,7 +3908,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "message:junk");
}
@ -3967,7 +3967,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "message:color");
}
@ -4021,7 +4021,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "message:snooze");
}
@ -4075,7 +4075,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "messages:snooze");
}
@ -4111,7 +4111,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "message:copy");
}
@ -4222,7 +4222,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "message:print");
}
@ -4318,8 +4318,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
final View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_error_reporting, null);
final Button btnInfo = dview.findViewById(R.id.btnInfo);
final CheckBox cbNotAgain = dview.findViewById(R.id.cbNotAgain);
@ -4343,6 +4341,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
prefs.edit().putBoolean("crash_reports", true).apply();
if (cbNotAgain.isChecked())
prefs.edit().putBoolean("crash_reports_asked", true).apply();
@ -4352,8 +4351,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (cbNotAgain.isChecked())
if (cbNotAgain.isChecked()) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
prefs.edit().putBoolean("crash_reports_asked", true).apply();
}
}
})
.create();

@ -169,7 +169,7 @@ public class FragmentOperations extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(getContext(), getActivity(), new Bundle(), "operations:delete");
}

@ -116,7 +116,7 @@ public class FragmentOrder extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, new Bundle(), "order:accounts");
else if (TupleFolderSort.class.getName().equals(clazz))
@ -142,7 +142,7 @@ public class FragmentOrder extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, new Bundle(), "order:folders");
else
@ -218,8 +218,7 @@ public class FragmentOrder extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(getContext(), getViewLifecycleOwner(), args, "order:set");

@ -406,7 +406,7 @@ public class FragmentRule extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "rule:accounts");
}
@ -454,7 +454,7 @@ public class FragmentRule extends FragmentBase {
etRecipient.setText(cursor.getString(0));
} catch (Throwable ex) {
Log.e(ex);
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}
@ -571,7 +571,7 @@ public class FragmentRule extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentRule.this, rargs, "rule:get");
}
@ -610,7 +610,7 @@ public class FragmentRule extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(FragmentRule.this, args, "rule:delete");
}
@ -691,7 +691,7 @@ public class FragmentRule extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "rule:check");
} catch (JSONException ex) {
@ -792,7 +792,7 @@ public class FragmentRule extends FragmentBase {
if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "rule:save");
} catch (JSONException ex) {

@ -244,7 +244,7 @@ public class FragmentSetup extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, new Bundle(), "outbox:create");

@ -19,6 +19,7 @@ package eu.faircode.email;
Copyright 2018-2019 by Marcel Bokhorst (M66B)
*/
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
@ -51,11 +52,14 @@ import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.exifinterface.media.ExifInterface;
import androidx.lifecycle.Lifecycle;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.LifecycleOwner;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager;
@ -207,7 +211,7 @@ public class Helper {
Toast.makeText(context, context.getString(R.string.title_no_viewer, uri.toString()), Toast.LENGTH_LONG).show();
} catch (Throwable ex) {
Log.e(ex);
unexpectedError(context, owner, ex);
Toast.makeText(context, Helper.formatThrowable(ex, false), Toast.LENGTH_LONG).show();
}
}
}
@ -434,15 +438,31 @@ public class Helper {
return sb.toString();
}
static void unexpectedError(final Context context, final LifecycleOwner owner, final Throwable ex) {
if (owner.getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
new DialogBuilderLifecycle(context, owner)
static void unexpectedError(FragmentManager manager, final Throwable ex) {
Bundle args = new Bundle();
args.putSerializable("ex", ex);
FragmentDialogUnexpected fragment = new FragmentDialogUnexpected();
fragment.setArguments(args);
fragment.show(manager, "error:unexpected");
}
public static class FragmentDialogUnexpected extends DialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
final Throwable ex = (Throwable) getArguments().getSerializable("ex");
return new AlertDialog.Builder(getContext())
.setTitle(R.string.title_unexpected_error)
.setMessage(ex.toString())
.setMessage(Helper.formatThrowable(ex, false))
.setPositiveButton(android.R.string.cancel, null)
.setNeutralButton(R.string.title_report, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Dialog will be dismissed
final Context context = getContext();
new SimpleTask<Long>() {
@Override
protected Long onExecute(Context context, Bundle args) throws Throwable {
@ -451,25 +471,24 @@ public class Helper {
@Override
protected void onExecuted(Bundle args, Long id) {
context.startActivity(
new Intent(context, ActivityCompose.class)
.putExtra("action", "edit")
.putExtra("id", id));
context.startActivity(new Intent(context, ActivityCompose.class)
.putExtra("action", "edit")
.putExtra("id", id));
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.e(ex);
if (ex instanceof IllegalArgumentException)
Toast.makeText(context, ex.getMessage(), Toast.LENGTH_LONG).show();
else
Toast.makeText(context, ex.toString(), Toast.LENGTH_LONG).show();
}
}.execute(context, owner, new Bundle(), "error:unexpected");
}.execute(context, getActivity(), new Bundle(), "error:unexpected");
}
})
.show();
else
ApplicationEx.writeCrashLog(context, ex);
.create();
}
}
// Files

@ -33,6 +33,7 @@ import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.text.TextUtils;
import android.widget.Toast;
import androidx.lifecycle.LifecycleOwner;
@ -99,7 +100,7 @@ public class Shortcuts {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
Toast.makeText(context, Helper.formatThrowable(ex, false), Toast.LENGTH_LONG).show();
}
}.execute(context, owner, new Bundle(), "shortcuts:update");
}

Loading…
Cancel
Save