From 4d2ad801da6f4b59806438b7386c0777bc173203 Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Tue, 13 Oct 2020 14:57:06 +0200 Subject: [PATCH] Fix bubble min-width in forced timestamp case Change-Id: I4d486fa2576e9728cda854c61d5e29b177cc3bcd --- .../room/detail/timeline/item/AbsMessageItem.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsMessageItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsMessageItem.kt index ebd095ced3..7ec099bc1d 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsMessageItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsMessageItem.kt @@ -211,11 +211,19 @@ abstract class AbsMessageItem : AbsBaseMessageItem } open fun getViewStubMinimumWidth(holder: H, contentInBubble: Boolean, showInformation: Boolean): Int { - return if (contentInBubble && attributes.informationData.showInformation) { + return if (contentInBubble && (attributes.informationData.showInformation || attributes.informationData.forceShowTimestamp)) { // Guess text width for name and time - val text = holder.bubbleMemberNameView.text.toString() + " " + holder.bubbleTimeView.text.toString() + val text = if (attributes.informationData.showInformation) { + holder.bubbleMemberNameView.text.toString() + " " + holder.bubbleTimeView.text.toString() + } else { + holder.bubbleTimeView.text.toString() + } val paint = Paint() - paint.textSize = max(holder.bubbleMemberNameView.textSize, holder.bubbleTimeView.textSize) + paint.textSize = if (attributes.informationData.showInformation) { + max(holder.bubbleMemberNameView.textSize, holder.bubbleTimeView.textSize) + } else { + holder.bubbleTimeView.textSize + } round(paint.measureText(text)).toInt() } else { 0