what-the-bank/sources/androidx/appcompat/widget/AppCompatTextView.java

585 lines
17 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package androidx.appcompat.widget;
import android.R;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.InputFilter;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.textclassifier.TextClassifier;
import android.widget.TextView;
import androidx.core.text.PrecomputedTextCompat;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import o.AgY;
import o.KBh;
import o.Opp;
import o.TaO;
import o.URz;
import o.WpN;
import o.WvB;
import o.Yoi;
import o.ZMp;
import o.ZzE;
import o.mxt;
import o.nKv;
/* loaded from: classes.dex */
public class AppCompatTextView extends TextView implements KBh {
private HBt a;
private Future<PrecomputedTextCompat> b;
private final WpN c;
private WvB d;
private boolean e;
private final ZMp f;
private final Yoi g;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public interface HBt {
int a();
void a(int i);
void b(int i);
int[] b();
int c();
void c(int[] iArr, int i);
int d();
void d(int i, int i2, int i3, int i4);
int e();
void e(int i);
TextClassifier hx_();
void hy_(TextClassifier textClassifier);
}
public AppCompatTextView(Context context) {
this(context, null);
}
public AppCompatTextView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, R.attr.textViewStyle);
}
public AppCompatTextView(Context context, AttributeSet attributeSet, int i) {
super(ZzE.b(context), attributeSet, i);
this.e = false;
this.a = null;
nKv.b(getContext());
WpN wpN = new WpN(this);
this.c = wpN;
wpN.fy_(attributeSet, i);
Yoi yoi = new Yoi(this);
this.g = yoi;
yoi.he_(attributeSet, i);
yoi.a();
this.f = new ZMp(this);
d().gm_(attributeSet, i);
}
private WvB d() {
if (this.d == null) {
this.d = new WvB(this);
}
return this.d;
}
@Override // android.view.View
public void setBackgroundResource(int i) {
super.setBackgroundResource(i);
WpN wpN = this.c;
if (wpN != null) {
wpN.c(i);
}
}
@Override // android.view.View
public void setBackgroundDrawable(Drawable drawable) {
super.setBackgroundDrawable(drawable);
WpN wpN = this.c;
if (wpN != null) {
wpN.fz_(drawable);
}
}
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
WpN wpN = this.c;
if (wpN != null) {
wpN.fB_(colorStateList);
}
}
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
WpN wpN = this.c;
if (wpN != null) {
wpN.fC_(mode);
}
}
@Override // android.widget.TextView
public void setTextAppearance(Context context, int i) {
super.setTextAppearance(context, i);
Yoi yoi = this.g;
if (yoi != null) {
yoi.d(context, i);
}
}
@Override // android.widget.TextView
public void setFilters(InputFilter[] inputFilterArr) {
super.setFilters(d().gl_(inputFilterArr));
}
@Override // android.widget.TextView
public void setAllCaps(boolean z) {
super.setAllCaps(z);
d().e(z);
}
public void setEmojiCompatEnabled(boolean z) {
d().a(z);
}
@Override // android.widget.TextView, android.view.View
protected void drawableStateChanged() {
super.drawableStateChanged();
WpN wpN = this.c;
if (wpN != null) {
wpN.a();
}
Yoi yoi = this.g;
if (yoi != null) {
yoi.a();
}
}
@Override // android.widget.TextView, android.view.View
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
super.onLayout(z, i, i2, i3, i4);
Yoi yoi = this.g;
if (yoi != null) {
yoi.b(z, i, i2, i3, i4);
}
}
@Override // android.widget.TextView
public void setTextSize(int i, float f) {
if (mxt.a) {
super.setTextSize(i, f);
return;
}
Yoi yoi = this.g;
if (yoi != null) {
yoi.e(i, f);
}
}
@Override // android.widget.TextView
protected void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
super.onTextChanged(charSequence, i, i2, i3);
if (this.g == null || mxt.a || !this.g.i()) {
return;
}
this.g.b();
}
@Override // android.widget.TextView, o.KBh
public void setAutoSizeTextTypeWithDefaults(int i) {
if (mxt.a) {
e().a(i);
return;
}
Yoi yoi = this.g;
if (yoi != null) {
yoi.c(i);
}
}
@Override // android.widget.TextView, o.KBh
public void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4) throws IllegalArgumentException {
if (mxt.a) {
e().d(i, i2, i3, i4);
return;
}
Yoi yoi = this.g;
if (yoi != null) {
yoi.b(i, i2, i3, i4);
}
}
@Override // android.widget.TextView
public void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i) throws IllegalArgumentException {
if (mxt.a) {
e().c(iArr, i);
return;
}
Yoi yoi = this.g;
if (yoi != null) {
yoi.c(iArr, i);
}
}
@Override // android.widget.TextView
public int getAutoSizeTextType() {
if (mxt.a) {
return e().c() == 1 ? 1 : 0;
}
Yoi yoi = this.g;
if (yoi != null) {
return yoi.j();
}
return 0;
}
@Override // android.widget.TextView
public int getAutoSizeStepGranularity() {
if (mxt.a) {
return e().d();
}
Yoi yoi = this.g;
if (yoi != null) {
return yoi.d();
}
return -1;
}
@Override // android.widget.TextView
public int getAutoSizeMinTextSize() {
if (mxt.a) {
return e().a();
}
Yoi yoi = this.g;
if (yoi != null) {
return yoi.e();
}
return -1;
}
@Override // android.widget.TextView
public int getAutoSizeMaxTextSize() {
if (mxt.a) {
return e().e();
}
Yoi yoi = this.g;
if (yoi != null) {
return yoi.c();
}
return -1;
}
@Override // android.widget.TextView
public int[] getAutoSizeTextAvailableSizes() {
if (mxt.a) {
return e().b();
}
Yoi yoi = this.g;
return yoi != null ? yoi.f() : new int[0];
}
@Override // android.widget.TextView, android.view.View
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
InputConnection onCreateInputConnection = super.onCreateInputConnection(editorInfo);
this.g.hg_(this, onCreateInputConnection, editorInfo);
return Opp.go_(onCreateInputConnection, editorInfo, this);
}
@Override // android.widget.TextView
public void setFirstBaselineToTopHeight(int i) {
if (Build.VERSION.SDK_INT >= 28) {
e().e(i);
} else {
URz.wa_(this, i);
}
}
@Override // android.widget.TextView
public void setLastBaselineToBottomHeight(int i) {
if (Build.VERSION.SDK_INT >= 28) {
e().b(i);
} else {
URz.wb_(this, i);
}
}
@Override // android.widget.TextView
public int getFirstBaselineToTopHeight() {
return URz.vP_(this);
}
@Override // android.widget.TextView
public int getLastBaselineToBottomHeight() {
return URz.vQ_(this);
}
@Override // android.widget.TextView
public void setLineHeight(int i) {
URz.wc_(this, i);
}
@Override // android.widget.TextView
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
super.setCustomSelectionActionModeCallback(URz.wh_(this, callback));
}
@Override // android.widget.TextView
public ActionMode.Callback getCustomSelectionActionModeCallback() {
return URz.wg_(super.getCustomSelectionActionModeCallback());
}
public void setTextMetricsParamsCompat(PrecomputedTextCompat.Params params) {
URz.wf_(this, params);
}
public void setPrecomputedText(PrecomputedTextCompat precomputedTextCompat) {
URz.wd_(this, precomputedTextCompat);
}
private void c() {
Future<PrecomputedTextCompat> future = this.b;
if (future != null) {
try {
this.b = null;
URz.wd_(this, future.get());
} catch (InterruptedException | ExecutionException unused) {
}
}
}
@Override // android.widget.TextView
public CharSequence getText() {
c();
return super.getText();
}
@Override // android.widget.TextView
public void setTextClassifier(TextClassifier textClassifier) {
ZMp zMp;
if (Build.VERSION.SDK_INT >= 28 || (zMp = this.f) == null) {
e().hy_(textClassifier);
} else {
zMp.gY_(textClassifier);
}
}
@Override // android.widget.TextView
public TextClassifier getTextClassifier() {
ZMp zMp;
if (Build.VERSION.SDK_INT >= 28 || (zMp = this.f) == null) {
return e().hx_();
}
return zMp.gX_();
}
public void setTextFuture(Future<PrecomputedTextCompat> future) {
this.b = future;
if (future != null) {
requestLayout();
}
}
@Override // android.widget.TextView, android.view.View
public void onMeasure(int i, int i2) {
c();
super.onMeasure(i, i2);
}
@Override // android.widget.TextView
public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
Yoi yoi = this.g;
if (yoi != null) {
yoi.l();
}
}
@Override // android.widget.TextView
public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
Yoi yoi = this.g;
if (yoi != null) {
yoi.l();
}
}
@Override // android.widget.TextView
public void setCompoundDrawablesWithIntrinsicBounds(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
super.setCompoundDrawablesWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4);
Yoi yoi = this.g;
if (yoi != null) {
yoi.l();
}
}
@Override // android.widget.TextView
public void setCompoundDrawablesWithIntrinsicBounds(int i, int i2, int i3, int i4) {
Context context = getContext();
setCompoundDrawablesWithIntrinsicBounds(i != 0 ? AgY.dT_(context, i) : null, i2 != 0 ? AgY.dT_(context, i2) : null, i3 != 0 ? AgY.dT_(context, i3) : null, i4 != 0 ? AgY.dT_(context, i4) : null);
Yoi yoi = this.g;
if (yoi != null) {
yoi.l();
}
}
@Override // android.widget.TextView
public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
super.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4);
Yoi yoi = this.g;
if (yoi != null) {
yoi.l();
}
}
@Override // android.widget.TextView
public void setCompoundDrawablesRelativeWithIntrinsicBounds(int i, int i2, int i3, int i4) {
Context context = getContext();
setCompoundDrawablesRelativeWithIntrinsicBounds(i != 0 ? AgY.dT_(context, i) : null, i2 != 0 ? AgY.dT_(context, i2) : null, i3 != 0 ? AgY.dT_(context, i3) : null, i4 != 0 ? AgY.dT_(context, i4) : null);
Yoi yoi = this.g;
if (yoi != null) {
yoi.l();
}
}
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
this.g.hh_(colorStateList);
this.g.a();
}
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
this.g.hi_(mode);
this.g.a();
}
@Override // android.widget.TextView
public void setTypeface(Typeface typeface, int i) {
if (this.e) {
return;
}
Typeface oJ_ = (typeface == null || i <= 0) ? null : TaO.oJ_(getContext(), typeface, i);
this.e = true;
if (oJ_ != null) {
typeface = oJ_;
}
try {
super.setTypeface(typeface, i);
} finally {
this.e = false;
}
}
HBt e() {
if (this.a == null) {
if (Build.VERSION.SDK_INT >= 28) {
this.a = new Sts(this);
} else {
this.a = new RVV(this);
}
}
return this.a;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class RVV implements HBt {
final AppCompatTextView a;
@Override // androidx.appcompat.widget.AppCompatTextView.HBt
public void b(int i) {
}
@Override // androidx.appcompat.widget.AppCompatTextView.HBt
public void e(int i) {
}
RVV(AppCompatTextView appCompatTextView) {
this.a = appCompatTextView;
}
@Override // androidx.appcompat.widget.AppCompatTextView.HBt
public int e() {
return AppCompatTextView.super.getAutoSizeMaxTextSize();
}
@Override // androidx.appcompat.widget.AppCompatTextView.HBt
public int a() {
return AppCompatTextView.super.getAutoSizeMinTextSize();
}
@Override // androidx.appcompat.widget.AppCompatTextView.HBt
public int d() {
return AppCompatTextView.super.getAutoSizeStepGranularity();
}
@Override // androidx.appcompat.widget.AppCompatTextView.HBt
public int[] b() {
return AppCompatTextView.super.getAutoSizeTextAvailableSizes();
}
@Override // androidx.appcompat.widget.AppCompatTextView.HBt
public int c() {
return AppCompatTextView.super.getAutoSizeTextType();
}
@Override // androidx.appcompat.widget.AppCompatTextView.HBt
public TextClassifier hx_() {
return AppCompatTextView.super.getTextClassifier();
}
@Override // androidx.appcompat.widget.AppCompatTextView.HBt
public void d(int i, int i2, int i3, int i4) {
AppCompatTextView.super.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
}
@Override // androidx.appcompat.widget.AppCompatTextView.HBt
public void c(int[] iArr, int i) {
AppCompatTextView.super.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
}
@Override // androidx.appcompat.widget.AppCompatTextView.HBt
public void a(int i) {
AppCompatTextView.super.setAutoSizeTextTypeWithDefaults(i);
}
@Override // androidx.appcompat.widget.AppCompatTextView.HBt
public void hy_(TextClassifier textClassifier) {
AppCompatTextView.super.setTextClassifier(textClassifier);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class Sts extends RVV {
final AppCompatTextView c;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
Sts(AppCompatTextView appCompatTextView) {
super(appCompatTextView);
this.c = appCompatTextView;
}
@Override // androidx.appcompat.widget.AppCompatTextView.RVV, androidx.appcompat.widget.AppCompatTextView.HBt
public void e(int i) {
AppCompatTextView.super.setFirstBaselineToTopHeight(i);
}
@Override // androidx.appcompat.widget.AppCompatTextView.RVV, androidx.appcompat.widget.AppCompatTextView.HBt
public void b(int i) {
AppCompatTextView.super.setLastBaselineToBottomHeight(i);
}
}
}