package u2; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.util.AttributeSet; import android.util.TypedValue; import org.xmlpull.v1.XmlPullParser; public class h { public static int a(Context context, int i15, int i16) { TypedValue typedValue = new TypedValue(); context.getTheme().resolveAttribute(i15, typedValue, true); if (typedValue.resourceId != 0) { return i15; } return i16; } public static boolean b(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i15, boolean z15) { if (!i(xmlPullParser, str)) { return z15; } return typedArray.getBoolean(i15, z15); } public static d c(TypedArray typedArray, XmlPullParser xmlPullParser, Resources.Theme theme, String str, int i15, int i16) { d dVar; if (i(xmlPullParser, str)) { TypedValue typedValue = new TypedValue(); typedArray.getValue(i15, typedValue); int i17 = typedValue.type; if (i17 >= 28 && i17 <= 31) { return new d(null, null, typedValue.data); } try { dVar = d.a(typedArray.getResources(), typedArray.getResourceId(i15, 0), theme); } catch (Exception unused) { dVar = null; } if (dVar != null) { return dVar; } } return new d(null, null, i16); } public static float d(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i15, float f15) { if (!i(xmlPullParser, str)) { return f15; } return typedArray.getFloat(i15, f15); } public static int e(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i15, int i16) { if (!i(xmlPullParser, str)) { return i16; } return typedArray.getInt(i15, i16); } public static int f(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i15, int i16) { if (!i(xmlPullParser, str)) { return i16; } return typedArray.getResourceId(i15, i16); } public static String g(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i15) { if (!i(xmlPullParser, str)) { return null; } return typedArray.getString(i15); } public static String h(TypedArray typedArray, int i15, int i16) { String string = typedArray.getString(i15); if (string == null) { return typedArray.getString(i16); } return string; } public static boolean i(XmlPullParser xmlPullParser, String str) { return xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", str) != null; } public static TypedArray j(Resources resources, Resources.Theme theme, AttributeSet attributeSet, int[] iArr) { if (theme == null) { return resources.obtainAttributes(attributeSet, iArr); } return theme.obtainStyledAttributes(attributeSet, iArr, 0, 0); } }