Skip to content

Commit

Permalink
Add padding before first own message
Browse files Browse the repository at this point in the history
  • Loading branch information
p1gp1g committed Mar 1, 2022
1 parent b226ab5 commit abd58c5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/5384.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add top margin before our first message
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
holder.memberNameView.setTextColor(attributes.getMemberNameColor())
holder.memberNameView.onClick(_memberNameClickListener)
holder.memberNameView.setOnLongClickListener(attributes.itemLongClickListener)
} else if (attributes.informationData.messageLayout.addTopMargin) {
holder.memberNameView.setOnClickListener(null)
holder.memberNameView.setOnLongClickListener(null)
holder.memberNameView.isVisible = true
holder.memberNameView.text = ""
} else {
holder.memberNameView.setOnClickListener(null)
holder.memberNameView.setOnLongClickListener(null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ sealed interface TimelineMessageLayout : Parcelable {
val layoutRes: Int
val showAvatar: Boolean
val showDisplayName: Boolean
val addTopMargin: Boolean
val showTimestamp: Boolean

@Parcelize
data class Default(override val showAvatar: Boolean,
override val showDisplayName: Boolean,
override val showTimestamp: Boolean,
override val addTopMargin: Boolean = false,
// Keep defaultLayout generated on epoxy items
override val layoutRes: Int = 0) : TimelineMessageLayout

Expand All @@ -38,6 +40,7 @@ sealed interface TimelineMessageLayout : Parcelable {
override val showAvatar: Boolean,
override val showDisplayName: Boolean,
override val showTimestamp: Boolean = true,
override val addTopMargin: Boolean = false,
val isIncoming: Boolean,
val isPseudoBubble: Boolean,
val cornersRadius: CornersRadius,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class TimelineMessageLayoutFactory @Inject constructor(private val session: Sess
TimelineMessageLayout.Bubble(
showAvatar = showInformation && !isSentByMe,
showDisplayName = showInformation && !isSentByMe,
addTopMargin = isFirstFromThisSender && isSentByMe,
isIncoming = !isSentByMe,
cornersRadius = cornersRadius,
isPseudoBubble = messageContent.isPseudoBubble(),
Expand Down

0 comments on commit abd58c5

Please sign in to comment.