package X6FRs_4.KQgRr5e_0.LGe8pk_15;

import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.CompoundButton;
/* compiled from: AppCompatCompoundButtonHelper.java */
/* loaded from: classes.dex */
public class X6FRs_4 {

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final CompoundButton f774KQgRr5e_0;
    public boolean PGPF6hQ_2;
    public ColorStateList KQgRr5e_0 = null;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public PorterDuff.Mode f773KQgRr5e_0 = null;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public boolean f775KQgRr5e_0 = false;
    public boolean QxJ9d_1 = false;

    public X6FRs_4(CompoundButton compoundButton) {
        this.f774KQgRr5e_0 = compoundButton;
    }

    public void KQgRr5e_0(AttributeSet attributeSet, int i) {
        int resourceId;
        TypedArray obtainStyledAttributes = this.f774KQgRr5e_0.getContext().obtainStyledAttributes(attributeSet, X6FRs_4.KQgRr5e_0.XnFJ5_9.CompoundButton, i, 0);
        try {
            if (obtainStyledAttributes.hasValue(X6FRs_4.KQgRr5e_0.XnFJ5_9.CompoundButton_android_button) && (resourceId = obtainStyledAttributes.getResourceId(X6FRs_4.KQgRr5e_0.XnFJ5_9.CompoundButton_android_button, 0)) != 0) {
                this.f774KQgRr5e_0.setButtonDrawable(X6FRs_4.KQgRr5e_0.KNBe_11.KQgRr5e_0.KQgRr5e_0.m380KQgRr5e_0(this.f774KQgRr5e_0.getContext(), resourceId));
            }
            if (obtainStyledAttributes.hasValue(X6FRs_4.KQgRr5e_0.XnFJ5_9.CompoundButton_buttonTint)) {
                X6FRs_4.IMuAHx_6.WwEq_13.PGPF6hQ_2.KQgRr5e_0(this.f774KQgRr5e_0, obtainStyledAttributes.getColorStateList(X6FRs_4.KQgRr5e_0.XnFJ5_9.CompoundButton_buttonTint));
            }
            if (obtainStyledAttributes.hasValue(X6FRs_4.KQgRr5e_0.XnFJ5_9.CompoundButton_buttonTintMode)) {
                X6FRs_4.IMuAHx_6.WwEq_13.PGPF6hQ_2.KQgRr5e_0(this.f774KQgRr5e_0, YghfZG_14.KQgRr5e_0(obtainStyledAttributes.getInt(X6FRs_4.KQgRr5e_0.XnFJ5_9.CompoundButton_buttonTintMode, -1), null));
            }
        } finally {
            obtainStyledAttributes.recycle();
        }
    }

    public void QxJ9d_1() {
        if (this.PGPF6hQ_2) {
            this.PGPF6hQ_2 = false;
            return;
        }
        this.PGPF6hQ_2 = true;
        m443KQgRr5e_0();
    }

    public void KQgRr5e_0(ColorStateList colorStateList) {
        this.KQgRr5e_0 = colorStateList;
        this.f775KQgRr5e_0 = true;
        m443KQgRr5e_0();
    }

    public ColorStateList KQgRr5e_0() {
        return this.KQgRr5e_0;
    }

    public void KQgRr5e_0(PorterDuff.Mode mode) {
        this.f773KQgRr5e_0 = mode;
        this.QxJ9d_1 = true;
        m443KQgRr5e_0();
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public PorterDuff.Mode m442KQgRr5e_0() {
        return this.f773KQgRr5e_0;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public void m443KQgRr5e_0() {
        Drawable KQgRr5e_0 = X6FRs_4.IMuAHx_6.WwEq_13.PGPF6hQ_2.KQgRr5e_0(this.f774KQgRr5e_0);
        if (KQgRr5e_0 != null) {
            if (this.f775KQgRr5e_0 || this.QxJ9d_1) {
                Drawable mutate = X6FRs_4.IMuAHx_6.IFxWkV_5.XnFJ5_9.KQgRr5e_0.m295QxJ9d_1(KQgRr5e_0).mutate();
                if (this.f775KQgRr5e_0) {
                    X6FRs_4.IMuAHx_6.IFxWkV_5.XnFJ5_9.KQgRr5e_0.KQgRr5e_0(mutate, this.KQgRr5e_0);
                }
                if (this.QxJ9d_1) {
                    X6FRs_4.IMuAHx_6.IFxWkV_5.XnFJ5_9.KQgRr5e_0.KQgRr5e_0(mutate, this.f773KQgRr5e_0);
                }
                if (mutate.isStateful()) {
                    mutate.setState(this.f774KQgRr5e_0.getDrawableState());
                }
                this.f774KQgRr5e_0.setButtonDrawable(mutate);
            }
        }
    }

    public int KQgRr5e_0(int i) {
        Drawable KQgRr5e_0;
        return (Build.VERSION.SDK_INT >= 17 || (KQgRr5e_0 = X6FRs_4.IMuAHx_6.WwEq_13.PGPF6hQ_2.KQgRr5e_0(this.f774KQgRr5e_0)) == null) ? i : i + KQgRr5e_0.getIntrinsicWidth();
    }
}
