mirror of https://github.com/M66B/FairEmail.git
Lifecycle aware unexpected error handling
This commit is contained in:
parent
1d2ee534a7
commit
2665c33f68
|
@ -138,7 +138,7 @@ abstract class ActivityBilling extends ActivityBase implements PurchasesUpdatedL
|
|||
if (responseCode != BillingClient.BillingResponse.OK)
|
||||
Snackbar.make(getView(), text, Snackbar.LENGTH_LONG).show();
|
||||
} else
|
||||
Helper.view(this, getIntentPro());
|
||||
Helper.view(this, this, getIntentPro());
|
||||
}
|
||||
|
||||
private void onActivatePro(Intent intent) {
|
||||
|
@ -160,7 +160,7 @@ abstract class ActivityBilling extends ActivityBase implements PurchasesUpdatedL
|
|||
}
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
Log.e(Helper.TAG, Log.getStackTraceString(ex));
|
||||
Helper.unexpectedError(this, ex);
|
||||
Helper.unexpectedError(this, this, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -419,7 +419,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(ActivityView.this, ex);
|
||||
Helper.unexpectedError(ActivityView.this, ActivityView.this, ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
} else {
|
||||
|
@ -581,7 +581,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(ActivityView.this, ex);
|
||||
Helper.unexpectedError(ActivityView.this, ActivityView.this, ex);
|
||||
}
|
||||
}.load(this, new Bundle());
|
||||
}
|
||||
|
@ -665,7 +665,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Helper.view(ActivityView.this, update);
|
||||
Helper.view(ActivityView.this, ActivityView.this, update);
|
||||
}
|
||||
})
|
||||
.show();
|
||||
|
@ -674,7 +674,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
if (BuildConfig.DEBUG)
|
||||
Helper.unexpectedError(ActivityView.this, ex);
|
||||
Helper.unexpectedError(ActivityView.this, ActivityView.this, ex);
|
||||
}
|
||||
}.load(this, new Bundle());
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(ActivityView.this, ex);
|
||||
Helper.unexpectedError(ActivityView.this, ActivityView.this, ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
@ -777,7 +777,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
}
|
||||
|
||||
private void onMenuFAQ() {
|
||||
Helper.view(this, getIntentFAQ());
|
||||
Helper.view(this, this, getIntentFAQ());
|
||||
}
|
||||
|
||||
private void onMenuPro() {
|
||||
|
@ -787,7 +787,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
}
|
||||
|
||||
private void onMenuPrivacy() {
|
||||
Helper.view(this, Helper.getIntentPrivacy());
|
||||
Helper.view(this, this, Helper.getIntentPrivacy());
|
||||
}
|
||||
|
||||
private void onMenuAbout() {
|
||||
|
@ -799,20 +799,20 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
private void onMenuRate() {
|
||||
Intent faq = getIntentFAQ();
|
||||
if (faq.resolveActivity(getPackageManager()) == null)
|
||||
Helper.view(this, getIntentRate());
|
||||
Helper.view(this, this, getIntentRate());
|
||||
else {
|
||||
new DialogBuilderLifecycle(this, this)
|
||||
.setMessage(R.string.title_issue)
|
||||
.setPositiveButton(R.string.title_yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Helper.view(ActivityView.this, getIntentFAQ());
|
||||
Helper.view(ActivityView.this, ActivityView.this, getIntentFAQ());
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.title_no, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Helper.view(ActivityView.this, getIntentRate());
|
||||
Helper.view(ActivityView.this, ActivityView.this, getIntentRate());
|
||||
}
|
||||
})
|
||||
.show();
|
||||
|
@ -824,7 +824,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
}
|
||||
|
||||
private void onMenuOtherApps() {
|
||||
Helper.view(this, getIntentOtherApps());
|
||||
Helper.view(this, this, getIntentOtherApps());
|
||||
}
|
||||
|
||||
private void onReload() {
|
||||
|
@ -973,7 +973,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(ActivityView.this, ex);
|
||||
Helper.unexpectedError(ActivityView.this, ActivityView.this, ex);
|
||||
}
|
||||
}.load(this, new Bundle());
|
||||
}
|
||||
|
@ -1314,7 +1314,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
ActivityView.REQUEST_DECRYPT,
|
||||
null, 0, 0, 0, null);
|
||||
} catch (IntentSender.SendIntentException ex) {
|
||||
Helper.unexpectedError(ActivityView.this, ex);
|
||||
Helper.unexpectedError(ActivityView.this, ActivityView.this, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1323,7 +1323,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
if (ex instanceof IllegalArgumentException)
|
||||
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
||||
else
|
||||
Helper.unexpectedError(ActivityView.this, ex);
|
||||
Helper.unexpectedError(ActivityView.this, ActivityView.this, ex);
|
||||
}
|
||||
}.load(ActivityView.this, args);
|
||||
}
|
||||
|
@ -1389,7 +1389,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(ActivityView.this, ex);
|
||||
Helper.unexpectedError(ActivityView.this, ActivityView.this, ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
|
||||
|
@ -264,7 +264,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
}
|
||||
|
|
|
@ -250,7 +250,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
|
||||
@Override
|
||||
public void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
}
|
||||
|
|
|
@ -724,7 +724,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -898,7 +898,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
return;
|
||||
}
|
||||
|
||||
Helper.view(context, uri);
|
||||
Helper.view(context, owner, uri);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.title_no, null)
|
||||
|
@ -978,7 +978,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
}
|
||||
|
@ -1025,7 +1025,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
}
|
||||
|
@ -1133,7 +1133,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
}
|
||||
|
@ -1159,7 +1159,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
}
|
||||
|
@ -1187,7 +1187,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
} else
|
||||
|
@ -1275,7 +1275,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
}
|
||||
|
@ -1310,7 +1310,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
}
|
||||
|
@ -1323,7 +1323,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
}
|
||||
|
@ -1448,7 +1448,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
}
|
||||
|
@ -1510,7 +1510,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
|
||||
|
@ -1523,7 +1523,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.View
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ public class FragmentAccount extends FragmentEx {
|
|||
if (ex instanceof IllegalArgumentException)
|
||||
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
||||
else
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentAccount.this, args);
|
||||
}
|
||||
|
@ -864,7 +864,7 @@ public class FragmentAccount extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentAccount.this, args);
|
||||
}
|
||||
|
@ -997,7 +997,7 @@ public class FragmentAccount extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentAccount.this, new Bundle());
|
||||
} else {
|
||||
|
@ -1038,14 +1038,14 @@ public class FragmentAccount extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentAccount.this, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ public class FragmentAnswer extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public class FragmentAnswer extends FragmentEx {
|
|||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.setViewsEnabled(view, true);
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentAnswer.this, args);
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ public class FragmentAnswer extends FragmentEx {
|
|||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.setViewsEnabled(view, true);
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
|
|
@ -606,7 +606,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
if (ex instanceof IllegalArgumentException)
|
||||
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
||||
else
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
else {
|
||||
Snackbar snackbar = Snackbar.make(view, R.string.title_no_openpgp, Snackbar.LENGTH_LONG);
|
||||
|
@ -761,7 +761,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
ActivityCompose.REQUEST_ENCRYPT,
|
||||
null, 0, 0, 0, null);
|
||||
} catch (IntentSender.SendIntentException ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -770,7 +770,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
if (ex instanceof IllegalArgumentException)
|
||||
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
||||
else
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
@ -834,7 +834,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
|
@ -877,7 +877,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
@ -1333,7 +1333,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentCompose.this, a);
|
||||
|
||||
|
@ -1480,7 +1480,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1689,7 +1689,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
if (ex instanceof IllegalArgumentException)
|
||||
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
||||
else
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ public class FragmentFolder extends FragmentEx {
|
|||
if (ex instanceof IllegalArgumentException)
|
||||
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
||||
else
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentFolder.this, args);
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ public class FragmentFolder extends FragmentEx {
|
|||
if (ex instanceof IllegalArgumentException)
|
||||
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
||||
else
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentFolder.this, args);
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ public class FragmentFolder extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
|
|
@ -285,7 +285,7 @@ public class FragmentIdentity extends FragmentEx {
|
|||
if (ex instanceof IllegalArgumentException)
|
||||
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
||||
else
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentIdentity.this, args);
|
||||
}
|
||||
|
@ -562,7 +562,7 @@ public class FragmentIdentity extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentIdentity.this, args);
|
||||
}
|
||||
|
@ -647,7 +647,7 @@ public class FragmentIdentity extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentIdentity.this, new Bundle());
|
||||
} else {
|
||||
|
@ -745,14 +745,14 @@ public class FragmentIdentity extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentIdentity.this, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
@ -815,7 +815,7 @@ public class FragmentIdentity extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
|
|
@ -329,7 +329,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentMessages.this, args);
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentMessages.this, args);
|
||||
}
|
||||
|
@ -653,7 +653,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentMessages.this, args);
|
||||
}
|
||||
|
@ -708,7 +708,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentMessages.this, args);
|
||||
}
|
||||
|
@ -750,7 +750,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentMessages.this, args);
|
||||
}
|
||||
|
@ -838,7 +838,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentMessages.this, args);
|
||||
|
||||
|
@ -851,7 +851,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentMessages.this, args);
|
||||
}
|
||||
|
@ -898,7 +898,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentMessages.this, args);
|
||||
}
|
||||
|
@ -1143,7 +1143,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentMessages.this, args);
|
||||
} else {
|
||||
|
@ -1268,7 +1268,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
@ -1515,7 +1515,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
@ -1565,7 +1565,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentOptions.this, null);
|
||||
}
|
||||
|
|
|
@ -329,7 +329,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(this, new Bundle());
|
||||
|
||||
|
@ -472,7 +472,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
}
|
||||
|
||||
private void onMenuPrivacy() {
|
||||
Helper.view(getContext(), Helper.getIntentPrivacy());
|
||||
Helper.view(getContext(), getViewLifecycleOwner(), Helper.getIntentPrivacy());
|
||||
}
|
||||
|
||||
private void onMenuLegend() {
|
||||
|
@ -486,7 +486,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
try {
|
||||
startActivityForResult(getIntentExport(), ActivitySetup.REQUEST_EXPORT);
|
||||
} catch (Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
else {
|
||||
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
||||
|
@ -499,7 +499,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
try {
|
||||
startActivityForResult(getIntentImport(), ActivitySetup.REQUEST_IMPORT);
|
||||
} catch (Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -631,7 +631,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
@ -765,7 +765,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
if (ex.getCause() instanceof BadPaddingException)
|
||||
Snackbar.make(view, R.string.title_setup_password_invalid, Snackbar.LENGTH_LONG).show();
|
||||
else
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public class FragmentWebView extends FragmentEx {
|
|||
setSubtitle(url);
|
||||
return false;
|
||||
} else {
|
||||
Helper.view(getContext(), Uri.parse(url));
|
||||
Helper.view(getContext(), getViewLifecycleOwner(), Uri.parse(url));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ public class FragmentWebView extends FragmentEx {
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}
|
||||
|
|
|
@ -68,8 +68,9 @@ import javax.mail.MessagingException;
|
|||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.browser.customtabs.CustomTabsIntent;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
|
||||
|
||||
|
@ -90,15 +91,15 @@ public class Helper {
|
|||
}
|
||||
};
|
||||
|
||||
static void view(Context context, Intent intent) {
|
||||
static void view(Context context, LifecycleOwner owner, Intent intent) {
|
||||
Uri uri = intent.getData();
|
||||
if ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme()))
|
||||
view(context, intent.getData());
|
||||
view(context, owner, intent.getData());
|
||||
else
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
static void view(Context context, Uri uri) {
|
||||
static void view(Context context, LifecycleOwner owner, Uri uri) {
|
||||
Log.i(Helper.TAG, "Custom tab=" + uri);
|
||||
|
||||
// https://developer.chrome.com/multidevice/android/customtabs
|
||||
|
@ -111,7 +112,7 @@ public class Helper {
|
|||
} catch (ActivityNotFoundException ex) {
|
||||
Toast.makeText(context, context.getString(R.string.title_no_viewer, uri.toString()), Toast.LENGTH_LONG).show();
|
||||
} catch (Throwable ex) {
|
||||
Helper.unexpectedError(context, ex);
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,11 +172,11 @@ public class Helper {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
static void unexpectedError(final Context context, final Throwable ex) {
|
||||
static void unexpectedError(final Context context, LifecycleOwner owner, final Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
|
||||
if (context != null) {
|
||||
new AlertDialog.Builder(context)
|
||||
if (owner.getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) {
|
||||
new DialogBuilderLifecycle(context, owner)
|
||||
.setTitle(R.string.title_unexpected_error)
|
||||
.setMessage(ex.toString())
|
||||
.setPositiveButton(android.R.string.cancel, null)
|
||||
|
|
Loading…
Reference in New Issue