File tree Expand file tree Collapse file tree 5 files changed +17
-1
lines changed
java/im/vector/app/features/home/room/detail/timeline Expand file tree Collapse file tree 5 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 1+ Add top margin before our first message
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import android.widget.RelativeLayout
2525import android.widget.TextView
2626import androidx.annotation.IdRes
2727import androidx.constraintlayout.widget.ConstraintLayout
28+ import androidx.core.view.isGone
2829import androidx.core.view.isVisible
2930import androidx.core.view.updateLayoutParams
3031import com.airbnb.epoxy.EpoxyAttribute
@@ -105,6 +106,9 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
105106 } else {
106107 holder.timeView.isVisible = false
107108 }
109+
110+ holder.additionalTopSpace.isVisible = attributes.informationData.messageLayout.addTopMargin
111+
108112 // Render send state indicator
109113 holder.sendStateImageView.render(attributes.informationData.sendStateDecoration)
110114 holder.eventSendingIndicator.isVisible = attributes.informationData.sendStateDecoration == SendStateDecoration .SENDING_MEDIA
@@ -154,6 +158,7 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
154158
155159 abstract class Holder (@IdRes stubId : Int ) : AbsBaseMessageItem.Holder(stubId) {
156160
161+ val additionalTopSpace by bind<View >(R .id.additionalTopSpace)
157162 val avatarImageView by bind<ImageView >(R .id.messageAvatarImageView)
158163 val memberNameView by bind<TextView >(R .id.messageMemberNameView)
159164 val timeView by bind<TextView >(R .id.messageTimeView)
Original file line number Diff line number Diff line change @@ -24,12 +24,14 @@ sealed interface TimelineMessageLayout : Parcelable {
2424 val layoutRes: Int
2525 val showAvatar: Boolean
2626 val showDisplayName: Boolean
27+ val addTopMargin: Boolean
2728 val showTimestamp: Boolean
2829
2930 @Parcelize
3031 data class Default (override val showAvatar : Boolean ,
3132 override val showDisplayName : Boolean ,
3233 override val showTimestamp : Boolean ,
34+ override val addTopMargin : Boolean = false ,
3335 // Keep defaultLayout generated on epoxy items
3436 override val layoutRes : Int = 0 ) : TimelineMessageLayout
3537
@@ -38,6 +40,7 @@ sealed interface TimelineMessageLayout : Parcelable {
3840 override val showAvatar : Boolean ,
3941 override val showDisplayName : Boolean ,
4042 override val showTimestamp : Boolean = true ,
43+ override val addTopMargin : Boolean = false ,
4144 val isIncoming : Boolean ,
4245 val isPseudoBubble : Boolean ,
4346 val cornersRadius : CornersRadius ,
Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ class TimelineMessageLayoutFactory @Inject constructor(private val session: Sess
118118 TimelineMessageLayout .Bubble (
119119 showAvatar = showInformation && ! isSentByMe,
120120 showDisplayName = showInformation && ! isSentByMe,
121+ addTopMargin = isFirstFromThisSender && isSentByMe,
121122 isIncoming = ! isSentByMe,
122123 cornersRadius = cornersRadius,
123124 isPseudoBubble = messageContent.isPseudoBubble(),
Original file line number Diff line number Diff line change 2626 android : padding =" 2dp"
2727 tools : src =" @sample/user_round_avatars" />
2828
29+ <View
30+ android : id =" @+id/additionalTopSpace"
31+ android : layout_height =" 12dp"
32+ android : layout_width =" 0dp"
33+ android : layout_toEndOf =" @id/messageStartGuideline" />
34+
2935 <TextView
3036 android : id =" @+id/messageMemberNameView"
3137 style =" @style/Widget.Vector.TextView.Subtitle"
3238 android : layout_width =" wrap_content"
3339 android : layout_height =" wrap_content"
34- android : layout_alignParentTop = " true "
40+ android : layout_below = " @id/additionalTopSpace "
3541 android : layout_alignParentEnd =" true"
3642 android : layout_marginStart =" 12dp"
3743 android : layout_marginEnd =" 4dp"
You can’t perform that action at this time.
0 commit comments