mirror of
https://github.com/nextcloud/talk-android
synced 2025-08-03 01:55:40 +01:00
show max 4 emojis under message
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
f45b48898f
commit
2a1f2becbd
@ -127,6 +127,8 @@ class MagicIncomingTextMessageViewHolder(itemView: View, payload: Any) : Message
|
|||||||
if (message.reactions != null && message.reactions.isNotEmpty()) {
|
if (message.reactions != null && message.reactions.isNotEmpty()) {
|
||||||
binding.reactionsEmojiWrapper.removeAllViews()
|
binding.reactionsEmojiWrapper.removeAllViews()
|
||||||
|
|
||||||
|
var remainingEmojisToDisplay = MAX_EMOJIS_TO_DISPLAY
|
||||||
|
val showInfoAboutMoreEmojis = message.reactions.size > MAX_EMOJIS_TO_DISPLAY
|
||||||
for ((emoji, amount) in message.reactions) {
|
for ((emoji, amount) in message.reactions) {
|
||||||
val reactionEmoji = EmojiTextView(context)
|
val reactionEmoji = EmojiTextView(context)
|
||||||
reactionEmoji.text = emoji
|
reactionEmoji.text = emoji
|
||||||
@ -136,6 +138,14 @@ class MagicIncomingTextMessageViewHolder(itemView: View, payload: Any) : Message
|
|||||||
|
|
||||||
binding.reactionsEmojiWrapper.addView(reactionEmoji)
|
binding.reactionsEmojiWrapper.addView(reactionEmoji)
|
||||||
binding.reactionsEmojiWrapper.addView(reactionAmount)
|
binding.reactionsEmojiWrapper.addView(reactionAmount)
|
||||||
|
|
||||||
|
remainingEmojisToDisplay--
|
||||||
|
if (remainingEmojisToDisplay == 0 && showInfoAboutMoreEmojis) {
|
||||||
|
val infoAboutMoreEmojis = TextView(context)
|
||||||
|
infoAboutMoreEmojis.text = "..."
|
||||||
|
binding.reactionsEmojiWrapper.addView(infoAboutMoreEmojis)
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,5 +291,6 @@ class MagicIncomingTextMessageViewHolder(itemView: View, payload: Any) : Message
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val TEXT_SIZE_MULTIPLIER = 2.5
|
const val TEXT_SIZE_MULTIPLIER = 2.5
|
||||||
|
const val MAX_EMOJIS_TO_DISPLAY = 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user