@@ -15,6 +15,7 @@ import android.graphics.drawable.Drawable
1515import android.text.SpannableStringBuilder
1616import android.text.Spanned
1717import android.text.TextPaint
18+ import android.text.TextUtils
1819import android.text.method.LinkMovementMethod
1920import android.text.style.ClickableSpan
2021import android.text.style.ReplacementSpan
@@ -124,6 +125,7 @@ fun MarkdownText(
124125 textView.setTextColor(textColorArgb)
125126 textView.setTextSize(TypedValue .COMPLEX_UNIT_SP , textSizeSp)
126127 textView.maxLines = maxLines
128+ textView.ellipsize = if (maxLines != Int .MAX_VALUE ) TextUtils .TruncateAt .END else null
127129 textView.setLineSpacing(0f , textView.textSize * LINE_HEIGHT_MULTIPLIER / textView.paint.fontSpacing)
128130 val markwon = MessageUtils .buildMarkwon(context, textColorArgb)
129131 markwon.setMarkdown(textView, resolveNonMentionParams(message))
@@ -149,7 +151,7 @@ fun MarkdownText(
149151 resolveFileParams(ssb, message)
150152 textView.text = ssb
151153 textView.setLinkTextColor(linkColorArgb)
152- val needsMovementMethod = hasClickableChips || hasLinks
154+ val needsMovementMethod = ( hasClickableChips || hasLinks) && maxLines == Int . MAX_VALUE
153155 if (needsMovementMethod) {
154156 textView.movementMethod = LinkMovementMethod .getInstance()
155157 textView.setOnTouchListener(textView.tag as ? View .OnTouchListener )
0 commit comments