mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
fix autoellipsize of large text
commit_hash:e7c384090f3ca934a19ab434fe69e3f1b91e5038
This commit is contained in:
+7
-1
@@ -1,6 +1,7 @@
|
||||
package com.yandex.div.internal.widget
|
||||
|
||||
import android.view.ViewTreeObserver
|
||||
import com.yandex.div.internal.KLog
|
||||
|
||||
/**
|
||||
* Helper to calculate and update max lines for given [textView].
|
||||
@@ -43,7 +44,8 @@ internal class AutoEllipsizeHelper(private val textView: EllipsizedTextView) {
|
||||
val lastVisibleLine = lineAt(textHeight)
|
||||
if (textHeight >= textHeight(lastVisibleLine + 1)) lastVisibleLine + 1 else lastVisibleLine
|
||||
}
|
||||
if (visibleLineCount < textView.lineCount) {
|
||||
if (visibleLineCount > 0 && visibleLineCount < textView.lineCount) {
|
||||
KLog.d(TAG) { "Trying to set new max lines $visibleLineCount. Current drawing pass is canceled. " }
|
||||
textView.maxLines = visibleLineCount
|
||||
false
|
||||
} else {
|
||||
@@ -60,4 +62,8 @@ internal class AutoEllipsizeHelper(private val textView: EllipsizedTextView) {
|
||||
preDrawListener = null
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val TAG = "AutoEllipsizeHelper"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user