package X6FRs_4.KQgRr5e_0.LGe8pk_15;

import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
/* compiled from: AppCompatBackgroundHelper.java */
/* loaded from: classes.dex */
public class Mqv2r_3 {
    public int KQgRr5e_0 = -1;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final IFxWkV_5 f720KQgRr5e_0 = IFxWkV_5.KQgRr5e_0();

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

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final View f722KQgRr5e_0;
    public WGk6X_27 PGPF6hQ_2;
    public WGk6X_27 QxJ9d_1;

    public Mqv2r_3(View view) {
        this.f722KQgRr5e_0 = view;
    }

    public void KQgRr5e_0(AttributeSet attributeSet, int i) {
        NzhupJ_29 KQgRr5e_0 = NzhupJ_29.KQgRr5e_0(this.f722KQgRr5e_0.getContext(), attributeSet, X6FRs_4.KQgRr5e_0.XnFJ5_9.ViewBackgroundHelper, i, 0);
        try {
            if (KQgRr5e_0.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.ViewBackgroundHelper_android_background)) {
                this.KQgRr5e_0 = KQgRr5e_0.IMuAHx_6(X6FRs_4.KQgRr5e_0.XnFJ5_9.ViewBackgroundHelper_android_background, -1);
                ColorStateList QxJ9d_1 = this.f720KQgRr5e_0.QxJ9d_1(this.f722KQgRr5e_0.getContext(), this.KQgRr5e_0);
                if (QxJ9d_1 != null) {
                    KQgRr5e_0(QxJ9d_1);
                }
            }
            if (KQgRr5e_0.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.ViewBackgroundHelper_backgroundTint)) {
                X6FRs_4.IMuAHx_6.EuDEkJe_12.ZzDuCHW_20.KQgRr5e_0(this.f722KQgRr5e_0, KQgRr5e_0.KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.ViewBackgroundHelper_backgroundTint));
            }
            if (KQgRr5e_0.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.ViewBackgroundHelper_backgroundTintMode)) {
                X6FRs_4.IMuAHx_6.EuDEkJe_12.ZzDuCHW_20.KQgRr5e_0(this.f722KQgRr5e_0, YghfZG_14.KQgRr5e_0(KQgRr5e_0.Mqv2r_3(X6FRs_4.KQgRr5e_0.XnFJ5_9.ViewBackgroundHelper_backgroundTintMode, -1), null));
            }
        } finally {
            KQgRr5e_0.KQgRr5e_0();
        }
    }

    public void QxJ9d_1(ColorStateList colorStateList) {
        if (this.QxJ9d_1 == null) {
            this.QxJ9d_1 = new WGk6X_27();
        }
        WGk6X_27 wGk6X_27 = this.QxJ9d_1;
        wGk6X_27.KQgRr5e_0 = colorStateList;
        wGk6X_27.QxJ9d_1 = true;
        m406KQgRr5e_0();
    }

    public void KQgRr5e_0(int i) {
        this.KQgRr5e_0 = i;
        IFxWkV_5 iFxWkV_5 = this.f720KQgRr5e_0;
        KQgRr5e_0(iFxWkV_5 != null ? iFxWkV_5.QxJ9d_1(this.f722KQgRr5e_0.getContext(), i) : null);
        m406KQgRr5e_0();
    }

    public void KQgRr5e_0(Drawable drawable) {
        this.KQgRr5e_0 = -1;
        KQgRr5e_0((ColorStateList) null);
        m406KQgRr5e_0();
    }

    public ColorStateList KQgRr5e_0() {
        WGk6X_27 wGk6X_27 = this.QxJ9d_1;
        if (wGk6X_27 != null) {
            return wGk6X_27.KQgRr5e_0;
        }
        return null;
    }

    public void KQgRr5e_0(PorterDuff.Mode mode) {
        if (this.QxJ9d_1 == null) {
            this.QxJ9d_1 = new WGk6X_27();
        }
        WGk6X_27 wGk6X_27 = this.QxJ9d_1;
        wGk6X_27.f763KQgRr5e_0 = mode;
        wGk6X_27.f764KQgRr5e_0 = true;
        m406KQgRr5e_0();
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public PorterDuff.Mode m405KQgRr5e_0() {
        WGk6X_27 wGk6X_27 = this.QxJ9d_1;
        if (wGk6X_27 != null) {
            return wGk6X_27.f763KQgRr5e_0;
        }
        return null;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public void m406KQgRr5e_0() {
        Drawable background = this.f722KQgRr5e_0.getBackground();
        if (background != null) {
            if (m407KQgRr5e_0() && m408KQgRr5e_0(background)) {
                return;
            }
            WGk6X_27 wGk6X_27 = this.QxJ9d_1;
            if (wGk6X_27 != null) {
                IFxWkV_5.KQgRr5e_0(background, wGk6X_27, this.f722KQgRr5e_0.getDrawableState());
                return;
            }
            WGk6X_27 wGk6X_272 = this.f721KQgRr5e_0;
            if (wGk6X_272 != null) {
                IFxWkV_5.KQgRr5e_0(background, wGk6X_272, this.f722KQgRr5e_0.getDrawableState());
            }
        }
    }

    public void KQgRr5e_0(ColorStateList colorStateList) {
        if (colorStateList != null) {
            if (this.f721KQgRr5e_0 == null) {
                this.f721KQgRr5e_0 = new WGk6X_27();
            }
            WGk6X_27 wGk6X_27 = this.f721KQgRr5e_0;
            wGk6X_27.KQgRr5e_0 = colorStateList;
            wGk6X_27.QxJ9d_1 = true;
        } else {
            this.f721KQgRr5e_0 = null;
        }
        m406KQgRr5e_0();
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public final boolean m407KQgRr5e_0() {
        int i = Build.VERSION.SDK_INT;
        return i > 21 ? this.f721KQgRr5e_0 != null : i == 21;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public final boolean m408KQgRr5e_0(Drawable drawable) {
        if (this.PGPF6hQ_2 == null) {
            this.PGPF6hQ_2 = new WGk6X_27();
        }
        WGk6X_27 wGk6X_27 = this.PGPF6hQ_2;
        wGk6X_27.KQgRr5e_0();
        ColorStateList m253KQgRr5e_0 = X6FRs_4.IMuAHx_6.EuDEkJe_12.ZzDuCHW_20.m253KQgRr5e_0(this.f722KQgRr5e_0);
        if (m253KQgRr5e_0 != null) {
            wGk6X_27.QxJ9d_1 = true;
            wGk6X_27.KQgRr5e_0 = m253KQgRr5e_0;
        }
        PorterDuff.Mode m254KQgRr5e_0 = X6FRs_4.IMuAHx_6.EuDEkJe_12.ZzDuCHW_20.m254KQgRr5e_0(this.f722KQgRr5e_0);
        if (m254KQgRr5e_0 != null) {
            wGk6X_27.f764KQgRr5e_0 = true;
            wGk6X_27.f763KQgRr5e_0 = m254KQgRr5e_0;
        }
        if (wGk6X_27.QxJ9d_1 || wGk6X_27.f764KQgRr5e_0) {
            IFxWkV_5.KQgRr5e_0(drawable, wGk6X_27, this.f722KQgRr5e_0.getDrawableState());
            return true;
        }
        return false;
    }
}
