mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-15 18:59:12 +03:00
Single-side bubbles don't need margin to other side
The margin is there for dual-side bubbles, so the bubbles are more connected to the same side of the sender avatar. For single-side bubbles, this is a waste of space, so remove it for this scenario. Change-Id: Ib70cd0b1d30c2a8dbb356c80bd12a8310dceda8c
This commit is contained in:
parent
e1cb8c520a
commit
ac713124e7
2 changed files with 9 additions and 5 deletions
vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item
|
@ -287,8 +287,12 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
|
|||
return attributes.informationData.sentByMe
|
||||
}
|
||||
|
||||
open fun getBubbleMargin(density: Float, reverseBubble: Boolean): Int {
|
||||
return round(96*density).toInt()
|
||||
open fun getBubbleMargin(density: Float, bubbleStyle: String, reverseBubble: Boolean): Int {
|
||||
return when (bubbleStyle) {
|
||||
BubbleThemeUtils.BUBBLE_STYLE_START,
|
||||
BubbleThemeUtils.BUBBLE_STYLE_START_HIDDEN -> 0
|
||||
else -> round(96*density).toInt()
|
||||
}
|
||||
}
|
||||
|
||||
open fun allowFooterOverlay(holder: H): Boolean {
|
||||
|
@ -353,11 +357,11 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
|
|||
val density = bubbleView.resources.displayMetrics.density
|
||||
// TODO 96 = 2 * avatar size?
|
||||
if (reverseBubble) {
|
||||
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginStart = getBubbleMargin(density, reverseBubble)
|
||||
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginStart = getBubbleMargin(density, bubbleStyle, reverseBubble)
|
||||
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginEnd = 0
|
||||
} else {
|
||||
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginStart = 0
|
||||
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginEnd = getBubbleMargin(density, reverseBubble)
|
||||
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginEnd = getBubbleMargin(density, bubbleStyle, reverseBubble)
|
||||
}
|
||||
/*
|
||||
(bubbleView.layoutParams as RelativeLayout.LayoutParams).marginStart = round(20*density).toInt()
|
||||
|
|
|
@ -97,7 +97,7 @@ abstract class MessageImageVideoItem : AbsMessageItem<MessageImageVideoItem.Hold
|
|||
return true
|
||||
}
|
||||
|
||||
override fun getBubbleMargin(density: Float, reverseBubble: Boolean): Int {
|
||||
override fun getBubbleMargin(density: Float, bubbleStyle: String, reverseBubble: Boolean): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue