mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 12:00:03 +03:00
Disable bubble margin for images to fix wrong scale
This commit is contained in:
parent
b048a27a85
commit
8142b35437
2 changed files with 10 additions and 2 deletions
|
@ -171,6 +171,10 @@ 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()
|
||||
}
|
||||
|
||||
override fun setBubbleLayout(holder: H, bubbleStyle: String, bubbleStyleSetting: String, reverseBubble: Boolean) {
|
||||
super.setBubbleLayout(holder, bubbleStyle, bubbleStyleSetting, reverseBubble)
|
||||
|
||||
|
@ -200,11 +204,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 = round(96 * density).toInt()
|
||||
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginStart = getBubbleMargin(density, reverseBubble)
|
||||
(bubbleView.layoutParams as ViewGroup.MarginLayoutParams).marginEnd = 0
|
||||
} else {
|
||||
(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()
|
||||
|
|
|
@ -75,6 +75,10 @@ abstract class MessageImageVideoItem : AbsMessageItem<MessageImageVideoItem.Hold
|
|||
return true
|
||||
}
|
||||
|
||||
override fun getBubbleMargin(density: Float, reverseBubble: Boolean): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
class Holder : AbsMessageItem.Holder(STUB_ID) {
|
||||
val progressLayout by bind<ViewGroup>(R.id.messageMediaUploadProgressLayout)
|
||||
val imageView by bind<ImageView>(R.id.messageThumbnailView)
|
||||
|
|
Loading…
Reference in a new issue