From 1c3357b79eefa36bc85faea75cf2896e16e59200 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 8 Mar 2020 14:37:34 +0100 Subject: [PATCH] Prevent crash --- .../java/eu/faircode/email/FixedTextView.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/FixedTextView.java b/app/src/main/java/eu/faircode/email/FixedTextView.java index c078742378..944a863ef1 100644 --- a/app/src/main/java/eu/faircode/email/FixedTextView.java +++ b/app/src/main/java/eu/faircode/email/FixedTextView.java @@ -23,6 +23,7 @@ import android.content.Context; import android.graphics.Canvas; import android.graphics.Rect; import android.util.AttributeSet; +import android.view.MotionEvent; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -78,6 +79,28 @@ public class FixedTextView extends AppCompatTextView { } } + @Override + public boolean onTouchEvent(MotionEvent event) { + try { + return super.onTouchEvent(event); + } catch (Throwable ex) { + Log.w(ex); + return false; +/* + java.lang.IllegalArgumentException + at com.android.internal.util.Preconditions.checkArgument(Preconditions.java:33) + at android.widget.SelectionActionModeHelper$TextClassificationHelper.init(SelectionActionModeHelper.java:640) + at android.widget.SelectionActionModeHelper.resetTextClassificationHelper(SelectionActionModeHelper.java:203) + at android.widget.SelectionActionModeHelper.invalidateActionModeAsync(SelectionActionModeHelper.java:104) + at android.widget.Editor.invalidateActionModeAsync(Editor.java:2028) + at android.widget.Editor.showFloatingToolbar(Editor.java:1419) + at android.widget.Editor.updateFloatingToolbarVisibility(Editor.java:1397) + at android.widget.Editor.onTouchEvent(Editor.java:1367) + at android.widget.TextView.onTouchEvent(TextView.java:9701) +*/ + } + } + @Override protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { try {