diff --git a/library/ui-styles/src/main/res/values/dimens.xml b/library/ui-styles/src/main/res/values/dimens.xml
index 826cde5eba..70d051b457 100644
--- a/library/ui-styles/src/main/res/values/dimens.xml
+++ b/library/ui-styles/src/main/res/values/dimens.xml
@@ -9,6 +9,7 @@
32dp
50dp
+ 20dp
16dp
32dp
diff --git a/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageAvatar.kt b/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageAvatar.kt
index 22312f36fa..1f78584a6b 100644
--- a/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageAvatar.kt
+++ b/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageAvatar.kt
@@ -22,7 +22,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.LinearLayout
-import im.vector.app.core.utils.DimensionConverter
+import im.vector.app.R
import im.vector.app.features.home.AvatarRenderer
import org.matrix.android.sdk.api.session.room.sender.SenderInfo
import org.matrix.android.sdk.api.util.toMatrixItem
@@ -34,19 +34,22 @@ class TypingMessageAvatar @JvmOverloads constructor(
) : LinearLayout(context, attrs, defStyleAttr) {
companion object {
- const val AVATAR_SIZE_DP = 20
const val OVERLAP_FACT0R = -3 // =~ 30% to left
}
+ private val typingAvatarSize by lazy(LazyThreadSafetyMode.NONE) {
+ context.resources.getDimension(R.dimen.typing_avatar_size).toInt()
+ }
+
fun render(typingUsers: List, avatarRenderer: AvatarRenderer) {
removeAllViews()
for ((index, value) in typingUsers.withIndex()) {
val avatar = ImageView(context)
avatar.id = View.generateViewId()
val layoutParams = MarginLayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
- if (index != 0) layoutParams.marginStart = DimensionConverter(resources).dpToPx(AVATAR_SIZE_DP / OVERLAP_FACT0R)
- layoutParams.width = DimensionConverter(resources).dpToPx(AVATAR_SIZE_DP)
- layoutParams.height = DimensionConverter(resources).dpToPx(AVATAR_SIZE_DP)
+ if (index != 0) layoutParams.marginStart = typingAvatarSize / OVERLAP_FACT0R
+ layoutParams.width = typingAvatarSize
+ layoutParams.height = typingAvatarSize
avatar.layoutParams = layoutParams
avatarRenderer.render(value.toMatrixItem(), avatar)
addView(avatar)
diff --git a/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageView.kt b/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageView.kt
index 2dc9eedd99..263f043fad 100644
--- a/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageView.kt
+++ b/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageView.kt
@@ -31,7 +31,8 @@ import javax.inject.Inject
class TypingMessageView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
- defStyleAttr: Int = 0) : ConstraintLayout(context, attrs, defStyleAttr) {
+ defStyleAttr: Int = 0
+) : ConstraintLayout(context, attrs, defStyleAttr) {
val views: TypingMessageLayoutBinding
@@ -44,8 +45,8 @@ class TypingMessageView @JvmOverloads constructor(
}
fun render(typingUsers: List, avatarRenderer: AvatarRenderer) {
- views.usersName.text = typingHelper.getNotificationTypingMessage(typingUsers)
- views.avatars.render(typingUsers, avatarRenderer)
+ views.typingUserText.text = typingHelper.getNotificationTypingMessage(typingUsers)
+ views.typingUserAvatars.render(typingUsers, avatarRenderer)
}
override fun onDetachedFromWindow() {
diff --git a/vector/src/main/res/layout/fragment_timeline.xml b/vector/src/main/res/layout/fragment_timeline.xml
index fcded76268..ea35d82886 100644
--- a/vector/src/main/res/layout/fragment_timeline.xml
+++ b/vector/src/main/res/layout/fragment_timeline.xml
@@ -37,13 +37,6 @@
-
-
+ app:layout_constraintTop_toBottomOf="@id/timelineRecyclerView" />
+ app:layout_constraintStart_toStartOf="parent"
+ tools:layout_height="300dp" />
+ app:layout_constraintStart_toStartOf="parent"
+ tools:visibility="visible" />
+ app:constraint_referenced_ids="composerLayout,notificationAreaView,failedMessagesWarningStub" />
diff --git a/vector/src/main/res/layout/typing_message_layout.xml b/vector/src/main/res/layout/typing_message_layout.xml
index c8b334c628..a4a2cd3305 100644
--- a/vector/src/main/res/layout/typing_message_layout.xml
+++ b/vector/src/main/res/layout/typing_message_layout.xml
@@ -1,38 +1,42 @@
+ android:layout_height="wrap_content"
+ android:paddingTop="2dp">
+
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/typingUserAvatars"
+ app:layout_constraintTop_toTopOf="parent"
+ tools:text="@sample/users.json/data/displayName" />
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/typingUserText"
+ app:layout_constraintTop_toTopOf="parent" />
-
\ No newline at end of file
+