From 0b2d98b116dd594b06515a24fd4398e85e86353e Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Mon, 2 Nov 2020 10:11:12 +0100 Subject: [PATCH] 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 --- .../main/java/im/vector/app/core/epoxy/ExpandableTextItem.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/core/epoxy/ExpandableTextItem.kt b/vector/src/main/java/im/vector/app/core/epoxy/ExpandableTextItem.kt index 3dceec48ef..39486423c4 100644 --- a/vector/src/main/java/im/vector/app/core/epoxy/ExpandableTextItem.kt +++ b/vector/src/main/java/im/vector/app/core/epoxy/ExpandableTextItem.kt @@ -45,7 +45,9 @@ abstract class ExpandableTextItem : VectorEpoxyModel( 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( holder.arrow.isVisible = true } else { holder.arrow.isVisible = false + holder.content.maxLines = maxLines + 1 } } }