Commit b88cd88b authored by Leonardo Aramaki's avatar Leonardo Aramaki

Set bounds to drawable for custom emojis when message is parsed

parent 08142dce
......@@ -132,6 +132,9 @@ class MessageParser @Inject constructor(
private val builder: SpannableBuilder
) : SpannableMarkdownVisitor(configuration, builder) {
private val density = context.resources.displayMetrics.density
private val px = (22 * density).toInt()
override fun visit(document: Document) {
val spannable = EmojiParser.parse(context, builder.text())
if (spannable is Spanned) {
......@@ -145,6 +148,7 @@ class MessageParser @Inject constructor(
}
emojiImageSpans.forEach {
it.drawable?.setBounds(0, 0, px, px)
builder.setSpan(it, spannable.getSpanStart(it), spannable.getSpanEnd(it),
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment