Fix text overflow length calculation.

This commit is contained in:
Greyson Parrelli 2025-01-06 11:22:29 -05:00
parent c3a49766bf
commit 62038e83dd

View file

@ -32,6 +32,7 @@ import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.style.BackgroundColorSpan;
import android.text.style.CharacterStyle;
import android.text.style.ClickableSpan;
@ -1055,7 +1056,8 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
if (hasExtraText(messageRecord)) {
bodyText.setOverflowText(getLongMessageSpan(messageRecord));
bodyText.setMaxLength(messageRecord.getBody().length() - 2);
int trimmedLength = TextUtils.getTrimmedLength(styledText);
bodyText.setMaxLength(trimmedLength - 2);
}
if (messageRecord.isOutgoing()) {