package X6FRs_4.IMuAHx_6.X6FRs_4.PGPF6hQ_2;

import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Xml;
import java.io.IOException;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
/* compiled from: ComplexColorCompat.java */
/* loaded from: classes.dex */
public final class QxJ9d_1 {
    public int KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final ColorStateList f521KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final Shader f522KQgRr5e_0;

    public QxJ9d_1(Shader shader, ColorStateList colorStateList, int i) {
        this.f522KQgRr5e_0 = shader;
        this.f521KQgRr5e_0 = colorStateList;
        this.KQgRr5e_0 = i;
    }

    public static QxJ9d_1 KQgRr5e_0(Shader shader) {
        return new QxJ9d_1(shader, null, 0);
    }

    public boolean PGPF6hQ_2() {
        return m343KQgRr5e_0() || this.KQgRr5e_0 != 0;
    }

    public boolean QxJ9d_1() {
        ColorStateList colorStateList;
        return this.f522KQgRr5e_0 == null && (colorStateList = this.f521KQgRr5e_0) != null && colorStateList.isStateful();
    }

    public static QxJ9d_1 KQgRr5e_0(ColorStateList colorStateList) {
        return new QxJ9d_1(null, colorStateList, colorStateList.getDefaultColor());
    }

    public static QxJ9d_1 QxJ9d_1(Resources resources, int i, Resources.Theme theme) {
        try {
            return KQgRr5e_0(resources, i, theme);
        } catch (Exception e) {
            Log.e("ComplexColorCompat", "Failed to inflate ComplexColor.", e);
            return null;
        }
    }

    public static QxJ9d_1 KQgRr5e_0(int i) {
        return new QxJ9d_1(null, null, i);
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public Shader m341KQgRr5e_0() {
        return this.f522KQgRr5e_0;
    }

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

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public void m342KQgRr5e_0(int i) {
        this.KQgRr5e_0 = i;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public boolean m343KQgRr5e_0() {
        return this.f522KQgRr5e_0 != null;
    }

    public boolean KQgRr5e_0(int[] iArr) {
        if (QxJ9d_1()) {
            ColorStateList colorStateList = this.f521KQgRr5e_0;
            int colorForState = colorStateList.getColorForState(iArr, colorStateList.getDefaultColor());
            if (colorForState != this.KQgRr5e_0) {
                this.KQgRr5e_0 = colorForState;
                return true;
            }
        }
        return false;
    }

    public static QxJ9d_1 KQgRr5e_0(Resources resources, int i, Resources.Theme theme) throws IOException, XmlPullParserException {
        int next;
        XmlResourceParser xml = resources.getXml(i);
        AttributeSet asAttributeSet = Xml.asAttributeSet(xml);
        do {
            next = xml.next();
            if (next == 2) {
                break;
            }
        } while (next != 1);
        if (next == 2) {
            String name = xml.getName();
            char c = 65535;
            int hashCode = name.hashCode();
            if (hashCode != 89650992) {
                if (hashCode == 1191572447 && name.equals("selector")) {
                    c = 0;
                }
            } else if (name.equals("gradient")) {
                c = 1;
            }
            if (c != 0) {
                if (c == 1) {
                    return KQgRr5e_0(Mqv2r_3.m335KQgRr5e_0(resources, (XmlPullParser) xml, asAttributeSet, theme));
                }
                throw new XmlPullParserException(xml.getPositionDescription() + ": unsupported complex color tag " + name);
            }
            return KQgRr5e_0(KQgRr5e_0.KQgRr5e_0(resources, xml, asAttributeSet, theme));
        }
        throw new XmlPullParserException("No start tag found");
    }
}
