package androidx.vectordrawable.graphics.drawable; import android.animation.Animator; import android.animation.AnimatorInflater; import android.animation.Keyframe; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.TypeEvaluator; import android.animation.ValueAnimator; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.graphics.Path; import android.graphics.PathMeasure; import android.os.Build; import android.util.AttributeSet; import android.util.TypedValue; import android.util.Xml; import android.view.InflateException; import androidx.core.content.res.TypedArrayUtils; import androidx.core.graphics.PathParser; import java.io.IOException; import java.util.ArrayList; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; /* loaded from: classes.dex */ public class AnimatorInflaterCompat { private static class PathDataEvaluator implements TypeEvaluator { private PathParser.PathDataNode[] a; PathDataEvaluator() { } @Override // android.animation.TypeEvaluator /* renamed from: a, reason: merged with bridge method [inline-methods] */ public PathParser.PathDataNode[] evaluate(float f, PathParser.PathDataNode[] pathDataNodeArr, PathParser.PathDataNode[] pathDataNodeArr2) { if (!PathParser.a(pathDataNodeArr, pathDataNodeArr2)) { throw new IllegalArgumentException("Can't interpolate between two incompatible pathData"); } PathParser.PathDataNode[] pathDataNodeArr3 = this.a; if (pathDataNodeArr3 == null || !PathParser.a(pathDataNodeArr3, pathDataNodeArr)) { this.a = PathParser.a(pathDataNodeArr); } for (int i = 0; i < pathDataNodeArr.length; i++) { this.a[i].a(pathDataNodeArr[i], pathDataNodeArr2[i], f); } return this.a; } } public static Animator a(Context context, int i) throws Resources.NotFoundException { return Build.VERSION.SDK_INT >= 24 ? AnimatorInflater.loadAnimator(context, i) : a(context, context.getResources(), context.getTheme(), i); } private static boolean a(int i) { return i >= 28 && i <= 31; } public static Animator a(Context context, Resources resources, Resources.Theme theme, int i) throws Resources.NotFoundException { return a(context, resources, theme, i, 1.0f); } public static Animator a(Context context, Resources resources, Resources.Theme theme, int i, float f) throws Resources.NotFoundException { XmlResourceParser xmlResourceParser = null; try { try { try { xmlResourceParser = resources.getAnimation(i); return a(context, resources, theme, xmlResourceParser, f); } catch (IOException e) { Resources.NotFoundException notFoundException = new Resources.NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(i)); notFoundException.initCause(e); throw notFoundException; } } catch (XmlPullParserException e2) { Resources.NotFoundException notFoundException2 = new Resources.NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(i)); notFoundException2.initCause(e2); throw notFoundException2; } } finally { if (xmlResourceParser != null) { xmlResourceParser.close(); } } } private static PropertyValuesHolder a(TypedArray typedArray, int i, int i2, int i3, String str) { int i4; int i5; int i6; float f; PropertyValuesHolder ofFloat; float f2; float f3; PropertyValuesHolder ofObject; TypedValue peekValue = typedArray.peekValue(i2); boolean z = peekValue != null; int i7 = z ? peekValue.type : 0; TypedValue peekValue2 = typedArray.peekValue(i3); boolean z2 = peekValue2 != null; int i8 = z2 ? peekValue2.type : 0; if (i == 4) { i = ((z && a(i7)) || (z2 && a(i8))) ? 3 : 0; } boolean z3 = i == 0; PropertyValuesHolder propertyValuesHolder = null; if (i == 2) { String string = typedArray.getString(i2); String string2 = typedArray.getString(i3); PathParser.PathDataNode[] a = PathParser.a(string); PathParser.PathDataNode[] a2 = PathParser.a(string2); if (a == null && a2 == null) { return null; } if (a == null) { if (a2 != null) { return PropertyValuesHolder.ofObject(str, new PathDataEvaluator(), a2); } return null; } PathDataEvaluator pathDataEvaluator = new PathDataEvaluator(); if (a2 != null) { if (PathParser.a(a, a2)) { ofObject = PropertyValuesHolder.ofObject(str, pathDataEvaluator, a, a2); } else { throw new InflateException(" Can't morph from " + string + " to " + string2); } } else { ofObject = PropertyValuesHolder.ofObject(str, pathDataEvaluator, a); } return ofObject; } ArgbEvaluator a3 = i == 3 ? ArgbEvaluator.a() : null; if (z3) { if (z) { if (i7 == 5) { f2 = typedArray.getDimension(i2, 0.0f); } else { f2 = typedArray.getFloat(i2, 0.0f); } if (z2) { if (i8 == 5) { f3 = typedArray.getDimension(i3, 0.0f); } else { f3 = typedArray.getFloat(i3, 0.0f); } ofFloat = PropertyValuesHolder.ofFloat(str, f2, f3); } else { ofFloat = PropertyValuesHolder.ofFloat(str, f2); } } else { if (i8 == 5) { f = typedArray.getDimension(i3, 0.0f); } else { f = typedArray.getFloat(i3, 0.0f); } ofFloat = PropertyValuesHolder.ofFloat(str, f); } propertyValuesHolder = ofFloat; } else if (z) { if (i7 == 5) { i5 = (int) typedArray.getDimension(i2, 0.0f); } else if (a(i7)) { i5 = typedArray.getColor(i2, 0); } else { i5 = typedArray.getInt(i2, 0); } if (z2) { if (i8 == 5) { i6 = (int) typedArray.getDimension(i3, 0.0f); } else if (a(i8)) { i6 = typedArray.getColor(i3, 0); } else { i6 = typedArray.getInt(i3, 0); } propertyValuesHolder = PropertyValuesHolder.ofInt(str, i5, i6); } else { propertyValuesHolder = PropertyValuesHolder.ofInt(str, i5); } } else if (z2) { if (i8 == 5) { i4 = (int) typedArray.getDimension(i3, 0.0f); } else if (a(i8)) { i4 = typedArray.getColor(i3, 0); } else { i4 = typedArray.getInt(i3, 0); } propertyValuesHolder = PropertyValuesHolder.ofInt(str, i4); } if (propertyValuesHolder == null || a3 == null) { return propertyValuesHolder; } propertyValuesHolder.setEvaluator(a3); return propertyValuesHolder; } private static void a(ValueAnimator valueAnimator, TypedArray typedArray, TypedArray typedArray2, float f, XmlPullParser xmlPullParser) { long b = TypedArrayUtils.b(typedArray, xmlPullParser, "duration", 1, 300); long b2 = TypedArrayUtils.b(typedArray, xmlPullParser, "startOffset", 2, 0); int b3 = TypedArrayUtils.b(typedArray, xmlPullParser, "valueType", 7, 4); if (TypedArrayUtils.a(xmlPullParser, "valueFrom") && TypedArrayUtils.a(xmlPullParser, "valueTo")) { if (b3 == 4) { b3 = a(typedArray, 5, 6); } PropertyValuesHolder a = a(typedArray, b3, 5, 6, ""); if (a != null) { valueAnimator.setValues(a); } } valueAnimator.setDuration(b); valueAnimator.setStartDelay(b2); valueAnimator.setRepeatCount(TypedArrayUtils.b(typedArray, xmlPullParser, "repeatCount", 3, 0)); valueAnimator.setRepeatMode(TypedArrayUtils.b(typedArray, xmlPullParser, "repeatMode", 4, 1)); if (typedArray2 != null) { a(valueAnimator, typedArray2, b3, f, xmlPullParser); } } private static void a(ValueAnimator valueAnimator, TypedArray typedArray, int i, float f, XmlPullParser xmlPullParser) { ObjectAnimator objectAnimator = (ObjectAnimator) valueAnimator; String a = TypedArrayUtils.a(typedArray, xmlPullParser, "pathData", 1); if (a != null) { String a2 = TypedArrayUtils.a(typedArray, xmlPullParser, "propertyXName", 2); String a3 = TypedArrayUtils.a(typedArray, xmlPullParser, "propertyYName", 3); if (i != 2) { } if (a2 == null && a3 == null) { throw new InflateException(typedArray.getPositionDescription() + " propertyXName or propertyYName is needed for PathData"); } a(PathParser.b(a), objectAnimator, f * 0.5f, a2, a3); return; } objectAnimator.setPropertyName(TypedArrayUtils.a(typedArray, xmlPullParser, "propertyName", 0)); } private static void a(Path path, ObjectAnimator objectAnimator, float f, String str, String str2) { PathMeasure pathMeasure = new PathMeasure(path, false); ArrayList arrayList = new ArrayList(); arrayList.add(Float.valueOf(0.0f)); float f2 = 0.0f; do { f2 += pathMeasure.getLength(); arrayList.add(Float.valueOf(f2)); } while (pathMeasure.nextContour()); PathMeasure pathMeasure2 = new PathMeasure(path, false); int min = Math.min(100, ((int) (f2 / f)) + 1); float[] fArr = new float[min]; float[] fArr2 = new float[min]; float[] fArr3 = new float[2]; float f3 = f2 / (min - 1); int i = 0; float f4 = 0.0f; int i2 = 0; while (true) { if (i >= min) { break; } pathMeasure2.getPosTan(f4 - ((Float) arrayList.get(i2)).floatValue(), fArr3, null); fArr[i] = fArr3[0]; fArr2[i] = fArr3[1]; f4 += f3; int i3 = i2 + 1; if (i3 < arrayList.size() && f4 > ((Float) arrayList.get(i3)).floatValue()) { pathMeasure2.nextContour(); i2 = i3; } i++; } PropertyValuesHolder ofFloat = str != null ? PropertyValuesHolder.ofFloat(str, fArr) : null; PropertyValuesHolder ofFloat2 = str2 != null ? PropertyValuesHolder.ofFloat(str2, fArr2) : null; if (ofFloat == null) { objectAnimator.setValues(ofFloat2); } else if (ofFloat2 == null) { objectAnimator.setValues(ofFloat); } else { objectAnimator.setValues(ofFloat, ofFloat2); } } private static Animator a(Context context, Resources resources, Resources.Theme theme, XmlPullParser xmlPullParser, float f) throws XmlPullParserException, IOException { return a(context, resources, theme, xmlPullParser, Xml.asAttributeSet(xmlPullParser), null, 0, f); } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Removed duplicated region for block: B:33:0x00ba */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ private static android.animation.Animator a(android.content.Context r18, android.content.res.Resources r19, android.content.res.Resources.Theme r20, org.xmlpull.v1.XmlPullParser r21, android.util.AttributeSet r22, android.animation.AnimatorSet r23, int r24, float r25) throws org.xmlpull.v1.XmlPullParserException, java.io.IOException { /* Method dump skipped, instructions count: 265 To view this dump change 'Code comments level' option to 'DEBUG' */ throw new UnsupportedOperationException("Method not decompiled: androidx.vectordrawable.graphics.drawable.AnimatorInflaterCompat.a(android.content.Context, android.content.res.Resources, android.content.res.Resources$Theme, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.animation.AnimatorSet, int, float):android.animation.Animator"); } private static PropertyValuesHolder[] a(Context context, Resources resources, Resources.Theme theme, XmlPullParser xmlPullParser, AttributeSet attributeSet) throws XmlPullParserException, IOException { int i; PropertyValuesHolder[] propertyValuesHolderArr = null; ArrayList arrayList = null; while (true) { int eventType = xmlPullParser.getEventType(); if (eventType == 3 || eventType == 1) { break; } if (eventType != 2) { xmlPullParser.next(); } else { if (xmlPullParser.getName().equals("propertyValuesHolder")) { TypedArray a = TypedArrayUtils.a(resources, theme, attributeSet, AndroidResources.i); String a2 = TypedArrayUtils.a(a, xmlPullParser, "propertyName", 3); int b = TypedArrayUtils.b(a, xmlPullParser, "valueType", 2, 4); PropertyValuesHolder a3 = a(context, resources, theme, xmlPullParser, a2, b); if (a3 == null) { a3 = a(a, b, 0, 1, a2); } if (a3 != null) { if (arrayList == null) { arrayList = new ArrayList(); } arrayList.add(a3); } a.recycle(); } xmlPullParser.next(); } } if (arrayList != null) { int size = arrayList.size(); propertyValuesHolderArr = new PropertyValuesHolder[size]; for (i = 0; i < size; i++) { propertyValuesHolderArr[i] = (PropertyValuesHolder) arrayList.get(i); } } return propertyValuesHolderArr; } private static int a(Resources resources, Resources.Theme theme, AttributeSet attributeSet, XmlPullParser xmlPullParser) { TypedArray a = TypedArrayUtils.a(resources, theme, attributeSet, AndroidResources.j); int i = 0; TypedValue b = TypedArrayUtils.b(a, xmlPullParser, "value", 0); if ((b != null) && a(b.type)) { i = 3; } a.recycle(); return i; } private static int a(TypedArray typedArray, int i, int i2) { TypedValue peekValue = typedArray.peekValue(i); boolean z = peekValue != null; int i3 = z ? peekValue.type : 0; TypedValue peekValue2 = typedArray.peekValue(i2); boolean z2 = peekValue2 != null; return ((z && a(i3)) || (z2 && a(z2 ? peekValue2.type : 0))) ? 3 : 0; } private static PropertyValuesHolder a(Context context, Resources resources, Resources.Theme theme, XmlPullParser xmlPullParser, String str, int i) throws XmlPullParserException, IOException { int size; PropertyValuesHolder propertyValuesHolder = null; int i2 = i; ArrayList arrayList = null; while (true) { int next = xmlPullParser.next(); if (next == 3 || next == 1) { break; } if (xmlPullParser.getName().equals("keyframe")) { if (i2 == 4) { i2 = a(resources, theme, Xml.asAttributeSet(xmlPullParser), xmlPullParser); } Keyframe a = a(context, resources, theme, Xml.asAttributeSet(xmlPullParser), i2, xmlPullParser); if (a != null) { if (arrayList == null) { arrayList = new ArrayList(); } arrayList.add(a); } xmlPullParser.next(); } } if (arrayList != null && (size = arrayList.size()) > 0) { Keyframe keyframe = (Keyframe) arrayList.get(0); Keyframe keyframe2 = (Keyframe) arrayList.get(size - 1); float fraction = keyframe2.getFraction(); if (fraction < 1.0f) { if (fraction < 0.0f) { keyframe2.setFraction(1.0f); } else { arrayList.add(arrayList.size(), a(keyframe2, 1.0f)); size++; } } float fraction2 = keyframe.getFraction(); if (fraction2 != 0.0f) { if (fraction2 < 0.0f) { keyframe.setFraction(0.0f); } else { arrayList.add(0, a(keyframe, 0.0f)); size++; } } Keyframe[] keyframeArr = new Keyframe[size]; arrayList.toArray(keyframeArr); for (int i3 = 0; i3 < size; i3++) { Keyframe keyframe3 = keyframeArr[i3]; if (keyframe3.getFraction() < 0.0f) { if (i3 == 0) { keyframe3.setFraction(0.0f); } else { int i4 = size - 1; if (i3 == i4) { keyframe3.setFraction(1.0f); } else { int i5 = i3; for (int i6 = i3 + 1; i6 < i4 && keyframeArr[i6].getFraction() < 0.0f; i6++) { i5 = i6; } a(keyframeArr, keyframeArr[i5 + 1].getFraction() - keyframeArr[i3 - 1].getFraction(), i3, i5); } } } } propertyValuesHolder = PropertyValuesHolder.ofKeyframe(str, keyframeArr); if (i2 == 3) { propertyValuesHolder.setEvaluator(ArgbEvaluator.a()); } } return propertyValuesHolder; } private static Keyframe a(Keyframe keyframe, float f) { if (keyframe.getType() == Float.TYPE) { return Keyframe.ofFloat(f); } if (keyframe.getType() == Integer.TYPE) { return Keyframe.ofInt(f); } return Keyframe.ofObject(f); } private static void a(Keyframe[] keyframeArr, float f, int i, int i2) { float f2 = f / ((i2 - i) + 2); while (i <= i2) { keyframeArr[i].setFraction(keyframeArr[i - 1].getFraction() + f2); i++; } } private static Keyframe a(Context context, Resources resources, Resources.Theme theme, AttributeSet attributeSet, int i, XmlPullParser xmlPullParser) throws XmlPullParserException, IOException { Keyframe ofInt; TypedArray a = TypedArrayUtils.a(resources, theme, attributeSet, AndroidResources.j); float a2 = TypedArrayUtils.a(a, xmlPullParser, "fraction", 3, -1.0f); TypedValue b = TypedArrayUtils.b(a, xmlPullParser, "value", 0); boolean z = b != null; if (i == 4) { i = (z && a(b.type)) ? 3 : 0; } if (z) { if (i != 0) { ofInt = (i == 1 || i == 3) ? Keyframe.ofInt(a2, TypedArrayUtils.b(a, xmlPullParser, "value", 0, 0)) : null; } else { ofInt = Keyframe.ofFloat(a2, TypedArrayUtils.a(a, xmlPullParser, "value", 0, 0.0f)); } } else if (i == 0) { ofInt = Keyframe.ofFloat(a2); } else { ofInt = Keyframe.ofInt(a2); } int c = TypedArrayUtils.c(a, xmlPullParser, "interpolator", 1, 0); if (c > 0) { ofInt.setInterpolator(AnimationUtilsCompat.a(context, c)); } a.recycle(); return ofInt; } private static ObjectAnimator a(Context context, Resources resources, Resources.Theme theme, AttributeSet attributeSet, float f, XmlPullParser xmlPullParser) throws Resources.NotFoundException { ObjectAnimator objectAnimator = new ObjectAnimator(); a(context, resources, theme, attributeSet, objectAnimator, f, xmlPullParser); return objectAnimator; } private static ValueAnimator a(Context context, Resources resources, Resources.Theme theme, AttributeSet attributeSet, ValueAnimator valueAnimator, float f, XmlPullParser xmlPullParser) throws Resources.NotFoundException { TypedArray a = TypedArrayUtils.a(resources, theme, attributeSet, AndroidResources.g); TypedArray a2 = TypedArrayUtils.a(resources, theme, attributeSet, AndroidResources.k); if (valueAnimator == null) { valueAnimator = new ValueAnimator(); } a(valueAnimator, a, a2, f, xmlPullParser); int c = TypedArrayUtils.c(a, xmlPullParser, "interpolator", 0, 0); if (c > 0) { valueAnimator.setInterpolator(AnimationUtilsCompat.a(context, c)); } a.recycle(); if (a2 != null) { a2.recycle(); } return valueAnimator; } }