Emoji reactions: improved dialog UI & fixed count

This commit is contained in:
Sylvain Berfini 2023-05-16 09:39:53 +02:00
parent 8249f2c3a6
commit f748424943
3 changed files with 7 additions and 6 deletions

View file

@ -75,11 +75,12 @@ class ChatMessageReactionsListData(private val chatMessage: ChatMessage) {
for (reaction in chatMessage.reactions) {
val body = reaction.body
val count = if (reactionsMap.containsKey(body)) {
reactionsMap[body] ?: 1
reactionsMap[body] ?: 0
} else {
1
0
}
reactionsMap[body] = count
// getOrDefault isn't available for API 23 :'(
reactionsMap[body] = count + 1
reactionsList.add(reaction)
}
reactions.value = reactionsList

View file

@ -11,7 +11,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="55dp"
android:padding="10dp">
<ImageView

View file

@ -33,12 +33,12 @@
android:layout_height="1dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginBottom="10dp"
android:layout_marginBottom="5dp"
android:background="?dividerColor" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="220dp">
<LinearLayout
android:layout_width="match_parent"