Skip to content

Commit

Permalink
Also replace old emojis when emojifying with EmojiCompat
Browse files Browse the repository at this point in the history
By default, `EmojiCompat` only adds emoji glyphs for those emojis that are
currently missing in the platform, which results in mismatched emoji styles.
This change makes all emojis appear in modern style.
  • Loading branch information
oakkitten committed Mar 9, 2024
1 parent 3a8f7a9 commit cc88820
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ fun initEmojiCompat() {

var emojiCompat: EmojiCompat? = null

config.setReplaceAll(true)
config.setRetryPolicy(ExponentialBackoffRetryPolicy(5 * 60 * 1000))
config.setMetadataLoadStrategy(LOAD_STRATEGY_MANUAL)
config.registerInitCallback(object : InitCallback() {
Expand All @@ -58,7 +59,7 @@ fun initEmojiCompat() {
@Volatile private var emojiCompatOrNull: EmojiCompat? = null


// Replace missing emojis with modern emojis
// Replace old and missing emojis with modern emojis
@SuppressLint("CheckResult") // Calling process() returns the given input if it is Spannable.
fun emojify(text: Spannable) {
emojiCompatOrNull?.process(text)
Expand Down

0 comments on commit cc88820

Please sign in to comment.