- Fixes after review.

Signed-off-by: Ahmed Radhouane Belkilani <arbelkilani@gmail.com>
This commit is contained in:
Ahmed Radhouane Belkilani 2022-02-22 08:58:15 +01:00
parent b39a3ab42e
commit 91ab4726ad
7 changed files with 11 additions and 14 deletions

View file

@ -16,7 +16,6 @@
package org.matrix.android.sdk.api.session.room.sender
import org.matrix.android.sdk.api.util.MatrixItem
import org.matrix.android.sdk.internal.util.replaceSpaceChars
data class SenderInfo(
@ -36,5 +35,3 @@ data class SenderInfo(
else -> "$displayName ($userId)"
}
}
fun SenderInfo.toMatrixItem() = MatrixItem.UserItem(userId, displayName, avatarUrl)

View file

@ -124,7 +124,7 @@ else
chmod u+x ${checkLongFilesScript}
fi
maxLines=2500
maxLines=2800
echo
echo "Search for kotlin files with more than ${maxLines} lines..."

View file

@ -38,7 +38,7 @@ class TypingMessageAvatar @JvmOverloads constructor(
const val OVERLAP_FACT0R = -3 // =~ 30% to left
}
fun render(typingUsers: List<SenderInfo>, avatarRender: AvatarRenderer) {
fun render(typingUsers: List<SenderInfo>, avatarRenderer: AvatarRenderer) {
removeAllViews()
for ((index, value) in typingUsers.withIndex()) {
val avatar = ImageView(context)
@ -48,7 +48,7 @@ class TypingMessageAvatar @JvmOverloads constructor(
layoutParams.width = DimensionConverter(resources).dpToPx(AVATAR_SIZE_DP)
layoutParams.height = DimensionConverter(resources).dpToPx(AVATAR_SIZE_DP)
avatar.layoutParams = layoutParams
avatarRender.render(value.toMatrixItem(), avatar)
avatarRenderer.render(value.toMatrixItem(), avatar)
addView(avatar)
}
}

View file

@ -43,9 +43,9 @@ class TypingMessageView @JvmOverloads constructor(
views = TypingMessageLayoutBinding.bind(this)
}
fun render(typingUsers: List<SenderInfo>, avatarRender: AvatarRenderer) {
fun render(typingUsers: List<SenderInfo>, avatarRenderer: AvatarRenderer) {
views.usersName.text = typingHelper.getNotificationTypingMessage(typingUsers)
views.avatars.render(typingUsers, avatarRender)
views.avatars.render(typingUsers, avatarRenderer)
}
override fun onDetachedFromWindow() {

View file

@ -1608,9 +1608,9 @@ class TimelineFragment @Inject constructor(
private fun renderTypingMessageNotification(roomSummary: RoomSummary?, state: RoomDetailViewState) {
if (!isThreadTimeLine() && roomSummary != null) {
views.typingMessageView.isInvisible = state.typingUsers.isNullOrEmpty()
state.typingUsers?.let { senders ->
views.typingMessageView.render(senders.take(MAX_TYPING_MESSAGE_USERS_COUNT), avatarRenderer)
}
state.typingUsers
?.take(MAX_TYPING_MESSAGE_USERS_COUNT)
?.let { senders -> views.typingMessageView.render(senders, avatarRenderer) }
} else {
views.typingMessageView.isInvisible = true
}

View file

@ -97,7 +97,7 @@
android:layout_width="0dp"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:visibility="invisible"
tools:visibility="visible"
android:layout_height="20dp"/>
<im.vector.app.core.ui.views.NotificationAreaView
@ -107,7 +107,8 @@
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
tools:visibility="visible"/>
<ViewStub
android:id="@+id/failedMessagesWarningStub"

View file

@ -956,7 +956,6 @@
<string name="room_one_user_is_typing">%s is typing…</string>
<string name="room_two_users_are_typing">%1$s &#038; %2$s are typing…</string>
<string name="room_many_users_are_typing">%1$s &#038; %2$s &#038; others are typing…</string>
<!--TODO #3296 add next two strings values -->
<string name="room_notification_two_users_are_typing">%1$s and %2$s</string>
<string name="room_notification_more_than_two_users_are_typing">%1$s, %2$s and others</string>
<string name="room_message_placeholder_encrypted">Send an encrypted message…</string>