package p071y;

import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.TypedValue;
import org.xmlpull.v1.XmlPullParser;

/* renamed from: y.q */
/* loaded from: classes.dex */
public class C1838q {
    /* renamed from: a */
    public static boolean m258a(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i, boolean z) {
        return !m249j(xmlPullParser, str) ? z : typedArray.getBoolean(i, z);
    }

    /* renamed from: b */
    public static int m257b(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i, int i2) {
        return !m249j(xmlPullParser, str) ? i2 : typedArray.getColor(i, i2);
    }

    /* renamed from: c */
    public static ColorStateList m256c(TypedArray typedArray, XmlPullParser xmlPullParser, Resources.Theme theme, String str, int i) {
        if (m249j(xmlPullParser, str)) {
            TypedValue typedValue = new TypedValue();
            typedArray.getValue(i, typedValue);
            int i2 = typedValue.type;
            if (i2 != 2) {
                return (i2 < 28 || i2 > 31) ? C1809c.m336d(typedArray.getResources(), typedArray.getResourceId(i, 0), theme) : m255d(typedValue);
            }
            throw new UnsupportedOperationException("Failed to resolve attribute at index " + i + ": " + typedValue);
        }
        return null;
    }

    /* renamed from: d */
    public static ColorStateList m255d(TypedValue typedValue) {
        return ColorStateList.valueOf(typedValue.data);
    }

    /* renamed from: e */
    public static C1810d m254e(TypedArray typedArray, XmlPullParser xmlPullParser, Resources.Theme theme, String str, int i, int i2) {
        if (m249j(xmlPullParser, str)) {
            TypedValue typedValue = new TypedValue();
            typedArray.getValue(i, typedValue);
            int i3 = typedValue.type;
            if (i3 >= 28 && i3 <= 31) {
                return C1810d.m330b(typedValue.data);
            }
            C1810d m325g = C1810d.m325g(typedArray.getResources(), typedArray.getResourceId(i, 0), theme);
            if (m325g != null) {
                return m325g;
            }
        }
        return C1810d.m330b(i2);
    }

    /* renamed from: f */
    public static float m253f(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i, float f) {
        return !m249j(xmlPullParser, str) ? f : typedArray.getFloat(i, f);
    }

    /* renamed from: g */
    public static int m252g(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i, int i2) {
        return !m249j(xmlPullParser, str) ? i2 : typedArray.getInt(i, i2);
    }

    /* renamed from: h */
    public static int m251h(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i, int i2) {
        return !m249j(xmlPullParser, str) ? i2 : typedArray.getResourceId(i, i2);
    }

    /* renamed from: i */
    public static String m250i(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i) {
        if (m249j(xmlPullParser, str)) {
            return typedArray.getString(i);
        }
        return null;
    }

    /* renamed from: j */
    public static boolean m249j(XmlPullParser xmlPullParser, String str) {
        return xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", str) != null;
    }

    /* renamed from: k */
    public static TypedArray m248k(Resources resources, Resources.Theme theme, AttributeSet attributeSet, int[] iArr) {
        return theme == null ? resources.obtainAttributes(attributeSet, iArr) : theme.obtainStyledAttributes(attributeSet, iArr, 0, 0);
    }

    /* renamed from: l */
    public static TypedValue m247l(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i) {
        if (m249j(xmlPullParser, str)) {
            return typedArray.peekValue(i);
        }
        return null;
    }
}