Don't reserve space for the expand text button if we need just one more line

Test: view Room summary with 1, 2, 3, 4 lines

Change-Id: Ic8a5e197f78ffeb8c1410d6ac3c859fd522decaa
This commit is contained in:
SpiritCroc 2020-11-02 10:11:12 +01:00
parent 12e97fbed2
commit 0b2d98b116

View File

@ -45,7 +45,9 @@ abstract class ExpandableTextItem : VectorEpoxyModel<ExpandableTextItem.Holder>(
holder.content.copyOnLongClick()
holder.content.doOnPreDraw {
if (holder.content.lineCount > maxLines) {
// Allow for displaying maxLines + 1 lines: in this case, the expand button
// would reserve just as much space as the expaned text
if (holder.content.lineCount > maxLines + 1) {
expandedLines = holder.content.lineCount
holder.content.maxLines = maxLines
@ -59,6 +61,7 @@ abstract class ExpandableTextItem : VectorEpoxyModel<ExpandableTextItem.Holder>(
holder.arrow.isVisible = true
} else {
holder.arrow.isVisible = false
holder.content.maxLines = maxLines + 1
}
}
}