Rabbit-R1/android (non root)/java/sources/androidx/emoji2/viewsintegration/EmojiEditableFactory.java

39 lines
1.2 KiB
Java
Raw Normal View History

2024-05-21 16:08:36 -05:00
package androidx.emoji2.viewsintegration;
import android.text.Editable;
import androidx.emoji2.text.SpannableBuilder;
/* loaded from: classes2.dex */
final class EmojiEditableFactory extends Editable.Factory {
private static final Object INSTANCE_LOCK = new Object();
private static volatile Editable.Factory sInstance;
private static Class<?> sWatcherClass;
private EmojiEditableFactory() {
try {
sWatcherClass = Class.forName("android.text.DynamicLayout$ChangeWatcher", false, getClass().getClassLoader());
} catch (Throwable unused) {
}
}
public static Editable.Factory getInstance() {
if (sInstance == null) {
synchronized (INSTANCE_LOCK) {
if (sInstance == null) {
sInstance = new EmojiEditableFactory();
}
}
}
return sInstance;
}
@Override // android.text.Editable.Factory
public Editable newEditable(CharSequence charSequence) {
Class<?> cls = sWatcherClass;
if (cls != null) {
return SpannableBuilder.create(cls, charSequence);
}
return super.newEditable(charSequence);
}
}