From 127e151c416cc3c984b8d5e5b8f1f3265ce5c5c1 Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Sun, 26 Dec 2021 10:50:18 +0100 Subject: [PATCH] Make pseudo-bubbles align properly with bubbles again Change-Id: Ib841827f7df8712eb35c126a94fb1554d1182c6f --- .../room/detail/timeline/item/AbsMessageItem.kt | 14 ++++++-------- vector/src/main/res/values/dimens_sc.xml | 3 +++ 2 files changed, 9 insertions(+), 8 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 e953e04a45..f299ce6803 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 @@ -456,8 +456,8 @@ abstract class AbsMessageItem : AbsBaseMessageItem BubbleThemeUtils.BUBBLE_STYLE_BOTH_HIDDEN, BubbleThemeUtils.BUBBLE_STYLE_START_HIDDEN -> { // Padding for bubble content: long for side with tail, short for other sides - val longPadding: Int - val shortPadding: Int + val longPaddingDp: Int + val shortPaddingDp: Int if (BubbleThemeUtils.drawsActualBubbles(bubbleStyle)) { val bubbleRes = if (attributes.informationData.showInformation) { // tail if (reverseBubble) { // outgoing @@ -473,11 +473,11 @@ abstract class AbsMessageItem : AbsBaseMessageItem } } bubbleView.setBackgroundResource(bubbleRes) - longPadding = 20 - shortPadding = 8 + longPaddingDp = bubbleView.resources.getDimensionPixelSize(R.dimen.sc_bubble_inner_padding_long_side) + shortPaddingDp = bubbleView.resources.getDimensionPixelSize(R.dimen.sc_bubble_inner_padding_short_side) } else { - longPadding = 10 - shortPadding = 0//if (attributes.informationData.showInformation && !hideSenderInformation()) { 8 } else { 0 } + longPaddingDp = bubbleView.resources.getDimensionPixelSize(R.dimen.sc_bubble_tail_size) + shortPaddingDp = 0//if (attributes.informationData.showInformation && !hideSenderInformation()) { 8 } else { 0 } } val density = bubbleView.resources.displayMetrics.density if (reverseBubble != defaultRtl) { @@ -493,8 +493,6 @@ abstract class AbsMessageItem : AbsBaseMessageItem (bubbleView.layoutParams as RelativeLayout.LayoutParams).topMargin = round(8*density).toInt() (bubbleView.layoutParams as RelativeLayout.LayoutParams).bottomMargin = round(8*density).toInt() */ - val shortPaddingDp = round(shortPadding * density).toInt() - val longPaddingDp = round(longPadding * density).toInt() if (reverseBubble != defaultRtl) { // Use left/right instead of start/end: bubbleView is always LTR bubbleView.setPadding( diff --git a/vector/src/main/res/values/dimens_sc.xml b/vector/src/main/res/values/dimens_sc.xml index 4f170ec38c..b2dc0050f8 100644 --- a/vector/src/main/res/values/dimens_sc.xml +++ b/vector/src/main/res/values/dimens_sc.xml @@ -13,5 +13,8 @@ 3dp 12dp 2dp + 8dp + + 20dp