Bubbles: update sticker handling
This commit is contained in:
parent
5ee4984ec8
commit
ac0c2624f0
@ -89,7 +89,7 @@ abstract class MessageImageVideoItem : AbsMessageItem<MessageImageVideoItem.Hold
|
|||||||
holder.mediaContentView.onClick(attributes.itemClickListener)
|
holder.mediaContentView.onClick(attributes.itemClickListener)
|
||||||
holder.mediaContentView.setOnLongClickListener(attributes.itemLongClickListener)
|
holder.mediaContentView.setOnLongClickListener(attributes.itemLongClickListener)
|
||||||
holder.playContentView.visibility = if (playable) View.VISIBLE else View.GONE
|
holder.playContentView.visibility = if (playable) View.VISIBLE else View.GONE
|
||||||
holder.overlayView.isVisible = messageLayout is TimelineMessageLayout.Bubble
|
holder.overlayView.isVisible = messageLayout is TimelineMessageLayout.Bubble && messageLayout.timestampAsOverlay
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun unbind(holder: Holder) {
|
override fun unbind(holder: Holder) {
|
||||||
|
@ -42,6 +42,7 @@ sealed interface TimelineMessageLayout : Parcelable {
|
|||||||
val isFirstFromThisSender: Boolean,
|
val isFirstFromThisSender: Boolean,
|
||||||
val isLastFromThisSender: Boolean,
|
val isLastFromThisSender: Boolean,
|
||||||
val isPseudoBubble: Boolean,
|
val isPseudoBubble: Boolean,
|
||||||
|
val timestampAsOverlay: Boolean,
|
||||||
override val layoutRes: Int = if (isIncoming) {
|
override val layoutRes: Int = if (isIncoming) {
|
||||||
R.layout.item_timeline_event_bubble_incoming_base
|
R.layout.item_timeline_event_bubble_incoming_base
|
||||||
} else {
|
} else {
|
||||||
|
@ -40,6 +40,7 @@ class TimelineMessageLayoutFactory @Inject constructor(private val session: Sess
|
|||||||
EventType.ENCRYPTED,
|
EventType.ENCRYPTED,
|
||||||
EventType.STICKER
|
EventType.STICKER
|
||||||
)
|
)
|
||||||
|
|
||||||
// Can't be rendered in bubbles, so get back to default layout
|
// Can't be rendered in bubbles, so get back to default layout
|
||||||
private val MSG_TYPES_WITHOUT_BUBBLE_LAYOUT = setOf(
|
private val MSG_TYPES_WITHOUT_BUBBLE_LAYOUT = setOf(
|
||||||
MessageType.MSGTYPE_VERIFICATION_REQUEST
|
MessageType.MSGTYPE_VERIFICATION_REQUEST
|
||||||
@ -47,7 +48,10 @@ class TimelineMessageLayoutFactory @Inject constructor(private val session: Sess
|
|||||||
|
|
||||||
// Use the bubble layout but without borders
|
// Use the bubble layout but without borders
|
||||||
private val MSG_TYPES_WITH_PSEUDO_BUBBLE_LAYOUT = setOf(
|
private val MSG_TYPES_WITH_PSEUDO_BUBBLE_LAYOUT = setOf(
|
||||||
MessageType.MSGTYPE_IMAGE, MessageType.MSGTYPE_VIDEO,
|
MessageType.MSGTYPE_IMAGE, MessageType.MSGTYPE_VIDEO, MessageType.MSGTYPE_STICKER_LOCAL
|
||||||
|
)
|
||||||
|
private val MSG_TYPES_WITH_TIMESTAMP_AS_OVERLAY = setOf(
|
||||||
|
MessageType.MSGTYPE_IMAGE, MessageType.MSGTYPE_VIDEO
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +97,8 @@ class TimelineMessageLayoutFactory @Inject constructor(private val session: Sess
|
|||||||
isIncoming = !isSentByMe,
|
isIncoming = !isSentByMe,
|
||||||
isFirstFromThisSender = isFirstFromThisSender,
|
isFirstFromThisSender = isFirstFromThisSender,
|
||||||
isLastFromThisSender = isLastFromThisSender,
|
isLastFromThisSender = isLastFromThisSender,
|
||||||
isPseudoBubble = messageContent?.msgType in MSG_TYPES_WITH_PSEUDO_BUBBLE_LAYOUT
|
isPseudoBubble = messageContent?.msgType in MSG_TYPES_WITH_PSEUDO_BUBBLE_LAYOUT,
|
||||||
|
timestampAsOverlay = messageContent?.msgType in MSG_TYPES_WITH_TIMESTAMP_AS_OVERLAY
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -92,8 +92,7 @@ class MessageBubbleView @JvmOverloads constructor(context: Context, attrs: Attri
|
|||||||
ConstraintSet().apply {
|
ConstraintSet().apply {
|
||||||
clone(views.bubbleView)
|
clone(views.bubbleView)
|
||||||
clear(R.id.viewStubContainer, ConstraintSet.END)
|
clear(R.id.viewStubContainer, ConstraintSet.END)
|
||||||
val showTimeAsOverlay = messageLayout.isPseudoBubble
|
if (messageLayout.timestampAsOverlay) {
|
||||||
if (showTimeAsOverlay) {
|
|
||||||
val timeColor = ContextCompat.getColor(context, R.color.palette_white)
|
val timeColor = ContextCompat.getColor(context, R.color.palette_white)
|
||||||
views.messageTimeView.setTextColor(timeColor)
|
views.messageTimeView.setTextColor(timeColor)
|
||||||
connect(R.id.viewStubContainer, ConstraintSet.END, R.id.parent, ConstraintSet.END, 0)
|
connect(R.id.viewStubContainer, ConstraintSet.END, R.id.parent, ConstraintSet.END, 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user