custom_emoji: fix showing emojis that may look like a regular expression

This commit is contained in:
Alibek Omarov 2020-04-10 02:14:33 +03:00
parent df315a3f3e
commit 6100868c7a
1 changed files with 2 additions and 1 deletions

View File

@ -56,7 +56,8 @@ public class CustomEmojiHelper {
SpannableStringBuilder builder = new SpannableStringBuilder(text);
for (Emoji emoji : emojis) {
CharSequence pattern = new StringBuilder(":").append(emoji.getShortcode()).append(':');
Matcher matcher = Pattern.compile(pattern.toString()).matcher(text);
Matcher matcher = Pattern.compile(pattern.toString(), Pattern.LITERAL)
.matcher(text);
while (matcher.find()) {
EmojiSpan span = new EmojiSpan(view);
builder.setSpan(span, matcher.start(), matcher.end(), 0);