Fix overlapping text when message contains mixed LTR and RTL text.

Fixes #11638
This commit is contained in:
Cody Henthorne 2021-09-29 13:05:43 -04:00
parent 7e91132e7e
commit 27ce0fd65e

View file

@ -165,10 +165,9 @@ public class EmojiTextView extends AppCompatTextView {
int lines = layout.getLineCount();
int start = layout.getLineStart(lines - 1);
int count = text.length() - start;
if ((getLayoutDirection() == LAYOUT_DIRECTION_LTR && textDirection.isRtl(text, start, count)) ||
(getLayoutDirection() == LAYOUT_DIRECTION_RTL && !textDirection.isRtl(text, start, count))) {
if ((getLayoutDirection() == LAYOUT_DIRECTION_LTR && textDirection.isRtl(text, 0, text.length())) ||
(getLayoutDirection() == LAYOUT_DIRECTION_RTL && !textDirection.isRtl(text, 0, text.length()))) {
lastLineWidth = getMeasuredWidth();
} else {
lastLineWidth = (int) getPaint().measureText(text, start, text.length());