Added support button to unexpected error dialog

This commit is contained in:
M66B 2022-04-06 08:26:27 +02:00
parent fb376af8a3
commit 63a65eed62
2 changed files with 18 additions and 4 deletions

View File

@ -47,6 +47,7 @@ import android.net.LinkProperties;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.DeadObjectException;
@ -1737,11 +1738,24 @@ public class Log {
View dview = inflater.inflate(R.layout.dialog_unexpected, null);
TextView tvError = dview.findViewById(R.id.tvError);
tvError.setText(Log.formatThrowable(ex, false));
String message = Log.formatThrowable(ex, false);
tvError.setText(message);
AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setView(dview)
.setPositiveButton(android.R.string.cancel, null);
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(R.string.menu_faq, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Uri uri = Helper.getSupportUri(context);
if (!TextUtils.isEmpty(message))
uri = uri
.buildUpon()
.appendQueryParameter("message", "Unexpected: " + message)
.build();
Helper.view(context, uri, true);
}
});
if (report)
builder.setNeutralButton(R.string.title_report, new DialogInterface.OnClickListener() {

View File

@ -17,7 +17,7 @@
android:layout_height="wrap_content"
android:drawableStart="@drawable/twotone_bug_report_24"
android:drawablePadding="6dp"
android:drawableTint="?attr/colorWarning"
android:drawableTint="@color/red"
android:labelFor="@+id/etName"
android:text="@string/title_unexpected_error"
android:textAppearance="@style/TextAppearance.AppCompat.Large"