Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,417 @@
package androidx.core.text;
import android.annotation.SuppressLint;
import android.os.Build;
import android.os.Trace;
import android.text.PrecomputedText;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.StaticLayout;
import android.text.TextDirectionHeuristic;
import android.text.TextDirectionHeuristics;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.style.MetricAffectingSpan;
import androidx.annotation.GuardedBy;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.UiThread;
import androidx.core.util.ObjectsCompat;
import androidx.core.util.Preconditions;
import java.util.ArrayList;
import java.util.concurrent.Callable;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
/* loaded from: classes.dex */
public class PrecomputedTextCompat implements Spannable {
private static final char LINE_FEED = '\n';
@NonNull
@GuardedBy("sLock")
private static Executor sExecutor;
private static final Object sLock = new Object();
@NonNull
private final int[] mParagraphEnds;
@NonNull
private final Params mParams;
@NonNull
private final Spannable mText;
@Nullable
private final PrecomputedText mWrapped;
@NonNull
public Params getParams() {
return this.mParams;
}
public static final class Params {
private final int mBreakStrategy;
private final int mHyphenationFrequency;
@NonNull
private final TextPaint mPaint;
@Nullable
private final TextDirectionHeuristic mTextDir;
final PrecomputedText.Params mWrapped;
@RequiresApi(23)
public int getBreakStrategy() {
return this.mBreakStrategy;
}
@RequiresApi(23)
public int getHyphenationFrequency() {
return this.mHyphenationFrequency;
}
@Nullable
public TextDirectionHeuristic getTextDirection() {
return this.mTextDir;
}
@NonNull
public TextPaint getTextPaint() {
return this.mPaint;
}
public static class Builder {
@NonNull
private final TextPaint mPaint;
private int mBreakStrategy = 1;
private int mHyphenationFrequency = 1;
private TextDirectionHeuristic mTextDir = TextDirectionHeuristics.FIRSTSTRONG_LTR;
@RequiresApi(23)
public Builder setBreakStrategy(int i) {
this.mBreakStrategy = i;
return this;
}
@RequiresApi(23)
public Builder setHyphenationFrequency(int i) {
this.mHyphenationFrequency = i;
return this;
}
public Builder setTextDirection(@NonNull TextDirectionHeuristic textDirectionHeuristic) {
this.mTextDir = textDirectionHeuristic;
return this;
}
public Builder(@NonNull TextPaint textPaint) {
this.mPaint = textPaint;
}
@NonNull
public Params build() {
return new Params(this.mPaint, this.mTextDir, this.mBreakStrategy, this.mHyphenationFrequency);
}
}
public Params(@NonNull TextPaint textPaint, @NonNull TextDirectionHeuristic textDirectionHeuristic, int i, int i2) {
PrecomputedText.Params.Builder breakStrategy;
PrecomputedText.Params.Builder hyphenationFrequency;
PrecomputedText.Params.Builder textDirection;
PrecomputedText.Params build;
if (Build.VERSION.SDK_INT >= 29) {
breakStrategy = PrecomputedTextCompat$Params$$ExternalSyntheticApiModelOutline8.m(textPaint).setBreakStrategy(i);
hyphenationFrequency = breakStrategy.setHyphenationFrequency(i2);
textDirection = hyphenationFrequency.setTextDirection(textDirectionHeuristic);
build = textDirection.build();
this.mWrapped = build;
} else {
this.mWrapped = null;
}
this.mPaint = textPaint;
this.mTextDir = textDirectionHeuristic;
this.mBreakStrategy = i;
this.mHyphenationFrequency = i2;
}
@RequiresApi(28)
public Params(@NonNull PrecomputedText.Params params) {
TextPaint textPaint;
TextDirectionHeuristic textDirection;
int breakStrategy;
int hyphenationFrequency;
textPaint = params.getTextPaint();
this.mPaint = textPaint;
textDirection = params.getTextDirection();
this.mTextDir = textDirection;
breakStrategy = params.getBreakStrategy();
this.mBreakStrategy = breakStrategy;
hyphenationFrequency = params.getHyphenationFrequency();
this.mHyphenationFrequency = hyphenationFrequency;
this.mWrapped = Build.VERSION.SDK_INT < 29 ? null : params;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public boolean equalsWithoutTextDirection(@NonNull Params params) {
if (this.mBreakStrategy == params.getBreakStrategy() && this.mHyphenationFrequency == params.getHyphenationFrequency() && this.mPaint.getTextSize() == params.getTextPaint().getTextSize() && this.mPaint.getTextScaleX() == params.getTextPaint().getTextScaleX() && this.mPaint.getTextSkewX() == params.getTextPaint().getTextSkewX() && this.mPaint.getLetterSpacing() == params.getTextPaint().getLetterSpacing() && TextUtils.equals(this.mPaint.getFontFeatureSettings(), params.getTextPaint().getFontFeatureSettings()) && this.mPaint.getFlags() == params.getTextPaint().getFlags() && this.mPaint.getTextLocales().equals(params.getTextPaint().getTextLocales())) {
return this.mPaint.getTypeface() == null ? params.getTextPaint().getTypeface() == null : this.mPaint.getTypeface().equals(params.getTextPaint().getTypeface());
}
return false;
}
public boolean equals(@Nullable Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof Params)) {
return false;
}
Params params = (Params) obj;
return equalsWithoutTextDirection(params) && this.mTextDir == params.getTextDirection();
}
public int hashCode() {
return ObjectsCompat.hash(Float.valueOf(this.mPaint.getTextSize()), Float.valueOf(this.mPaint.getTextScaleX()), Float.valueOf(this.mPaint.getTextSkewX()), Float.valueOf(this.mPaint.getLetterSpacing()), Integer.valueOf(this.mPaint.getFlags()), this.mPaint.getTextLocales(), this.mPaint.getTypeface(), Boolean.valueOf(this.mPaint.isElegantTextHeight()), this.mTextDir, Integer.valueOf(this.mBreakStrategy), Integer.valueOf(this.mHyphenationFrequency));
}
public String toString() {
StringBuilder sb = new StringBuilder("{");
sb.append("textSize=" + this.mPaint.getTextSize());
sb.append(", textScaleX=" + this.mPaint.getTextScaleX());
sb.append(", textSkewX=" + this.mPaint.getTextSkewX());
sb.append(", letterSpacing=" + this.mPaint.getLetterSpacing());
sb.append(", elegantTextHeight=" + this.mPaint.isElegantTextHeight());
sb.append(", textLocale=" + this.mPaint.getTextLocales());
sb.append(", typeface=" + this.mPaint.getTypeface());
sb.append(", variationSettings=" + this.mPaint.getFontVariationSettings());
sb.append(", textDir=" + this.mTextDir);
sb.append(", breakStrategy=" + this.mBreakStrategy);
sb.append(", hyphenationFrequency=" + this.mHyphenationFrequency);
sb.append("}");
return sb.toString();
}
}
@SuppressLint({"WrongConstant"})
public static PrecomputedTextCompat create(@NonNull CharSequence charSequence, @NonNull Params params) {
PrecomputedText.Params params2;
PrecomputedText create;
Preconditions.checkNotNull(charSequence);
Preconditions.checkNotNull(params);
try {
Trace.beginSection("PrecomputedText");
if (Build.VERSION.SDK_INT >= 29 && (params2 = params.mWrapped) != null) {
create = PrecomputedText.create(charSequence, params2);
return new PrecomputedTextCompat(create, params);
}
ArrayList arrayList = new ArrayList();
int length = charSequence.length();
int i = 0;
while (i < length) {
int indexOf = TextUtils.indexOf(charSequence, LINE_FEED, i, length);
i = indexOf < 0 ? length : indexOf + 1;
arrayList.add(Integer.valueOf(i));
}
int[] iArr = new int[arrayList.size()];
for (int i2 = 0; i2 < arrayList.size(); i2++) {
iArr[i2] = ((Integer) arrayList.get(i2)).intValue();
}
StaticLayout.Builder.obtain(charSequence, 0, charSequence.length(), params.getTextPaint(), Integer.MAX_VALUE).setBreakStrategy(params.getBreakStrategy()).setHyphenationFrequency(params.getHyphenationFrequency()).setTextDirection(params.getTextDirection()).build();
return new PrecomputedTextCompat(charSequence, params, iArr);
} finally {
Trace.endSection();
}
}
private PrecomputedTextCompat(@NonNull CharSequence charSequence, @NonNull Params params, @NonNull int[] iArr) {
this.mText = new SpannableString(charSequence);
this.mParams = params;
this.mParagraphEnds = iArr;
this.mWrapped = null;
}
@RequiresApi(28)
private PrecomputedTextCompat(@NonNull PrecomputedText precomputedText, @NonNull Params params) {
this.mText = Api28Impl.castToSpannable(precomputedText);
this.mParams = params;
this.mParagraphEnds = null;
this.mWrapped = Build.VERSION.SDK_INT < 29 ? null : precomputedText;
}
@Nullable
@RequiresApi(28)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PrecomputedText getPrecomputedText() {
if (PrecomputedTextCompat$$ExternalSyntheticApiModelOutline0.m(this.mText)) {
return PrecomputedTextCompat$$ExternalSyntheticApiModelOutline1.m(this.mText);
}
return null;
}
@IntRange(from = 0)
public int getParagraphCount() {
int paragraphCount;
if (Build.VERSION.SDK_INT >= 29) {
paragraphCount = this.mWrapped.getParagraphCount();
return paragraphCount;
}
return this.mParagraphEnds.length;
}
@IntRange(from = 0)
public int getParagraphStart(@IntRange(from = 0) int i) {
int paragraphStart;
Preconditions.checkArgumentInRange(i, 0, getParagraphCount(), "paraIndex");
if (Build.VERSION.SDK_INT >= 29) {
paragraphStart = this.mWrapped.getParagraphStart(i);
return paragraphStart;
}
if (i == 0) {
return 0;
}
return this.mParagraphEnds[i - 1];
}
@IntRange(from = 0)
public int getParagraphEnd(@IntRange(from = 0) int i) {
int paragraphEnd;
Preconditions.checkArgumentInRange(i, 0, getParagraphCount(), "paraIndex");
if (Build.VERSION.SDK_INT >= 29) {
paragraphEnd = this.mWrapped.getParagraphEnd(i);
return paragraphEnd;
}
return this.mParagraphEnds[i];
}
public static class PrecomputedTextFutureTask extends FutureTask<PrecomputedTextCompat> {
public static class PrecomputedTextCallback implements Callable<PrecomputedTextCompat> {
private Params mParams;
private CharSequence mText;
public PrecomputedTextCallback(@NonNull Params params, @NonNull CharSequence charSequence) {
this.mParams = params;
this.mText = charSequence;
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // java.util.concurrent.Callable
public PrecomputedTextCompat call() throws Exception {
return PrecomputedTextCompat.create(this.mText, this.mParams);
}
}
public PrecomputedTextFutureTask(@NonNull Params params, @NonNull CharSequence charSequence) {
super(new PrecomputedTextCallback(params, charSequence));
}
}
@UiThread
public static Future<PrecomputedTextCompat> getTextFuture(@NonNull CharSequence charSequence, @NonNull Params params, @Nullable Executor executor) {
PrecomputedTextFutureTask precomputedTextFutureTask = new PrecomputedTextFutureTask(params, charSequence);
if (executor == null) {
synchronized (sLock) {
try {
if (sExecutor == null) {
sExecutor = Executors.newFixedThreadPool(1);
}
executor = sExecutor;
} finally {
}
}
}
executor.execute(precomputedTextFutureTask);
return precomputedTextFutureTask;
}
@Override // android.text.Spannable
public void setSpan(Object obj, int i, int i2, int i3) {
if (obj instanceof MetricAffectingSpan) {
throw new IllegalArgumentException("MetricAffectingSpan can not be set to PrecomputedText.");
}
if (Build.VERSION.SDK_INT >= 29) {
this.mWrapped.setSpan(obj, i, i2, i3);
} else {
this.mText.setSpan(obj, i, i2, i3);
}
}
@Override // android.text.Spannable
public void removeSpan(Object obj) {
if (obj instanceof MetricAffectingSpan) {
throw new IllegalArgumentException("MetricAffectingSpan can not be removed from PrecomputedText.");
}
if (Build.VERSION.SDK_INT >= 29) {
this.mWrapped.removeSpan(obj);
} else {
this.mText.removeSpan(obj);
}
}
@Override // android.text.Spanned
public <T> T[] getSpans(int i, int i2, Class<T> cls) {
Object[] spans;
if (Build.VERSION.SDK_INT >= 29) {
spans = this.mWrapped.getSpans(i, i2, cls);
return (T[]) spans;
}
return (T[]) this.mText.getSpans(i, i2, cls);
}
@Override // android.text.Spanned
public int getSpanStart(Object obj) {
return this.mText.getSpanStart(obj);
}
@Override // android.text.Spanned
public int getSpanEnd(Object obj) {
return this.mText.getSpanEnd(obj);
}
@Override // android.text.Spanned
public int getSpanFlags(Object obj) {
return this.mText.getSpanFlags(obj);
}
@Override // android.text.Spanned
public int nextSpanTransition(int i, int i2, Class cls) {
return this.mText.nextSpanTransition(i, i2, cls);
}
@Override // java.lang.CharSequence
public int length() {
return this.mText.length();
}
@Override // java.lang.CharSequence
public char charAt(int i) {
return this.mText.charAt(i);
}
@Override // java.lang.CharSequence
public CharSequence subSequence(int i, int i2) {
return this.mText.subSequence(i, i2);
}
@Override // java.lang.CharSequence
@NonNull
public String toString() {
return this.mText.toString();
}
@RequiresApi(28)
public static class Api28Impl {
public static Spannable castToSpannable(PrecomputedText precomputedText) {
return precomputedText;
}
private Api28Impl() {
}
}
}