mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-27 08:55:54 +03:00
add reactions to incoming text message (wip)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
0b898616a2
commit
dd603f25cf
2 changed files with 29 additions and 1 deletions
|
@ -36,9 +36,12 @@ import android.text.SpannableString
|
|||
import android.text.TextUtils
|
||||
import android.util.TypedValue
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.children
|
||||
import androidx.core.view.get
|
||||
import autodagger.AutoInjector
|
||||
import coil.load
|
||||
import com.amulyakhare.textdrawable.TextDrawable
|
||||
|
@ -54,6 +57,7 @@ import com.nextcloud.talk.utils.DisplayUtils
|
|||
import com.nextcloud.talk.utils.TextMatchers
|
||||
import com.nextcloud.talk.utils.preferences.AppPreferences
|
||||
import com.stfalcon.chatkit.messages.MessageHolders
|
||||
import com.vanniktech.emoji.EmojiTextView
|
||||
import java.util.HashMap
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -119,6 +123,21 @@ class MagicIncomingTextMessageViewHolder(itemView: View, payload: Any) : Message
|
|||
}
|
||||
|
||||
itemView.setTag(MessageSwipeCallback.REPLYABLE_VIEW_TAG, message.isReplyable)
|
||||
|
||||
if (message.reactions != null && message.reactions.isNotEmpty()) {
|
||||
binding.reactionsEmojiWrapper.removeAllViews()
|
||||
|
||||
for ((emoji, amount) in message.reactions) {
|
||||
val reactionEmoji = EmojiTextView(context)
|
||||
reactionEmoji.text = emoji
|
||||
|
||||
val reactionAmount = TextView(context)
|
||||
reactionAmount.text = amount.toString()
|
||||
|
||||
binding.reactionsEmojiWrapper.addView(reactionEmoji)
|
||||
binding.reactionsEmojiWrapper.addView(reactionAmount)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun processAuthor(message: ChatMessage) {
|
||||
|
|
|
@ -86,6 +86,15 @@
|
|||
android:layout_marginStart="8dp"
|
||||
android:textIsSelectable="false"
|
||||
app:layout_alignSelf="center" />
|
||||
|
||||
</com.google.android.flexbox.FlexboxLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/reactions_emoji_wrapper"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/bubble"
|
||||
android:layout_alignStart="@id/bubble"
|
||||
android:orientation="horizontal">
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Reference in a new issue