package o; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.LinearGradient; import android.graphics.RadialGradient; import android.graphics.Shader; import android.graphics.SweepGradient; import android.util.AttributeSet; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.io.IOException; import java.util.List; import o.KtR; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; /* loaded from: classes.dex */ final class LpO { /* JADX INFO: Access modifiers changed from: package-private */ public static Shader nR_(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws IOException, XmlPullParserException { TypedArray obtainStyledAttributes; String name = xmlPullParser.getName(); if (!name.equals("gradient")) { StringBuilder sb = new StringBuilder(); sb.append(xmlPullParser.getPositionDescription()); sb.append(": invalid gradient color tag "); sb.append(name); throw new XmlPullParserException(sb.toString()); } int[] iArr = KtR.RVV.GradientColor; if (theme == null) { obtainStyledAttributes = resources.obtainAttributes(attributeSet, iArr); } else { obtainStyledAttributes = theme.obtainStyledAttributes(attributeSet, iArr, 0, 0); } float f = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "startX") != null ? obtainStyledAttributes.getFloat(KtR.RVV.GradientColor_android_startX, BitmapDescriptorFactory.HUE_RED) : 0.0f; float f2 = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "startY") != null ? obtainStyledAttributes.getFloat(KtR.RVV.GradientColor_android_startY, BitmapDescriptorFactory.HUE_RED) : 0.0f; float f3 = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "endX") != null ? obtainStyledAttributes.getFloat(KtR.RVV.GradientColor_android_endX, BitmapDescriptorFactory.HUE_RED) : 0.0f; float f4 = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "endY") != null ? obtainStyledAttributes.getFloat(KtR.RVV.GradientColor_android_endY, BitmapDescriptorFactory.HUE_RED) : 0.0f; float f5 = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "centerX") != null ? obtainStyledAttributes.getFloat(KtR.RVV.GradientColor_android_centerX, BitmapDescriptorFactory.HUE_RED) : 0.0f; float f6 = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "centerY") != null ? obtainStyledAttributes.getFloat(KtR.RVV.GradientColor_android_centerY, BitmapDescriptorFactory.HUE_RED) : 0.0f; int i = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "type") != null ? obtainStyledAttributes.getInt(KtR.RVV.GradientColor_android_type, 0) : 0; int color = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "startColor") != null ? obtainStyledAttributes.getColor(KtR.RVV.GradientColor_android_startColor, 0) : 0; boolean z = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "centerColor") != null; int color2 = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "centerColor") != null ? obtainStyledAttributes.getColor(KtR.RVV.GradientColor_android_centerColor, 0) : 0; int color3 = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "endColor") != null ? obtainStyledAttributes.getColor(KtR.RVV.GradientColor_android_endColor, 0) : 0; int i2 = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "tileMode") != null ? obtainStyledAttributes.getInt(KtR.RVV.GradientColor_android_tileMode, 0) : 0; float f7 = f5; float f8 = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", "gradientRadius") != null ? obtainStyledAttributes.getFloat(KtR.RVV.GradientColor_android_gradientRadius, BitmapDescriptorFactory.HUE_RED) : BitmapDescriptorFactory.HUE_RED; obtainStyledAttributes.recycle(); Sts d = d(nS_(resources, xmlPullParser, attributeSet, theme), color, color3, z, color2); if (i != 1) { if (i == 2) { return new SweepGradient(f7, f6, d.d, d.b); } return new LinearGradient(f, f2, f3, f4, d.d, d.b, nT_(i2)); } if (f8 <= BitmapDescriptorFactory.HUE_RED) { throw new XmlPullParserException(" tag requires 'gradientRadius' attribute with radial type"); } return new RadialGradient(f7, f6, f8, d.d, d.b, nT_(i2)); } /* JADX WARN: Code restructure failed: missing block: B:33:0x006f, code lost: r8 = new java.lang.StringBuilder(); r8.append(r9.getPositionDescription()); r8.append(": tag requires a 'color' attribute and a 'offset' attribute!"); */ /* JADX WARN: Code restructure failed: missing block: B:34:0x0089, code lost: throw new org.xmlpull.v1.XmlPullParserException(r8.toString()); */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static o.LpO.Sts nS_(android.content.res.Resources r8, org.xmlpull.v1.XmlPullParser r9, android.util.AttributeSet r10, android.content.res.Resources.Theme r11) throws org.xmlpull.v1.XmlPullParserException, java.io.IOException { /* int r0 = r9.getDepth() r1 = 1 int r0 = r0 + r1 java.util.ArrayList r2 = new java.util.ArrayList r3 = 20 r2.(r3) java.util.ArrayList r4 = new java.util.ArrayList r4.(r3) L12: int r3 = r9.next() if (r3 == r1) goto L8a int r5 = r9.getDepth() if (r5 >= r0) goto L21 r6 = 3 if (r3 == r6) goto L8a L21: r6 = 2 if (r3 != r6) goto L12 if (r5 > r0) goto L12 java.lang.String r3 = r9.getName() java.lang.String r5 = "item" boolean r3 = r3.equals(r5) if (r3 == 0) goto L12 int[] r3 = o.KtR.RVV.GradientColorItem r5 = 0 if (r11 != 0) goto L3c android.content.res.TypedArray r3 = r8.obtainAttributes(r10, r3) goto L40 L3c: android.content.res.TypedArray r3 = r11.obtainStyledAttributes(r10, r3, r5, r5) L40: int r6 = o.KtR.RVV.GradientColorItem_android_color boolean r6 = r3.hasValue(r6) int r7 = o.KtR.RVV.GradientColorItem_android_offset boolean r7 = r3.hasValue(r7) if (r6 == 0) goto L6f if (r7 == 0) goto L6f int r6 = o.KtR.RVV.GradientColorItem_android_color int r5 = r3.getColor(r6, r5) int r6 = o.KtR.RVV.GradientColorItem_android_offset r7 = 0 float r6 = r3.getFloat(r6, r7) r3.recycle() java.lang.Integer r3 = java.lang.Integer.valueOf(r5) r4.add(r3) java.lang.Float r3 = java.lang.Float.valueOf(r6) r2.add(r3) goto L12 L6f: java.lang.StringBuilder r8 = new java.lang.StringBuilder r8.() org.xmlpull.v1.XmlPullParserException r10 = new org.xmlpull.v1.XmlPullParserException java.lang.String r9 = r9.getPositionDescription() r8.append(r9) java.lang.String r9 = ": tag requires a 'color' attribute and a 'offset' attribute!" r8.append(r9) java.lang.String r8 = r8.toString() r10.(r8) throw r10 L8a: int r8 = r4.size() if (r8 <= 0) goto L96 o.LpO$Sts r8 = new o.LpO$Sts r8.(r4, r2) return r8 L96: r8 = 0 return r8 */ throw new UnsupportedOperationException("Method not decompiled: o.LpO.nS_(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources$Theme):o.LpO$Sts"); } private static Sts d(Sts sts, int i, int i2, boolean z, int i3) { if (sts != null) { return sts; } if (z) { return new Sts(i, i3, i2); } return new Sts(i, i2); } private static Shader.TileMode nT_(int i) { if (i == 1) { return Shader.TileMode.REPEAT; } if (i == 2) { return Shader.TileMode.MIRROR; } return Shader.TileMode.CLAMP; } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static final class Sts { final float[] b; final int[] d; Sts(List list, List list2) { int size = list.size(); this.d = new int[size]; this.b = new float[size]; for (int i = 0; i < size; i++) { this.d[i] = list.get(i).intValue(); this.b[i] = list2.get(i).floatValue(); } } Sts(int i, int i2) { this.d = new int[]{i, i2}; this.b = new float[]{BitmapDescriptorFactory.HUE_RED, 1.0f}; } Sts(int i, int i2, int i3) { this.d = new int[]{i, i2, i3}; this.b = new float[]{BitmapDescriptorFactory.HUE_RED, 0.5f, 1.0f}; } } }