Added unexpected errors without reporting

pull/184/head
M66B 5 years ago
parent 6291aeba2e
commit 71ed6a62b5

@ -1836,7 +1836,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
at android.webkit.WebView.<init>(WebView.java:574)
at android.webkit.WebView.<init>(WebView.java:564)
*/
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex);
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex, false);
return;
}

@ -1020,10 +1020,15 @@ public class Log {
}
static void unexpectedError(FragmentManager manager, Throwable ex) {
unexpectedError(manager, ex, true);
}
static void unexpectedError(FragmentManager manager, Throwable ex, boolean report) {
Log.e(ex);
Bundle args = new Bundle();
args.putSerializable("ex", ex);
args.putBoolean("report", report);
FragmentDialogUnexpected fragment = new FragmentDialogUnexpected();
fragment.setArguments(args);
@ -1035,12 +1040,15 @@ public class Log {
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
final Throwable ex = (Throwable) getArguments().getSerializable("ex");
boolean report = getArguments().getBoolean("report", true);
return new AlertDialog.Builder(getContext())
AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
.setTitle(R.string.title_unexpected_error)
.setMessage(Log.formatThrowable(ex, false))
.setPositiveButton(android.R.string.cancel, null)
.setNeutralButton(R.string.title_report, new DialogInterface.OnClickListener() {
.setPositiveButton(android.R.string.cancel, null);
if (report)
builder.setNeutralButton(R.string.title_report, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Dialog will be dismissed
@ -1068,8 +1076,9 @@ public class Log {
}
}.execute(getContext(), getActivity(), new Bundle(), "error:unexpected");
}
})
.create();
});
return builder.create();
}
}

Loading…
Cancel
Save