Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Fixes after review.

Signed-off-by: Ahmed Radhouane Belkilani <[email protected]>
  • Loading branch information
ahmed-radhouane committed Feb 22, 2022
1 parent e3aae38 commit bfd31fb
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -36,5 +35,3 @@ data class SenderInfo(
else -> "$displayName ($userId)"
}
}

fun SenderInfo.toMatrixItem() = MatrixItem.UserItem(userId, displayName, avatarUrl)
2 changes: 1 addition & 1 deletion tools/check/check_code_quality.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1604,9 +1604,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
}
Expand Down
5 changes: 3 additions & 2 deletions vector/src/main/res/layout/fragment_timeline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,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>
Expand Down

0 comments on commit bfd31fb

Please sign in to comment.