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.text.method.KeyListener;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.widget.AutoCompleteTextView;

/* JADX INFO: compiled from: AppCompatAutoCompleteTextView.java */
/* JADX INFO: loaded from: classes.dex */
public class d extends AutoCompleteTextView implements androidx.core.view.w, androidx.core.widget.n {

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    private static final int[] f869h = {R.attr.popupBackground};

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private final e f870e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private final c0 f871f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private final m f872g;

    public d(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, c.a.f3165p);
    }

    void a(m mVar) {
        KeyListener keyListener = getKeyListener();
        if (mVar.b(keyListener)) {
            boolean zIsFocusable = super.isFocusable();
            boolean zIsClickable = super.isClickable();
            boolean zIsLongClickable = super.isLongClickable();
            int inputType = super.getInputType();
            KeyListener keyListenerA = mVar.a(keyListener);
            if (keyListenerA == keyListener) {
                return;
            }
            super.setKeyListener(keyListenerA);
            super.setRawInputType(inputType);
            super.setFocusable(zIsFocusable);
            super.setClickable(zIsClickable);
            super.setLongClickable(zIsLongClickable);
        }
    }

    @Override // android.widget.TextView, android.view.View
    protected void drawableStateChanged() {
        super.drawableStateChanged();
        e eVar = this.f870e;
        if (eVar != null) {
            eVar.b();
        }
        c0 c0Var = this.f871f;
        if (c0Var != null) {
            c0Var.b();
        }
    }

    @Override // android.widget.TextView
    public ActionMode.Callback getCustomSelectionActionModeCallback() {
        return androidx.core.widget.j.p(super.getCustomSelectionActionModeCallback());
    }

    @Override // androidx.core.view.w
    public ColorStateList getSupportBackgroundTintList() {
        e eVar = this.f870e;
        if (eVar != null) {
            return eVar.c();
        }
        return null;
    }

    @Override // androidx.core.view.w
    public PorterDuff.Mode getSupportBackgroundTintMode() {
        e eVar = this.f870e;
        if (eVar != null) {
            return eVar.d();
        }
        return null;
    }

    public ColorStateList getSupportCompoundDrawablesTintList() {
        return this.f871f.j();
    }

    public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
        return this.f871f.k();
    }

    @Override // android.widget.TextView, android.view.View
    public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
        return this.f872g.d(o.a(super.onCreateInputConnection(editorInfo), editorInfo, this), editorInfo);
    }

    @Override // android.view.View
    public void setBackgroundDrawable(Drawable drawable) {
        super.setBackgroundDrawable(drawable);
        e eVar = this.f870e;
        if (eVar != null) {
            eVar.f(drawable);
        }
    }

    @Override // android.view.View
    public void setBackgroundResource(int i3) {
        super.setBackgroundResource(i3);
        e eVar = this.f870e;
        if (eVar != null) {
            eVar.g(i3);
        }
    }

    @Override // android.widget.TextView
    public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
        super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
        c0 c0Var = this.f871f;
        if (c0Var != null) {
            c0Var.p();
        }
    }

    @Override // android.widget.TextView
    public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
        super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
        c0 c0Var = this.f871f;
        if (c0Var != null) {
            c0Var.p();
        }
    }

    @Override // android.widget.TextView
    public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
        super.setCustomSelectionActionModeCallback(androidx.core.widget.j.q(this, callback));
    }

    @Override // android.widget.AutoCompleteTextView
    public void setDropDownBackgroundResource(int i3) {
        setDropDownBackgroundDrawable(d.a.b(getContext(), i3));
    }

    public void setEmojiCompatEnabled(boolean z2) {
        this.f872g.e(z2);
    }

    @Override // android.widget.TextView
    public void setKeyListener(KeyListener keyListener) {
        super.setKeyListener(this.f872g.a(keyListener));
    }

    @Override // androidx.core.view.w
    public void setSupportBackgroundTintList(ColorStateList colorStateList) {
        e eVar = this.f870e;
        if (eVar != null) {
            eVar.i(colorStateList);
        }
    }

    @Override // androidx.core.view.w
    public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
        e eVar = this.f870e;
        if (eVar != null) {
            eVar.j(mode);
        }
    }

    @Override // androidx.core.widget.n
    public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
        this.f871f.w(colorStateList);
        this.f871f.b();
    }

    @Override // androidx.core.widget.n
    public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
        this.f871f.x(mode);
        this.f871f.b();
    }

    @Override // android.widget.TextView
    public void setTextAppearance(Context context, int i3) {
        super.setTextAppearance(context, i3);
        c0 c0Var = this.f871f;
        if (c0Var != null) {
            c0Var.q(context, i3);
        }
    }

    public d(Context context, AttributeSet attributeSet, int i3) {
        super(x0.b(context), attributeSet, i3);
        v0.a(this, getContext());
        a1 a1VarV = a1.v(getContext(), attributeSet, f869h, i3, 0);
        if (a1VarV.s(0)) {
            setDropDownBackgroundDrawable(a1VarV.g(0));
        }
        a1VarV.w();
        e eVar = new e(this);
        this.f870e = eVar;
        eVar.e(attributeSet, i3);
        c0 c0Var = new c0(this);
        this.f871f = c0Var;
        c0Var.m(attributeSet, i3);
        c0Var.b();
        m mVar = new m(this);
        this.f872g = mVar;
        mVar.c(attributeSet, i3);
        a(mVar);
    }
}
