248 lines
8.8 KiB
Java
248 lines
8.8 KiB
Java
package androidx.core.text;
|
|
|
|
import android.graphics.Typeface;
|
|
import android.os.Build;
|
|
import android.os.LocaleList;
|
|
import android.text.PrecomputedText;
|
|
import android.text.Spannable;
|
|
import android.text.TextDirectionHeuristic;
|
|
import android.text.TextDirectionHeuristics;
|
|
import android.text.TextPaint;
|
|
import android.text.TextUtils;
|
|
import android.text.style.MetricAffectingSpan;
|
|
import com.airbnb.deeplinkdispatch.UrlTreeKt;
|
|
import o.ZEY;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class PrecomputedTextCompat implements Spannable {
|
|
private static final Object a = new Object();
|
|
private final Params b;
|
|
private final PrecomputedText c;
|
|
private final Spannable d;
|
|
|
|
/* loaded from: classes.dex */
|
|
public static final class Params {
|
|
final PrecomputedText.Params a;
|
|
private final TextPaint b;
|
|
private final TextDirectionHeuristic c;
|
|
private final int d;
|
|
private final int e;
|
|
|
|
/* loaded from: classes.dex */
|
|
public static class IeS {
|
|
private int b = 1;
|
|
private int c = 1;
|
|
private TextDirectionHeuristic d = TextDirectionHeuristics.FIRSTSTRONG_LTR;
|
|
private final TextPaint e;
|
|
|
|
public IeS(TextPaint textPaint) {
|
|
this.e = textPaint;
|
|
}
|
|
|
|
public Params a() {
|
|
return new Params(this.e, this.d, this.b, this.c);
|
|
}
|
|
|
|
public IeS qN_(TextDirectionHeuristic textDirectionHeuristic) {
|
|
this.d = textDirectionHeuristic;
|
|
return this;
|
|
}
|
|
|
|
public IeS b(int i) {
|
|
this.c = i;
|
|
return this;
|
|
}
|
|
|
|
public IeS c(int i) {
|
|
this.b = i;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
Params(TextPaint textPaint, TextDirectionHeuristic textDirectionHeuristic, int i, int i2) {
|
|
this.a = Build.VERSION.SDK_INT >= 29 ? new PrecomputedText.Params.Builder(textPaint).setBreakStrategy(i).setHyphenationFrequency(i2).setTextDirection(textDirectionHeuristic).build() : null;
|
|
this.b = textPaint;
|
|
this.c = textDirectionHeuristic;
|
|
this.d = i;
|
|
this.e = i2;
|
|
}
|
|
|
|
public Params(PrecomputedText.Params params) {
|
|
this.b = params.getTextPaint();
|
|
this.c = params.getTextDirection();
|
|
this.d = params.getBreakStrategy();
|
|
this.e = params.getHyphenationFrequency();
|
|
this.a = Build.VERSION.SDK_INT < 29 ? null : params;
|
|
}
|
|
|
|
public final boolean d(Params params) {
|
|
if (this.d == params.c() && this.e == params.e() && this.b.getTextSize() == params.qM_().getTextSize() && this.b.getTextScaleX() == params.qM_().getTextScaleX() && this.b.getTextSkewX() == params.qM_().getTextSkewX() && this.b.getLetterSpacing() == params.qM_().getLetterSpacing() && TextUtils.equals(this.b.getFontFeatureSettings(), params.qM_().getFontFeatureSettings()) && this.b.getFlags() == params.qM_().getFlags() && this.b.getTextLocales().equals(params.qM_().getTextLocales())) {
|
|
return this.b.getTypeface() == null ? params.qM_().getTypeface() == null : this.b.getTypeface().equals(params.qM_().getTypeface());
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final boolean equals(Object obj) {
|
|
if (obj == this) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof Params)) {
|
|
return false;
|
|
}
|
|
Params params = (Params) obj;
|
|
return d(params) && this.c == params.qL_();
|
|
}
|
|
|
|
public final int hashCode() {
|
|
float textSize = this.b.getTextSize();
|
|
float textScaleX = this.b.getTextScaleX();
|
|
float textSkewX = this.b.getTextSkewX();
|
|
float letterSpacing = this.b.getLetterSpacing();
|
|
int flags = this.b.getFlags();
|
|
LocaleList textLocales = this.b.getTextLocales();
|
|
Typeface typeface = this.b.getTypeface();
|
|
boolean isElegantTextHeight = this.b.isElegantTextHeight();
|
|
return ZEY.d(Float.valueOf(textSize), Float.valueOf(textScaleX), Float.valueOf(textSkewX), Float.valueOf(letterSpacing), Integer.valueOf(flags), textLocales, typeface, Boolean.valueOf(isElegantTextHeight), this.c, Integer.valueOf(this.d), Integer.valueOf(this.e));
|
|
}
|
|
|
|
public final String toString() {
|
|
StringBuilder sb = new StringBuilder(UrlTreeKt.componentParamPrefix);
|
|
StringBuilder sb2 = new StringBuilder("textSize=");
|
|
sb2.append(this.b.getTextSize());
|
|
sb.append(sb2.toString());
|
|
StringBuilder sb3 = new StringBuilder(", textScaleX=");
|
|
sb3.append(this.b.getTextScaleX());
|
|
sb.append(sb3.toString());
|
|
StringBuilder sb4 = new StringBuilder(", textSkewX=");
|
|
sb4.append(this.b.getTextSkewX());
|
|
sb.append(sb4.toString());
|
|
StringBuilder sb5 = new StringBuilder(", letterSpacing=");
|
|
sb5.append(this.b.getLetterSpacing());
|
|
sb.append(sb5.toString());
|
|
StringBuilder sb6 = new StringBuilder(", elegantTextHeight=");
|
|
sb6.append(this.b.isElegantTextHeight());
|
|
sb.append(sb6.toString());
|
|
StringBuilder sb7 = new StringBuilder(", textLocale=");
|
|
sb7.append(this.b.getTextLocales());
|
|
sb.append(sb7.toString());
|
|
StringBuilder sb8 = new StringBuilder(", typeface=");
|
|
sb8.append(this.b.getTypeface());
|
|
sb.append(sb8.toString());
|
|
StringBuilder sb9 = new StringBuilder(", variationSettings=");
|
|
sb9.append(this.b.getFontVariationSettings());
|
|
sb.append(sb9.toString());
|
|
StringBuilder sb10 = new StringBuilder(", textDir=");
|
|
sb10.append(this.c);
|
|
sb.append(sb10.toString());
|
|
StringBuilder sb11 = new StringBuilder(", breakStrategy=");
|
|
sb11.append(this.d);
|
|
sb.append(sb11.toString());
|
|
StringBuilder sb12 = new StringBuilder(", hyphenationFrequency=");
|
|
sb12.append(this.e);
|
|
sb.append(sb12.toString());
|
|
sb.append(UrlTreeKt.componentParamSuffix);
|
|
return sb.toString();
|
|
}
|
|
|
|
public final TextPaint qM_() {
|
|
return this.b;
|
|
}
|
|
|
|
public final TextDirectionHeuristic qL_() {
|
|
return this.c;
|
|
}
|
|
|
|
public final int e() {
|
|
return this.e;
|
|
}
|
|
|
|
public final int c() {
|
|
return this.d;
|
|
}
|
|
}
|
|
|
|
public PrecomputedText qK_() {
|
|
Spannable spannable = this.d;
|
|
if (spannable instanceof PrecomputedText) {
|
|
return (PrecomputedText) spannable;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@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.c.setSpan(obj, i, i2, i3);
|
|
} else {
|
|
this.d.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.c.removeSpan(obj);
|
|
} else {
|
|
this.d.removeSpan(obj);
|
|
}
|
|
}
|
|
|
|
@Override // android.text.Spanned
|
|
public <T> T[] getSpans(int i, int i2, Class<T> cls) {
|
|
if (Build.VERSION.SDK_INT >= 29) {
|
|
return (T[]) this.c.getSpans(i, i2, cls);
|
|
}
|
|
return (T[]) this.d.getSpans(i, i2, cls);
|
|
}
|
|
|
|
@Override // android.text.Spanned
|
|
public int getSpanStart(Object obj) {
|
|
return this.d.getSpanStart(obj);
|
|
}
|
|
|
|
@Override // android.text.Spanned
|
|
public int getSpanEnd(Object obj) {
|
|
return this.d.getSpanEnd(obj);
|
|
}
|
|
|
|
@Override // android.text.Spanned
|
|
public int getSpanFlags(Object obj) {
|
|
return this.d.getSpanFlags(obj);
|
|
}
|
|
|
|
@Override // android.text.Spanned
|
|
public int nextSpanTransition(int i, int i2, Class cls) {
|
|
return this.d.nextSpanTransition(i, i2, cls);
|
|
}
|
|
|
|
@Override // java.lang.CharSequence
|
|
public int length() {
|
|
return this.d.length();
|
|
}
|
|
|
|
@Override // java.lang.CharSequence
|
|
public char charAt(int i) {
|
|
return this.d.charAt(i);
|
|
}
|
|
|
|
@Override // java.lang.CharSequence
|
|
public CharSequence subSequence(int i, int i2) {
|
|
return this.d.subSequence(i, i2);
|
|
}
|
|
|
|
@Override // java.lang.CharSequence
|
|
public String toString() {
|
|
return this.d.toString();
|
|
}
|
|
|
|
public Params e() {
|
|
return this.b;
|
|
}
|
|
}
|