From f45145d2259c732925d5c3db7f626227e4803b04 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 1 Mar 2020 20:43:46 +0100 Subject: [PATCH] Workaround Android bug --- .../java/eu/faircode/email/FixedTextView.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/FixedTextView.java b/app/src/main/java/eu/faircode/email/FixedTextView.java index cbf15accd3..ea8363039b 100644 --- a/app/src/main/java/eu/faircode/email/FixedTextView.java +++ b/app/src/main/java/eu/faircode/email/FixedTextView.java @@ -20,6 +20,7 @@ package eu.faircode.email; */ import android.content.Context; +import android.graphics.Canvas; import android.graphics.Rect; import android.util.AttributeSet; @@ -45,6 +46,7 @@ public class FixedTextView extends AppCompatTextView { try { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } catch (Throwable ex) { + Log.w(ex); /* java.lang.ArrayIndexOutOfBoundsException: length=...; index=... at android.text.TextLine.measure(TextLine.java:316) @@ -58,6 +60,23 @@ public class FixedTextView extends AppCompatTextView { } } + @Override + protected void onDraw(Canvas canvas) { + try { + super.onDraw(canvas); + } catch (Throwable ex) { + Log.w(ex); +/* + java.lang.ArrayIndexOutOfBoundsException: length=74; index=74 + at android.text.TextLine.draw(TextLine.java:241) + at android.text.Layout.drawText(Layout.java:545) + at android.text.Layout.draw(Layout.java:289) + at android.widget.TextView.onDraw(TextView.java:6972) + at android.view.View.draw(View.java:19380) +*/ + } + } + @Override protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { try {