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( ...@@ -132,6 +132,9 @@ class MessageParser @Inject constructor(
private val builder: SpannableBuilder private val builder: SpannableBuilder
) : SpannableMarkdownVisitor(configuration, builder) { ) : SpannableMarkdownVisitor(configuration, builder) {
private val density = context.resources.displayMetrics.density
private val px = (22 * density).toInt()
override fun visit(document: Document) { override fun visit(document: Document) {
val spannable = EmojiParser.parse(context, builder.text()) val spannable = EmojiParser.parse(context, builder.text())
if (spannable is Spanned) { if (spannable is Spanned) {
...@@ -145,6 +148,7 @@ class MessageParser @Inject constructor( ...@@ -145,6 +148,7 @@ class MessageParser @Inject constructor(
} }
emojiImageSpans.forEach { emojiImageSpans.forEach {
it.drawable?.setBounds(0, 0, px, px)
builder.setSpan(it, spannable.getSpanStart(it), spannable.getSpanEnd(it), builder.setSpan(it, spannable.getSpanStart(it), spannable.getSpanEnd(it),
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) 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