Use emoji2 library
This commit is contained in:
parent
b701bb7c1a
commit
df3f8bd88e
|
@ -449,7 +449,7 @@ dependencies {
|
|||
// OSS License, gplay flavor only
|
||||
gplayImplementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'
|
||||
|
||||
implementation "androidx.emoji:emoji-appcompat:1.1.0"
|
||||
implementation "androidx.emoji2:emoji2:1.0.0"
|
||||
implementation('com.github.BillCarsonFr:JsonViewer:0.7')
|
||||
|
||||
// WebRTC
|
||||
|
|
|
@ -398,6 +398,9 @@
|
|||
android:name="androidx.work.WorkManagerInitializer"
|
||||
android:value="androidx.startup"
|
||||
tools:node="remove" />
|
||||
<!-- We init the lib ourself in EmojiCompatWrapper -->
|
||||
<meta-data android:name="androidx.emoji2.text.EmojiCompatInitializer"
|
||||
tools:node="remove" />
|
||||
</provider>
|
||||
|
||||
<provider
|
||||
|
|
|
@ -17,8 +17,8 @@ package im.vector.app
|
|||
|
||||
import android.content.Context
|
||||
import androidx.core.provider.FontRequest
|
||||
import androidx.emoji.text.EmojiCompat
|
||||
import androidx.emoji.text.FontRequestEmojiCompatConfig
|
||||
import androidx.emoji2.text.EmojiCompat
|
||||
import androidx.emoji2.text.FontRequestEmojiCompatConfig
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
@ -52,7 +52,7 @@ class EmojiCompatWrapper @Inject constructor(private val context: Context) {
|
|||
fun safeEmojiSpanify(sequence: CharSequence): CharSequence {
|
||||
if (initialized) {
|
||||
try {
|
||||
return EmojiCompat.get().process(sequence)
|
||||
return EmojiCompat.get().process(sequence) ?: sequence
|
||||
} catch (throwable: Throwable) {
|
||||
// Defensive coding against error (should not happend as it is initialized)
|
||||
Timber.e(throwable, "Failed to init EmojiCompat")
|
||||
|
|
|
@ -21,7 +21,7 @@ import android.text.Spanned
|
|||
import android.text.style.MetricAffectingSpan
|
||||
import android.text.style.StrikethroughSpan
|
||||
import android.text.style.UnderlineSpan
|
||||
import androidx.emoji.text.EmojiCompat
|
||||
import androidx.emoji2.text.EmojiCompat
|
||||
import javax.inject.Inject
|
||||
|
||||
class SpanUtils @Inject constructor() {
|
||||
|
|
Loading…
Reference in New Issue