Fix bubble min-width in forced timestamp case

Change-Id: I4d486fa2576e9728cda854c61d5e29b177cc3bcd
This commit is contained in:
SpiritCroc 2020-10-13 14:57:06 +02:00
parent e81a7211b2
commit 4d2ad801da
1 changed files with 11 additions and 3 deletions

View File

@ -211,11 +211,19 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
} }
open fun getViewStubMinimumWidth(holder: H, contentInBubble: Boolean, showInformation: Boolean): Int { 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 // 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() 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() round(paint.measureText(text)).toInt()
} else { } else {
0 0