package X6FRs_4.KQgRr5e_0.LGe8pk_15;

import X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IFxWkV_5;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.method.PasswordTransformationMethod;
import android.util.AttributeSet;
import android.widget.TextView;
import java.lang.ref.WeakReference;
/* compiled from: AppCompatTextHelper.java */
/* loaded from: classes.dex */
public class Nm6q_10 {

    /* renamed from: IFxWkV_5  reason: collision with root package name */
    public WGk6X_27 f3164IFxWkV_5;
    public int KQgRr5e_0 = 0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final KNBe_11 f729KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public WGk6X_27 f730KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Typeface f731KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final TextView f732KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public boolean f733KQgRr5e_0;

    /* renamed from: Mqv2r_3  reason: collision with root package name */
    public WGk6X_27 f3165Mqv2r_3;
    public WGk6X_27 PGPF6hQ_2;
    public WGk6X_27 QxJ9d_1;

    /* renamed from: X6FRs_4  reason: collision with root package name */
    public WGk6X_27 f3166X6FRs_4;

    /* compiled from: AppCompatTextHelper.java */
    /* loaded from: classes.dex */
    public class KQgRr5e_0 extends IFxWkV_5.KQgRr5e_0 {

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public final /* synthetic */ WeakReference f734KQgRr5e_0;

        public KQgRr5e_0(WeakReference weakReference) {
            this.f734KQgRr5e_0 = weakReference;
        }

        @Override // X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IFxWkV_5.KQgRr5e_0
        public void onFontRetrievalFailed(int i) {
        }

        @Override // X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2.IFxWkV_5.KQgRr5e_0
        public void onFontRetrieved(Typeface typeface) {
            Nm6q_10.this.KQgRr5e_0(this.f734KQgRr5e_0, typeface);
        }
    }

    public Nm6q_10(TextView textView) {
        this.f732KQgRr5e_0 = textView;
        this.f729KQgRr5e_0 = new KNBe_11(this.f732KQgRr5e_0);
    }

    @SuppressLint({"NewApi"})
    public void KQgRr5e_0(AttributeSet attributeSet, int i) {
        ColorStateList colorStateList;
        ColorStateList colorStateList2;
        boolean z;
        boolean z2;
        Context context = this.f732KQgRr5e_0.getContext();
        IFxWkV_5 KQgRr5e_02 = IFxWkV_5.KQgRr5e_0();
        NzhupJ_29 KQgRr5e_03 = NzhupJ_29.KQgRr5e_0(context, attributeSet, X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextHelper, i, 0);
        int IMuAHx_62 = KQgRr5e_03.IMuAHx_6(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextHelper_android_textAppearance, -1);
        if (KQgRr5e_03.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextHelper_android_drawableLeft)) {
            this.f730KQgRr5e_0 = KQgRr5e_0(context, KQgRr5e_02, KQgRr5e_03.IMuAHx_6(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextHelper_android_drawableLeft, 0));
        }
        if (KQgRr5e_03.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextHelper_android_drawableTop)) {
            this.QxJ9d_1 = KQgRr5e_0(context, KQgRr5e_02, KQgRr5e_03.IMuAHx_6(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextHelper_android_drawableTop, 0));
        }
        if (KQgRr5e_03.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextHelper_android_drawableRight)) {
            this.PGPF6hQ_2 = KQgRr5e_0(context, KQgRr5e_02, KQgRr5e_03.IMuAHx_6(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextHelper_android_drawableRight, 0));
        }
        if (KQgRr5e_03.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextHelper_android_drawableBottom)) {
            this.f3165Mqv2r_3 = KQgRr5e_0(context, KQgRr5e_02, KQgRr5e_03.IMuAHx_6(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextHelper_android_drawableBottom, 0));
        }
        if (Build.VERSION.SDK_INT >= 17) {
            if (KQgRr5e_03.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextHelper_android_drawableStart)) {
                this.f3166X6FRs_4 = KQgRr5e_0(context, KQgRr5e_02, KQgRr5e_03.IMuAHx_6(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextHelper_android_drawableStart, 0));
            }
            if (KQgRr5e_03.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextHelper_android_drawableEnd)) {
                this.f3164IFxWkV_5 = KQgRr5e_0(context, KQgRr5e_02, KQgRr5e_03.IMuAHx_6(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextHelper_android_drawableEnd, 0));
            }
        }
        KQgRr5e_03.KQgRr5e_0();
        boolean z3 = this.f732KQgRr5e_0.getTransformationMethod() instanceof PasswordTransformationMethod;
        boolean z4 = true;
        if (IMuAHx_62 != -1) {
            NzhupJ_29 KQgRr5e_04 = NzhupJ_29.KQgRr5e_0(context, IMuAHx_62, X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance);
            if (z3 || !KQgRr5e_04.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_textAllCaps)) {
                z = false;
                z2 = false;
            } else {
                z = KQgRr5e_04.KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_textAllCaps, false);
                z2 = true;
            }
            KQgRr5e_0(context, KQgRr5e_04);
            if (Build.VERSION.SDK_INT < 23) {
                ColorStateList KQgRr5e_05 = KQgRr5e_04.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textColor) ? KQgRr5e_04.KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textColor) : null;
                colorStateList2 = KQgRr5e_04.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textColorHint) ? KQgRr5e_04.KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textColorHint) : null;
                ColorStateList colorStateList3 = KQgRr5e_05;
                colorStateList = KQgRr5e_04.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textColorLink) ? KQgRr5e_04.KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textColorLink) : null;
                r10 = colorStateList3;
            } else {
                colorStateList = null;
                colorStateList2 = null;
            }
            KQgRr5e_04.KQgRr5e_0();
        } else {
            colorStateList = null;
            colorStateList2 = null;
            z = false;
            z2 = false;
        }
        NzhupJ_29 KQgRr5e_06 = NzhupJ_29.KQgRr5e_0(context, attributeSet, X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance, i, 0);
        if (z3 || !KQgRr5e_06.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_textAllCaps)) {
            z4 = z2;
        } else {
            z = KQgRr5e_06.KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_textAllCaps, false);
        }
        if (Build.VERSION.SDK_INT < 23) {
            if (KQgRr5e_06.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textColor)) {
                r10 = KQgRr5e_06.KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textColor);
            }
            if (KQgRr5e_06.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textColorHint)) {
                colorStateList2 = KQgRr5e_06.KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textColorHint);
            }
            if (KQgRr5e_06.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textColorLink)) {
                colorStateList = KQgRr5e_06.KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textColorLink);
            }
        }
        if (Build.VERSION.SDK_INT >= 28 && KQgRr5e_06.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textSize) && KQgRr5e_06.PGPF6hQ_2(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textSize, -1) == 0) {
            this.f732KQgRr5e_0.setTextSize(0, 0.0f);
        }
        KQgRr5e_0(context, KQgRr5e_06);
        KQgRr5e_06.KQgRr5e_0();
        if (r10 != null) {
            this.f732KQgRr5e_0.setTextColor(r10);
        }
        if (colorStateList2 != null) {
            this.f732KQgRr5e_0.setHintTextColor(colorStateList2);
        }
        if (colorStateList != null) {
            this.f732KQgRr5e_0.setLinkTextColor(colorStateList);
        }
        if (!z3 && z4) {
            KQgRr5e_0(z);
        }
        Typeface typeface = this.f731KQgRr5e_0;
        if (typeface != null) {
            this.f732KQgRr5e_0.setTypeface(typeface, this.KQgRr5e_0);
        }
        this.f729KQgRr5e_0.KQgRr5e_0(attributeSet, i);
        if (X6FRs_4.IMuAHx_6.WwEq_13.QxJ9d_1.KQgRr5e_0 && this.f729KQgRr5e_0.Mqv2r_3() != 0) {
            int[] m399KQgRr5e_0 = this.f729KQgRr5e_0.m399KQgRr5e_0();
            if (m399KQgRr5e_0.length > 0) {
                if (this.f732KQgRr5e_0.getAutoSizeStepGranularity() != -1.0f) {
                    this.f732KQgRr5e_0.setAutoSizeTextTypeUniformWithConfiguration(this.f729KQgRr5e_0.QxJ9d_1(), this.f729KQgRr5e_0.KQgRr5e_0(), this.f729KQgRr5e_0.PGPF6hQ_2(), 0);
                } else {
                    this.f732KQgRr5e_0.setAutoSizeTextTypeUniformWithPresetSizes(m399KQgRr5e_0, 0);
                }
            }
        }
        NzhupJ_29 KQgRr5e_07 = NzhupJ_29.KQgRr5e_0(context, attributeSet, X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextView);
        int PGPF6hQ_2 = KQgRr5e_07.PGPF6hQ_2(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextView_firstBaselineToTopHeight, -1);
        int PGPF6hQ_22 = KQgRr5e_07.PGPF6hQ_2(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextView_lastBaselineToBottomHeight, -1);
        int PGPF6hQ_23 = KQgRr5e_07.PGPF6hQ_2(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatTextView_lineHeight, -1);
        KQgRr5e_07.KQgRr5e_0();
        if (PGPF6hQ_2 != -1) {
            X6FRs_4.IMuAHx_6.WwEq_13.Xgtqvk_8.KQgRr5e_0(this.f732KQgRr5e_0, PGPF6hQ_2);
        }
        if (PGPF6hQ_22 != -1) {
            X6FRs_4.IMuAHx_6.WwEq_13.Xgtqvk_8.QxJ9d_1(this.f732KQgRr5e_0, PGPF6hQ_22);
        }
        if (PGPF6hQ_23 != -1) {
            X6FRs_4.IMuAHx_6.WwEq_13.Xgtqvk_8.PGPF6hQ_2(this.f732KQgRr5e_0, PGPF6hQ_23);
        }
    }

    public int Mqv2r_3() {
        return this.f729KQgRr5e_0.Mqv2r_3();
    }

    public int PGPF6hQ_2() {
        return this.f729KQgRr5e_0.PGPF6hQ_2();
    }

    /* renamed from: QxJ9d_1  reason: collision with other method in class */
    public void m415QxJ9d_1() {
        this.f729KQgRr5e_0.m397KQgRr5e_0();
    }

    public final void QxJ9d_1(int i, float f) {
        this.f729KQgRr5e_0.KQgRr5e_0(i, f);
    }

    public int QxJ9d_1() {
        return this.f729KQgRr5e_0.QxJ9d_1();
    }

    public final void KQgRr5e_0(Context context, NzhupJ_29 nzhupJ_29) {
        String m418KQgRr5e_0;
        this.KQgRr5e_0 = nzhupJ_29.Mqv2r_3(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textStyle, this.KQgRr5e_0);
        if (!nzhupJ_29.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_fontFamily) && !nzhupJ_29.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_fontFamily)) {
            if (nzhupJ_29.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_typeface)) {
                this.f733KQgRr5e_0 = false;
                int Mqv2r_32 = nzhupJ_29.Mqv2r_3(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_typeface, 1);
                if (Mqv2r_32 == 1) {
                    this.f731KQgRr5e_0 = Typeface.SANS_SERIF;
                    return;
                } else if (Mqv2r_32 == 2) {
                    this.f731KQgRr5e_0 = Typeface.SERIF;
                    return;
                } else if (Mqv2r_32 != 3) {
                    return;
                } else {
                    this.f731KQgRr5e_0 = Typeface.MONOSPACE;
                    return;
                }
            }
            return;
        }
        this.f731KQgRr5e_0 = null;
        int i = nzhupJ_29.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_fontFamily) ? X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_fontFamily : X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_fontFamily;
        if (!context.isRestricted()) {
            try {
                Typeface KQgRr5e_02 = nzhupJ_29.KQgRr5e_0(i, this.KQgRr5e_0, new KQgRr5e_0(new WeakReference(this.f732KQgRr5e_0)));
                this.f731KQgRr5e_0 = KQgRr5e_02;
                this.f733KQgRr5e_0 = KQgRr5e_02 == null;
            } catch (Resources.NotFoundException | UnsupportedOperationException unused) {
            }
        }
        if (this.f731KQgRr5e_0 != null || (m418KQgRr5e_0 = nzhupJ_29.m418KQgRr5e_0(i)) == null) {
            return;
        }
        this.f731KQgRr5e_0 = Typeface.create(m418KQgRr5e_0, this.KQgRr5e_0);
    }

    public void KQgRr5e_0(WeakReference<TextView> weakReference, Typeface typeface) {
        if (this.f733KQgRr5e_0) {
            this.f731KQgRr5e_0 = typeface;
            TextView textView = weakReference.get();
            if (textView != null) {
                textView.setTypeface(typeface, this.KQgRr5e_0);
            }
        }
    }

    public void KQgRr5e_0(Context context, int i) {
        ColorStateList KQgRr5e_02;
        NzhupJ_29 KQgRr5e_03 = NzhupJ_29.KQgRr5e_0(context, i, X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance);
        if (KQgRr5e_03.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_textAllCaps)) {
            KQgRr5e_0(KQgRr5e_03.KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_textAllCaps, false));
        }
        if (Build.VERSION.SDK_INT < 23 && KQgRr5e_03.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textColor) && (KQgRr5e_02 = KQgRr5e_03.KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textColor)) != null) {
            this.f732KQgRr5e_0.setTextColor(KQgRr5e_02);
        }
        if (KQgRr5e_03.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textSize) && KQgRr5e_03.PGPF6hQ_2(X6FRs_4.KQgRr5e_0.XnFJ5_9.TextAppearance_android_textSize, -1) == 0) {
            this.f732KQgRr5e_0.setTextSize(0, 0.0f);
        }
        KQgRr5e_0(context, KQgRr5e_03);
        KQgRr5e_03.KQgRr5e_0();
        Typeface typeface = this.f731KQgRr5e_0;
        if (typeface != null) {
            this.f732KQgRr5e_0.setTypeface(typeface, this.KQgRr5e_0);
        }
    }

    public void KQgRr5e_0(boolean z) {
        this.f732KQgRr5e_0.setAllCaps(z);
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public void m412KQgRr5e_0() {
        if (this.f730KQgRr5e_0 != null || this.QxJ9d_1 != null || this.PGPF6hQ_2 != null || this.f3165Mqv2r_3 != null) {
            Drawable[] compoundDrawables = this.f732KQgRr5e_0.getCompoundDrawables();
            KQgRr5e_0(compoundDrawables[0], this.f730KQgRr5e_0);
            KQgRr5e_0(compoundDrawables[1], this.QxJ9d_1);
            KQgRr5e_0(compoundDrawables[2], this.PGPF6hQ_2);
            KQgRr5e_0(compoundDrawables[3], this.f3165Mqv2r_3);
        }
        if (Build.VERSION.SDK_INT >= 17) {
            if (this.f3166X6FRs_4 == null && this.f3164IFxWkV_5 == null) {
                return;
            }
            Drawable[] compoundDrawablesRelative = this.f732KQgRr5e_0.getCompoundDrawablesRelative();
            KQgRr5e_0(compoundDrawablesRelative[0], this.f3166X6FRs_4);
            KQgRr5e_0(compoundDrawablesRelative[2], this.f3164IFxWkV_5);
        }
    }

    public final void KQgRr5e_0(Drawable drawable, WGk6X_27 wGk6X_27) {
        if (drawable == null || wGk6X_27 == null) {
            return;
        }
        IFxWkV_5.KQgRr5e_0(drawable, wGk6X_27, this.f732KQgRr5e_0.getDrawableState());
    }

    public static WGk6X_27 KQgRr5e_0(Context context, IFxWkV_5 iFxWkV_5, int i) {
        ColorStateList QxJ9d_1 = iFxWkV_5.QxJ9d_1(context, i);
        if (QxJ9d_1 != null) {
            WGk6X_27 wGk6X_27 = new WGk6X_27();
            wGk6X_27.QxJ9d_1 = true;
            wGk6X_27.KQgRr5e_0 = QxJ9d_1;
            return wGk6X_27;
        }
        return null;
    }

    public void KQgRr5e_0(boolean z, int i, int i2, int i3, int i4) {
        if (X6FRs_4.IMuAHx_6.WwEq_13.QxJ9d_1.KQgRr5e_0) {
            return;
        }
        m415QxJ9d_1();
    }

    public void KQgRr5e_0(int i, float f) {
        if (X6FRs_4.IMuAHx_6.WwEq_13.QxJ9d_1.KQgRr5e_0 || m413KQgRr5e_0()) {
            return;
        }
        QxJ9d_1(i, f);
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public boolean m413KQgRr5e_0() {
        return this.f729KQgRr5e_0.m398KQgRr5e_0();
    }

    public void KQgRr5e_0(int i) {
        this.f729KQgRr5e_0.KQgRr5e_0(i);
    }

    public void KQgRr5e_0(int i, int i2, int i3, int i4) throws IllegalArgumentException {
        this.f729KQgRr5e_0.KQgRr5e_0(i, i2, i3, i4);
    }

    public void KQgRr5e_0(int[] iArr, int i) throws IllegalArgumentException {
        this.f729KQgRr5e_0.KQgRr5e_0(iArr, i);
    }

    public int KQgRr5e_0() {
        return this.f729KQgRr5e_0.KQgRr5e_0();
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public int[] m414KQgRr5e_0() {
        return this.f729KQgRr5e_0.m399KQgRr5e_0();
    }
}
