package defpackage;

import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityManager;
import android.widget.AdapterView;
import android.widget.Filterable;
import android.widget.ListAdapter;
import ar.tvplayer.tv.R;
import java.util.List;

/* renamed from: ᵜː, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C2821 extends C4178 {

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public final int[] f10863;

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public ColorStateList f10864;

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public final float f10865;

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public final int f10866;

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public final AccessibilityManager f10867;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public final C3911 f10868;

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public ColorStateList f10869;

    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public int f10870;

    public C2821(Context context, AttributeSet attributeSet) {
        super(ᵙᵛᵯ.ᵶʔᵢˊ(context, attributeSet, R.attr._11_res_0x7f04004e, 0, new int[0]), attributeSet, R.attr._11_res_0x7f04004e);
        this.f10863 = new int[]{android.R.attr.state_selected};
        new Rect();
        Context context2 = getContext();
        ˁˈᵸ.ᵻᵢﹳᵰ(context2, attributeSet, R.attr._11_res_0x7f04004e, R.style._11_res_0x7f1404c2);
        int[] iArr = AbstractC0914.f4183;
        ˁˈᵸ.ˇʼʤˎ(context2, attributeSet, iArr, R.attr._11_res_0x7f04004e, R.style._11_res_0x7f1404c2, new int[0]);
        TypedArray typedArrayObtainStyledAttributes = context2.obtainStyledAttributes(attributeSet, iArr, R.attr._11_res_0x7f04004e, R.style._11_res_0x7f1404c2);
        if (typedArrayObtainStyledAttributes.hasValue(0) && typedArrayObtainStyledAttributes.getInt(0, 0) == 0) {
            setKeyListener(null);
        }
        this.f10866 = typedArrayObtainStyledAttributes.getResourceId(3, R.layout._11_res_0x7f0e0100);
        int i = 1;
        this.f10865 = typedArrayObtainStyledAttributes.getDimensionPixelOffset(1, R.dimen._11_res_0x7f070519);
        if (typedArrayObtainStyledAttributes.hasValue(2)) {
            this.f10864 = ColorStateList.valueOf(typedArrayObtainStyledAttributes.getColor(2, 0));
        }
        this.f10870 = typedArrayObtainStyledAttributes.getColor(4, 0);
        this.f10869 = ˉˇʨ.ᵪʩ(context2, typedArrayObtainStyledAttributes, 5);
        this.f10867 = (AccessibilityManager) context2.getSystemService("accessibility");
        C3911 c3911 = new C3911(context2, null, R.attr._11_res_0x7f0403f3, 0);
        this.f10868 = c3911;
        c3911.f14665 = true;
        C1496 c1496 = c3911.f14680;
        c1496.setFocusable(true);
        c3911.f14681 = this;
        c1496.setInputMethodMode(2);
        c3911.mo2474(getAdapter());
        c3911.f14662 = new C3627(i, this);
        if (typedArrayObtainStyledAttributes.hasValue(6)) {
            setSimpleItems(typedArrayObtainStyledAttributes.getResourceId(6, 0));
        }
        typedArrayObtainStyledAttributes.recycle();
    }

    @Override // android.widget.AutoCompleteTextView
    public final void dismissDropDown() {
        if (m6917()) {
            this.f10868.dismiss();
        } else {
            super.dismissDropDown();
        }
    }

    public ColorStateList getDropDownBackgroundTintList() {
        return this.f10864;
    }

    @Override // android.widget.TextView
    public CharSequence getHint() {
        m6918();
        return super.getHint();
    }

    public float getPopupElevation() {
        return this.f10865;
    }

    public int getSimpleItemSelectedColor() {
        return this.f10870;
    }

    public ColorStateList getSimpleItemSelectedRippleColor() {
        return this.f10869;
    }

    @Override // android.widget.AutoCompleteTextView
    public final boolean isPopupShowing() {
        C3911 c3911 = this.f10868;
        if (c3911 == null || !c3911.f14680.isShowing()) {
            return super.isPopupShowing();
        }
        return true;
    }

    @Override // android.widget.AutoCompleteTextView, android.widget.TextView, android.view.View
    public final void onAttachedToWindow() {
        super.onAttachedToWindow();
        m6918();
    }

    @Override // android.widget.AutoCompleteTextView, android.view.View
    public final void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        this.f10868.dismiss();
    }

    @Override // android.widget.AutoCompleteTextView, android.widget.TextView, android.view.View, android.view.KeyEvent.Callback
    public final boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (isPopupShowing()) {
            return super.onKeyDown(i, keyEvent);
        }
        boolean z = i == 66 || i == 23;
        boolean z2 = i == 62;
        if (getKeyListener() == null ? !(z || z2) : !(z && getMaxLines() == 1)) {
            return super.onKeyDown(i, keyEvent);
        }
        m6918();
        return true;
    }

    @Override // android.widget.TextView, android.view.View
    public final void onMeasure(int i, int i2) {
        super.onMeasure(i, i2);
        if (View.MeasureSpec.getMode(i) == Integer.MIN_VALUE) {
            int measuredWidth = getMeasuredWidth();
            getAdapter();
            m6918();
            setMeasuredDimension(Math.min(Math.max(measuredWidth, 0), View.MeasureSpec.getSize(i)), getMeasuredHeight());
        }
    }

    @Override // android.widget.AutoCompleteTextView, android.widget.TextView, android.view.View
    public final void onWindowFocusChanged(boolean z) {
        if (m6917()) {
            return;
        }
        super.onWindowFocusChanged(z);
    }

    @Override // android.widget.AutoCompleteTextView
    public <T extends ListAdapter & Filterable> void setAdapter(T t) {
        super.setAdapter(t);
        this.f10868.mo2474(getAdapter());
    }

    @Override // android.widget.AutoCompleteTextView
    public void setDropDownBackgroundDrawable(Drawable drawable) {
        super.setDropDownBackgroundDrawable(drawable);
        C3911 c3911 = this.f10868;
        if (c3911 != null) {
            c3911.m8573(drawable);
        }
    }

    public void setDropDownBackgroundTint(int i) {
        setDropDownBackgroundTintList(ColorStateList.valueOf(i));
    }

    public void setDropDownBackgroundTintList(ColorStateList colorStateList) {
        this.f10864 = colorStateList;
        Drawable dropDownBackground = getDropDownBackground();
        if (dropDownBackground instanceof C2445) {
            C2445 c2445 = (C2445) dropDownBackground;
            ColorStateList colorStateList2 = this.f10864;
            C5355 c5355 = c2445.f9549;
            if (c5355.f20060 != colorStateList2) {
                c5355.f20060 = colorStateList2;
                c2445.onStateChange(c2445.getState());
            }
        }
    }

    @Override // android.widget.AutoCompleteTextView
    public void setOnItemSelectedListener(AdapterView.OnItemSelectedListener onItemSelectedListener) {
        super.setOnItemSelectedListener(onItemSelectedListener);
        this.f10868.f14685 = getOnItemSelectedListener();
    }

    @Override // android.widget.TextView
    public void setRawInputType(int i) {
        super.setRawInputType(i);
        m6918();
    }

    public void setSimpleItemSelectedColor(int i) {
        this.f10870 = i;
        if (getAdapter() instanceof C3499) {
            ((C3499) getAdapter()).m7976();
        }
    }

    public void setSimpleItemSelectedRippleColor(ColorStateList colorStateList) {
        this.f10869 = colorStateList;
        if (getAdapter() instanceof C3499) {
            ((C3499) getAdapter()).m7976();
        }
    }

    public void setSimpleItems(int i) {
        setSimpleItems(getResources().getStringArray(i));
    }

    public void setSimpleItems(String[] strArr) {
        setAdapter(new C3499(this, getContext(), this.f10866, strArr));
    }

    @Override // android.widget.AutoCompleteTextView
    public final void showDropDown() {
        if (m6917()) {
            this.f10868.mo1522();
        } else {
            super.showDropDown();
        }
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final boolean m6917() {
        List<AccessibilityServiceInfo> enabledAccessibilityServiceList;
        AccessibilityManager accessibilityManager = this.f10867;
        if (accessibilityManager != null && accessibilityManager.isTouchExplorationEnabled()) {
            return true;
        }
        if (accessibilityManager == null || !accessibilityManager.isEnabled() || (enabledAccessibilityServiceList = accessibilityManager.getEnabledAccessibilityServiceList(16)) == null) {
            return false;
        }
        for (AccessibilityServiceInfo accessibilityServiceInfo : enabledAccessibilityServiceList) {
            if (accessibilityServiceInfo.getSettingsActivityName() != null && accessibilityServiceInfo.getSettingsActivityName().contains("SwitchAccess")) {
                return true;
            }
        }
        return false;
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final void m6918() {
        for (ViewParent parent = getParent(); parent != null; parent = parent.getParent()) {
        }
    }
}
