From 74aad4f59f53aa9072ce44f63385aba599e946be Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 28 Feb 2020 17:31:37 +0100 Subject: [PATCH] Workaround Android bug --- .../java/eu/faircode/email/FixedTextView.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/FixedTextView.java b/app/src/main/java/eu/faircode/email/FixedTextView.java index d98d22dcaf..cbf15accd3 100644 --- a/app/src/main/java/eu/faircode/email/FixedTextView.java +++ b/app/src/main/java/eu/faircode/email/FixedTextView.java @@ -40,6 +40,24 @@ public class FixedTextView extends AppCompatTextView { super(context, attrs, defStyleAttr); } + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + try { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + } catch (Throwable ex) { +/* + java.lang.ArrayIndexOutOfBoundsException: length=...; index=... + at android.text.TextLine.measure(TextLine.java:316) + at android.text.TextLine.metrics(TextLine.java:271) + at android.text.Layout.measurePara(Layout.java:2056) + at android.text.Layout.getDesiredWidth(Layout.java:164) + at android.widget.TextView.onMeasure(TextView.java:8291) + at androidx.appcompat.widget.AppCompatTextView.onMeasure(SourceFile:554) + at android.view.View.measure(View.java:22360) +*/ + } + } + @Override protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { try {