mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-27 02:07:12 +00:00
Attempt to workaround Android 8 block index bug
This commit is contained in:
parent
617824ff3e
commit
388af6e7c5
1 changed files with 19 additions and 8 deletions
|
@ -25,6 +25,7 @@ import android.os.Build;
|
|||
import android.util.AttributeSet;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.textclassifier.TextClassifier;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
@ -123,6 +124,8 @@ public class FixedEditText extends AppCompatEditText {
|
|||
super.onDraw(canvas);
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
if (ex instanceof ArrayIndexOutOfBoundsException)
|
||||
try {
|
||||
/*
|
||||
java.lang.ArrayIndexOutOfBoundsException: length=39; index=-3
|
||||
at android.text.DynamicLayout.getBlockIndex(DynamicLayout.java:648)
|
||||
|
@ -130,7 +133,15 @@ public class FixedEditText extends AppCompatEditText {
|
|||
at android.widget.Editor.onDraw(Editor.java:1672)
|
||||
at android.widget.TextView.onDraw(TextView.java:6914)
|
||||
at android.view.View.draw(View.java:19200)
|
||||
|
||||
Fixed in Android 9:
|
||||
https://android-review.googlesource.com/c/platform/frameworks/base/+/634929
|
||||
*/
|
||||
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
super.onDraw(canvas);
|
||||
} catch (Throwable exex) {
|
||||
Log.w(exex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue