mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-06 14:03:45 +01:00
Disable bubble margin for images to fix wrong scale
This commit is contained in:
parent
b048a27a85
commit
8142b35437
@ -171,6 +171,10 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
|
|||||||
return attributes.informationData.sentByMe
|
return attributes.informationData.sentByMe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open fun getBubbleMargin(density: Float, reverseBubble: Boolean): Int {
|
||||||
|
return round(96*density).toInt()
|
||||||
|
}
|
||||||
|
|
||||||
override fun setBubbleLayout(holder: H, bubbleStyle: String, bubbleStyleSetting: String, reverseBubble: Boolean) {
|
override fun setBubbleLayout(holder: H, bubbleStyle: String, bubbleStyleSetting: String, reverseBubble: Boolean) {
|
||||||
super.setBubbleLayout(holder, bubbleStyle, bubbleStyleSetting, reverseBubble)
|
super.setBubbleLayout(holder, bubbleStyle, bubbleStyleSetting, reverseBubble)
|
||||||
|
|
||||||
@ -200,11 +204,11 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
|
|||||||
val density = bubbleView.resources.displayMetrics.density
|
val density = bubbleView.resources.displayMetrics.density
|
||||||
// TODO 96 = 2 * avatar size?
|
// TODO 96 = 2 * avatar size?
|
||||||
if (reverseBubble) {
|
if (reverseBubble) {
|
||||||
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginStart = round(96 * density).toInt()
|
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginStart = getBubbleMargin(density, reverseBubble)
|
||||||
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginEnd = 0
|
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginEnd = 0
|
||||||
} else {
|
} else {
|
||||||
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginStart = 0
|
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginStart = 0
|
||||||
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginEnd = round(96 * density).toInt()
|
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginEnd = getBubbleMargin(density, reverseBubble)
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
(bubbleView.layoutParams as RelativeLayout.LayoutParams).marginStart = round(20*density).toInt()
|
(bubbleView.layoutParams as RelativeLayout.LayoutParams).marginStart = round(20*density).toInt()
|
||||||
|
@ -75,6 +75,10 @@ abstract class MessageImageVideoItem : AbsMessageItem<MessageImageVideoItem.Hold
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getBubbleMargin(density: Float, reverseBubble: Boolean): Int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
class Holder : AbsMessageItem.Holder(STUB_ID) {
|
class Holder : AbsMessageItem.Holder(STUB_ID) {
|
||||||
val progressLayout by bind<ViewGroup>(R.id.messageMediaUploadProgressLayout)
|
val progressLayout by bind<ViewGroup>(R.id.messageMediaUploadProgressLayout)
|
||||||
val imageView by bind<ImageView>(R.id.messageThumbnailView)
|
val imageView by bind<ImageView>(R.id.messageThumbnailView)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user