package z3;

import M.J;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.RippleDrawable;
import android.widget.AutoCompleteTextView;
import android.widget.EditText;
import c6.C0587c;
import com.google.android.material.internal.CheckableImageButton;
import com.google.android.material.textfield.TextInputLayout;
import com.martsnew.tv.R;
import java.lang.reflect.Field;
import n4.u0;

/* JADX INFO: renamed from: z3.a, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1792a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f19281a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ m f19282b;

    public /* synthetic */ C1792a(m mVar, int i) {
        this.f19281a = i;
        this.f19282b = mVar;
    }

    public final void a(TextInputLayout textInputLayout) {
        m mVar = this.f19282b;
        switch (this.f19281a) {
            case u0.f15495q /* 0 */:
                EditText editText = textInputLayout.getEditText();
                textInputLayout.setEndIconVisible(editText.hasFocus() && editText.getText().length() > 0);
                textInputLayout.setEndIconCheckable(false);
                e eVar = (e) mVar;
                editText.setOnFocusChangeListener(eVar.f19290e);
                C0587c c0587c = eVar.f19289d;
                editText.removeTextChangedListener(c0587c);
                editText.addTextChangedListener(c0587c);
                return;
            case 1:
                EditText editText2 = textInputLayout.getEditText();
                if (!(editText2 instanceof AutoCompleteTextView)) {
                    throw new RuntimeException("EditText needs to be an AutoCompleteTextView if an Exposed Dropdown Menu is being used.");
                }
                AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) editText2;
                l lVar = (l) mVar;
                int boxBackgroundMode = lVar.f19316a.getBoxBackgroundMode();
                if (boxBackgroundMode == 2) {
                    autoCompleteTextView.setDropDownBackgroundDrawable(lVar.f19312m);
                } else if (boxBackgroundMode == 1) {
                    autoCompleteTextView.setDropDownBackgroundDrawable(lVar.f19311l);
                }
                if (!l.f(autoCompleteTextView)) {
                    TextInputLayout textInputLayout2 = lVar.f19316a;
                    int boxBackgroundMode2 = textInputLayout2.getBoxBackgroundMode();
                    x3.g boxBackground = textInputLayout2.getBoxBackground();
                    int iS = W2.g.s(autoCompleteTextView, R.attr.colorControlHighlight);
                    int[][] iArr = {new int[]{android.R.attr.state_pressed}, new int[0]};
                    if (boxBackgroundMode2 == 2) {
                        int iS2 = W2.g.s(autoCompleteTextView, R.attr.colorSurface);
                        x3.g gVar = new x3.g(boxBackground.f18614q.f18588a);
                        int iZ = W2.g.z(0.1f, iS, iS2);
                        gVar.i(new ColorStateList(iArr, new int[]{iZ, 0}));
                        gVar.setTint(iS2);
                        ColorStateList colorStateList = new ColorStateList(iArr, new int[]{iZ, iS2});
                        x3.g gVar2 = new x3.g(boxBackground.f18614q.f18588a);
                        gVar2.setTint(-1);
                        LayerDrawable layerDrawable = new LayerDrawable(new Drawable[]{new RippleDrawable(colorStateList, gVar, gVar2), boxBackground});
                        Field field = J.f4065a;
                        autoCompleteTextView.setBackground(layerDrawable);
                    } else if (boxBackgroundMode2 == 1) {
                        int boxBackgroundColor = textInputLayout2.getBoxBackgroundColor();
                        RippleDrawable rippleDrawable = new RippleDrawable(new ColorStateList(iArr, new int[]{W2.g.z(0.1f, iS, boxBackgroundColor), boxBackgroundColor}), boxBackground, boxBackground);
                        Field field2 = J.f4065a;
                        autoCompleteTextView.setBackground(rippleDrawable);
                    }
                }
                autoCompleteTextView.setOnTouchListener(new j(lVar, autoCompleteTextView));
                autoCompleteTextView.setOnFocusChangeListener(lVar.f19305e);
                autoCompleteTextView.setOnDismissListener(new k(lVar));
                autoCompleteTextView.setThreshold(0);
                h hVar = lVar.f19304d;
                autoCompleteTextView.removeTextChangedListener(hVar);
                autoCompleteTextView.addTextChangedListener(hVar);
                textInputLayout.setEndIconCheckable(true);
                textInputLayout.setErrorIconDrawable((Drawable) null);
                if (autoCompleteTextView.getKeyListener() == null) {
                    CheckableImageButton checkableImageButton = lVar.f19318c;
                    Field field3 = J.f4065a;
                    checkableImageButton.setImportantForAccessibility(2);
                }
                textInputLayout.setTextInputAccessibilityDelegate(lVar.f19306f);
                textInputLayout.setEndIconVisible(true);
                return;
            default:
                EditText editText3 = textInputLayout.getEditText();
                textInputLayout.setEndIconVisible(true);
                textInputLayout.setEndIconCheckable(true);
                p pVar = (p) mVar;
                pVar.f19318c.setChecked(!p.d(pVar));
                h hVar2 = pVar.f19344d;
                editText3.removeTextChangedListener(hVar2);
                editText3.addTextChangedListener(hVar2);
                return;
        }
    }
}
