jimu-decompiled/sources/androidx/appcompat/widget/AppCompatEditText.java
2025-05-13 19:24:51 +02:00

131 lines
4.7 KiB
Java

package androidx.appcompat.widget;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.Editable;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.widget.EditText;
import androidx.appcompat.R$attr;
import androidx.core.view.TintableBackgroundView;
import androidx.core.widget.TextViewCompat;
/* loaded from: classes.dex */
public class AppCompatEditText extends EditText implements TintableBackgroundView {
private final AppCompatBackgroundHelper a;
private final AppCompatTextHelper b;
public AppCompatEditText(Context context) {
this(context, null);
}
@Override // android.widget.TextView, android.view.View
protected void drawableStateChanged() {
super.drawableStateChanged();
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.a();
}
AppCompatTextHelper appCompatTextHelper = this.b;
if (appCompatTextHelper != null) {
appCompatTextHelper.a();
}
}
@Override // androidx.core.view.TintableBackgroundView
public ColorStateList getSupportBackgroundTintList() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.b();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
public PorterDuff.Mode getSupportBackgroundTintMode() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.c();
}
return null;
}
@Override // android.widget.TextView, android.view.View
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
InputConnection onCreateInputConnection = super.onCreateInputConnection(editorInfo);
AppCompatHintHelper.a(onCreateInputConnection, editorInfo, this);
return onCreateInputConnection;
}
@Override // android.view.View
public void setBackgroundDrawable(Drawable drawable) {
super.setBackgroundDrawable(drawable);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.a(drawable);
}
}
@Override // android.view.View
public void setBackgroundResource(int i) {
super.setBackgroundResource(i);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.a(i);
}
}
@Override // android.widget.TextView
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
super.setCustomSelectionActionModeCallback(TextViewCompat.a(this, callback));
}
@Override // androidx.core.view.TintableBackgroundView
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.b(colorStateList);
}
}
@Override // androidx.core.view.TintableBackgroundView
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.a(mode);
}
}
@Override // android.widget.TextView
public void setTextAppearance(Context context, int i) {
super.setTextAppearance(context, i);
AppCompatTextHelper appCompatTextHelper = this.b;
if (appCompatTextHelper != null) {
appCompatTextHelper.a(context, i);
}
}
public AppCompatEditText(Context context, AttributeSet attributeSet) {
this(context, attributeSet, R$attr.editTextStyle);
}
@Override // android.widget.EditText, android.widget.TextView
public Editable getText() {
return Build.VERSION.SDK_INT >= 28 ? super.getText() : super.getEditableText();
}
public AppCompatEditText(Context context, AttributeSet attributeSet, int i) {
super(TintContextWrapper.b(context), attributeSet, i);
this.a = new AppCompatBackgroundHelper(this);
this.a.a(attributeSet, i);
this.b = new AppCompatTextHelper(this);
this.b.a(attributeSet, i);
this.b.a();
}
}