use of org.thoughtcrime.securesms.components.emoji.parsing.EmojiParser in project Signal-Android by WhisperSystems.
the class EmojiProvider method emojify.
@Nullable
Spannable emojify(@Nullable CharSequence text, @NonNull TextView tv) {
if (text == null)
return null;
List<EmojiParser.Candidate> matches = new EmojiParser(emojiTree).findCandidates(text);
SpannableStringBuilder builder = new SpannableStringBuilder(text);
for (EmojiParser.Candidate candidate : matches) {
Drawable drawable = getEmojiDrawable(candidate.getDrawInfo());
if (drawable != null) {
builder.setSpan(new EmojiSpan(drawable, tv), candidate.getStartIndex(), candidate.getEndIndex(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
return builder;
}
Aggregations