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

137 lines
5.0 KiB
Java

package androidx.appcompat.widget;
import android.R;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.widget.AutoCompleteTextView;
import androidx.appcompat.R$attr;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.view.TintableBackgroundView;
import androidx.core.widget.TextViewCompat;
/* loaded from: classes.dex */
public class AppCompatAutoCompleteTextView extends AutoCompleteTextView implements TintableBackgroundView {
private static final int[] c = {R.attr.popupBackground};
private final AppCompatBackgroundHelper a;
private final AppCompatTextHelper b;
public AppCompatAutoCompleteTextView(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 // android.widget.AutoCompleteTextView
public void setDropDownBackgroundResource(int i) {
setDropDownBackgroundDrawable(AppCompatResources.c(getContext(), i));
}
@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 AppCompatAutoCompleteTextView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, R$attr.autoCompleteTextViewStyle);
}
public AppCompatAutoCompleteTextView(Context context, AttributeSet attributeSet, int i) {
super(TintContextWrapper.b(context), attributeSet, i);
TintTypedArray a = TintTypedArray.a(getContext(), attributeSet, c, i, 0);
if (a.g(0)) {
setDropDownBackgroundDrawable(a.b(0));
}
a.a();
this.a = new AppCompatBackgroundHelper(this);
this.a.a(attributeSet, i);
this.b = new AppCompatTextHelper(this);
this.b.a(attributeSet, i);
this.b.a();
}
}