Allow copying unexpected error

This commit is contained in:
M66B 2021-10-17 07:26:38 +02:00
parent 1a63118c97
commit 5e7bffe974
2 changed files with 48 additions and 2 deletions

View File

@ -57,7 +57,10 @@ import android.provider.Settings;
import android.text.TextUtils;
import android.view.Display;
import android.view.InflateException;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
@ -1613,9 +1616,15 @@ public class Log {
final Throwable ex = (Throwable) getArguments().getSerializable("ex");
boolean report = getArguments().getBoolean("report", true);
final Context context = getContext();
LayoutInflater inflater = LayoutInflater.from(context);
View dview = inflater.inflate(R.layout.dialog_unexpected, null);
TextView tvError = dview.findViewById(R.id.tvError);
tvError.setText(Log.formatThrowable(ex, false));
AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
.setTitle(R.string.title_unexpected_error)
.setMessage(Log.formatThrowable(ex, false))
.setView(dview)
.setPositiveButton(android.R.string.cancel, null);
if (report)

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<eu.faircode.email.ScrollViewEx xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fadeScrollbars="false"
android:padding="24dp"
android:scrollbarStyle="outsideOverlay">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<eu.faircode.email.FixedTextView
android:id="@+id/tvCaption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@drawable/twotone_bug_report_24"
android:drawablePadding="6dp"
android:labelFor="@+id/etName"
android:text="@string/title_unexpected_error"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvError"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="Error"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textIsSelectable="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaption" />
</androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx>