mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-22 02:36:55 +00:00
Fix ellipsis appearing in the middle of a message.
This commit is contained in:
committed by
Cody Henthorne
parent
6d41d1f6d2
commit
3ad7c96a3c
@@ -149,7 +149,7 @@ public class EmojiTextView extends AppCompatTextView {
|
||||
|
||||
// Android fails to ellipsize spannable strings. (https://issuetracker.google.com/issues/36991688)
|
||||
// We ellipsize them ourselves by manually truncating the appropriate section.
|
||||
if (getText() != null && getText().length() > 0 && getEllipsize() == TextUtils.TruncateAt.END) {
|
||||
if (getText() != null && getText().length() > 0 && isEllipsizedAtEnd()) {
|
||||
if (maxLength > 0) {
|
||||
ellipsizeAnyTextForMaxLength();
|
||||
} else if (getMaxLines() > 0) {
|
||||
@@ -162,6 +162,17 @@ public class EmojiTextView extends AppCompatTextView {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine whether to apply custom ellipsizing logic without necessarily having the
|
||||
* ellipsize property set. This allows us to work around implementations of Layout which apply an
|
||||
* ellipsis even when maxLines is not set.
|
||||
*/
|
||||
private boolean isEllipsizedAtEnd() {
|
||||
return getEllipsize() == TextUtils.TruncateAt.END ||
|
||||
(getMaxLines() > 0 && getMaxLines() < Integer.MAX_VALUE) ||
|
||||
maxLength > 0;
|
||||
}
|
||||
|
||||
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
widthMeasureSpec = applyWidthMeasureRoundingFix(widthMeasureSpec);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user