mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-27 01:54:43 +01:00
Add padding before our first message
Signed-off-by: sim <git@sgougeon.fr>
This commit is contained in:
parent
b226ab5e4b
commit
17d58f24d2
1
changelog.d/5384.misc
Normal file
1
changelog.d/5384.misc
Normal file
@ -0,0 +1 @@
|
||||
Add top margin before our first message
|
@ -105,6 +105,9 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
|
||||
} else {
|
||||
holder.timeView.isVisible = false
|
||||
}
|
||||
|
||||
holder.additionalTopSpace.isVisible = attributes.informationData.messageLayout.addTopMargin
|
||||
|
||||
// Render send state indicator
|
||||
holder.sendStateImageView.render(attributes.informationData.sendStateDecoration)
|
||||
holder.eventSendingIndicator.isVisible = attributes.informationData.sendStateDecoration == SendStateDecoration.SENDING_MEDIA
|
||||
@ -154,6 +157,7 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
|
||||
|
||||
abstract class Holder(@IdRes stubId: Int) : AbsBaseMessageItem.Holder(stubId) {
|
||||
|
||||
val additionalTopSpace by bind<View>(R.id.additionalTopSpace)
|
||||
val avatarImageView by bind<ImageView>(R.id.messageAvatarImageView)
|
||||
val memberNameView by bind<TextView>(R.id.messageMemberNameView)
|
||||
val timeView by bind<TextView>(R.id.messageTimeView)
|
||||
|
@ -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
|
||||
|
||||
@ -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,
|
||||
|
@ -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(),
|
||||
|
@ -26,12 +26,18 @@
|
||||
android:padding="2dp"
|
||||
tools:src="@sample/user_round_avatars" />
|
||||
|
||||
<View
|
||||
android:id="@+id/additionalTopSpace"
|
||||
android:layout_height="12dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_toEndOf="@id/messageStartGuideline" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/messageMemberNameView"
|
||||
style="@style/Widget.Vector.TextView.Subtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_below="@id/additionalTopSpace"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
|
Loading…
Reference in New Issue
Block a user