File tree 5 files changed +17
-1
lines changed
java/im/vector/app/features/home/room/detail/timeline
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
25
25
import android.widget.TextView
26
26
import androidx.annotation.IdRes
27
27
import androidx.constraintlayout.widget.ConstraintLayout
28
+ import androidx.core.view.isGone
28
29
import androidx.core.view.isVisible
29
30
import androidx.core.view.updateLayoutParams
30
31
import com.airbnb.epoxy.EpoxyAttribute
@@ -105,6 +106,9 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
105
106
} else {
106
107
holder.timeView.isVisible = false
107
108
}
109
+
110
+ holder.additionalTopSpace.isVisible = attributes.informationData.messageLayout.addTopMargin
111
+
108
112
// Render send state indicator
109
113
holder.sendStateImageView.render(attributes.informationData.sendStateDecoration)
110
114
holder.eventSendingIndicator.isVisible = attributes.informationData.sendStateDecoration == SendStateDecoration .SENDING_MEDIA
@@ -154,6 +158,7 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
154
158
155
159
abstract class Holder (@IdRes stubId : Int ) : AbsBaseMessageItem.Holder(stubId) {
156
160
161
+ val additionalTopSpace by bind<View >(R .id.additionalTopSpace)
157
162
val avatarImageView by bind<ImageView >(R .id.messageAvatarImageView)
158
163
val memberNameView by bind<TextView >(R .id.messageMemberNameView)
159
164
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 {
24
24
val layoutRes: Int
25
25
val showAvatar: Boolean
26
26
val showDisplayName: Boolean
27
+ val addTopMargin: Boolean
27
28
val showTimestamp: Boolean
28
29
29
30
@Parcelize
30
31
data class Default (override val showAvatar : Boolean ,
31
32
override val showDisplayName : Boolean ,
32
33
override val showTimestamp : Boolean ,
34
+ override val addTopMargin : Boolean = false ,
33
35
// Keep defaultLayout generated on epoxy items
34
36
override val layoutRes : Int = 0 ) : TimelineMessageLayout
35
37
@@ -38,6 +40,7 @@ sealed interface TimelineMessageLayout : Parcelable {
38
40
override val showAvatar : Boolean ,
39
41
override val showDisplayName : Boolean ,
40
42
override val showTimestamp : Boolean = true ,
43
+ override val addTopMargin : Boolean = false ,
41
44
val isIncoming : Boolean ,
42
45
val isPseudoBubble : Boolean ,
43
46
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
118
118
TimelineMessageLayout .Bubble (
119
119
showAvatar = showInformation && ! isSentByMe,
120
120
showDisplayName = showInformation && ! isSentByMe,
121
+ addTopMargin = isFirstFromThisSender && isSentByMe,
121
122
isIncoming = ! isSentByMe,
122
123
cornersRadius = cornersRadius,
123
124
isPseudoBubble = messageContent.isPseudoBubble(),
Original file line number Diff line number Diff line change 26
26
android : padding =" 2dp"
27
27
tools : src =" @sample/user_round_avatars" />
28
28
29
+ <View
30
+ android : id =" @+id/additionalTopSpace"
31
+ android : layout_height =" 12dp"
32
+ android : layout_width =" 0dp"
33
+ android : layout_toEndOf =" @id/messageStartGuideline" />
34
+
29
35
<TextView
30
36
android : id =" @+id/messageMemberNameView"
31
37
style =" @style/Widget.Vector.TextView.Subtitle"
32
38
android : layout_width =" wrap_content"
33
39
android : layout_height =" wrap_content"
34
- android : layout_alignParentTop = " true "
40
+ android : layout_below = " @id/additionalTopSpace "
35
41
android : layout_alignParentEnd =" true"
36
42
android : layout_marginStart =" 12dp"
37
43
android : layout_marginEnd =" 4dp"
You can’t perform that action at this time.
0 commit comments