Rabbit-R1/android (non root)/java/sources/androidx/emoji2/text/DefaultGlyphChecker.java
2024-05-21 17:08:36 -04:00

39 lines
1.4 KiB
Java

package androidx.emoji2.text;
import android.text.TextPaint;
import androidx.core.graphics.PaintCompat;
import androidx.emoji2.text.EmojiCompat;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class DefaultGlyphChecker implements EmojiCompat.GlyphChecker {
private static final int PAINT_TEXT_SIZE = 10;
private static final ThreadLocal<StringBuilder> sStringBuilder = new ThreadLocal<>();
private final TextPaint mTextPaint;
/* JADX INFO: Access modifiers changed from: package-private */
public DefaultGlyphChecker() {
TextPaint textPaint = new TextPaint();
this.mTextPaint = textPaint;
textPaint.setTextSize(10.0f);
}
@Override // androidx.emoji2.text.EmojiCompat.GlyphChecker
public boolean hasGlyph(CharSequence charSequence, int i, int i2, int i3) {
StringBuilder stringBuilder = getStringBuilder();
stringBuilder.setLength(0);
while (i < i2) {
stringBuilder.append(charSequence.charAt(i));
i++;
}
return PaintCompat.hasGlyph(this.mTextPaint, stringBuilder.toString());
}
private static StringBuilder getStringBuilder() {
ThreadLocal<StringBuilder> threadLocal = sStringBuilder;
if (threadLocal.get() == null) {
threadLocal.set(new StringBuilder());
}
return threadLocal.get();
}
}