You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

516 lines
23 KiB

package p072y0;
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.AnimatorSet;
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 java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import p071y.C1838q;
import p073z.C1885j;
/* renamed from: y0.h */
/* loaded from: classes.dex */
public class C1850h {
/* renamed from: y0.h$a */
/* loaded from: classes.dex */
public static class C1851a implements TypeEvaluator<C1885j.C1887b[]> {
/* renamed from: a */
public C1885j.C1887b[] f4604a;
@Override // android.animation.TypeEvaluator
/* renamed from: a */
public C1885j.C1887b[] evaluate(float f, C1885j.C1887b[] c1887bArr, C1885j.C1887b[] c1887bArr2) {
if (C1885j.m129b(c1887bArr, c1887bArr2)) {
if (!C1885j.m129b(this.f4604a, c1887bArr)) {
this.f4604a = C1885j.m125f(c1887bArr);
}
for (int i = 0; i < c1887bArr.length; i++) {
this.f4604a[i].m117d(c1887bArr[i], c1887bArr2[i], f);
}
return this.f4604a;
}
throw new IllegalArgumentException("Can't interpolate between two incompatible pathData");
}
}
/* renamed from: a */
public static Animator m225a(Context context, Resources resources, Resources.Theme theme, XmlPullParser xmlPullParser, float f) {
return m224b(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:0x00b8 */
/* renamed from: b */
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public static Animator m224b(Context context, Resources resources, Resources.Theme theme, XmlPullParser xmlPullParser, AttributeSet attributeSet, AnimatorSet animatorSet, int i, float f) {
int i2;
int depth = xmlPullParser.getDepth();
ValueAnimator valueAnimator = null;
ArrayList arrayList = null;
while (true) {
int next = xmlPullParser.next();
i2 = 0;
if ((next != 3 || xmlPullParser.getDepth() > depth) && next != 1) {
if (next == 2) {
String name = xmlPullParser.getName();
if (name.equals("objectAnimator")) {
valueAnimator = m212n(context, resources, theme, attributeSet, f, xmlPullParser);
} else if (name.equals("animator")) {
valueAnimator = m214l(context, resources, theme, attributeSet, null, f, xmlPullParser);
} else {
if (name.equals("set")) {
AnimatorSet animatorSet2 = new AnimatorSet();
TypedArray m248k = C1838q.m248k(resources, theme, attributeSet, C1840a.f4586h);
m224b(context, resources, theme, xmlPullParser, attributeSet, animatorSet2, C1838q.m252g(m248k, xmlPullParser, "ordering", 0, 0), f);
m248k.recycle();
valueAnimator = animatorSet2;
} else if (!name.equals("propertyValuesHolder")) {
throw new RuntimeException("Unknown animator name: " + xmlPullParser.getName());
} else {
PropertyValuesHolder[] m210p = m210p(context, resources, theme, xmlPullParser, Xml.asAttributeSet(xmlPullParser));
if (m210p != null && (valueAnimator instanceof ValueAnimator)) {
valueAnimator.setValues(m210p);
}
i2 = 1;
}
if (animatorSet != null && i2 == 0) {
if (arrayList == null) {
arrayList = new ArrayList();
}
arrayList.add(valueAnimator);
}
}
if (animatorSet != null) {
if (arrayList == null) {
}
arrayList.add(valueAnimator);
}
}
}
}
if (animatorSet != null && arrayList != null) {
Animator[] animatorArr = new Animator[arrayList.size()];
Iterator it = arrayList.iterator();
while (it.hasNext()) {
animatorArr[i2] = (Animator) it.next();
i2++;
}
if (i == 0) {
animatorSet.playTogether(animatorArr);
} else {
animatorSet.playSequentially(animatorArr);
}
}
return valueAnimator;
}
/* renamed from: c */
public static Keyframe m223c(Keyframe keyframe, float f) {
return keyframe.getType() == Float.TYPE ? Keyframe.ofFloat(f) : keyframe.getType() == Integer.TYPE ? Keyframe.ofInt(f) : Keyframe.ofObject(f);
}
/* renamed from: d */
public static void m222d(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++;
}
}
/* renamed from: e */
public static PropertyValuesHolder m221e(TypedArray typedArray, int i, int i2, int i3, String str) {
PropertyValuesHolder ofFloat;
PropertyValuesHolder ofObject;
TypedValue peekValue = typedArray.peekValue(i2);
boolean z = peekValue != null;
int i4 = z ? peekValue.type : 0;
TypedValue peekValue2 = typedArray.peekValue(i3);
boolean z2 = peekValue2 != null;
int i5 = z2 ? peekValue2.type : 0;
if (i == 4) {
i = ((z && m218h(i4)) || (z2 && m218h(i5))) ? 3 : 0;
}
boolean z3 = i == 0;
PropertyValuesHolder propertyValuesHolder = null;
if (i != 2) {
C1852i m205a = i == 3 ? C1852i.m205a() : null;
if (z3) {
if (z) {
float dimension = i4 == 5 ? typedArray.getDimension(i2, 0.0f) : typedArray.getFloat(i2, 0.0f);
if (z2) {
ofFloat = PropertyValuesHolder.ofFloat(str, dimension, i5 == 5 ? typedArray.getDimension(i3, 0.0f) : typedArray.getFloat(i3, 0.0f));
} else {
ofFloat = PropertyValuesHolder.ofFloat(str, dimension);
}
} else {
ofFloat = PropertyValuesHolder.ofFloat(str, i5 == 5 ? typedArray.getDimension(i3, 0.0f) : typedArray.getFloat(i3, 0.0f));
}
propertyValuesHolder = ofFloat;
} else if (z) {
int dimension2 = i4 == 5 ? (int) typedArray.getDimension(i2, 0.0f) : m218h(i4) ? typedArray.getColor(i2, 0) : typedArray.getInt(i2, 0);
if (z2) {
propertyValuesHolder = PropertyValuesHolder.ofInt(str, dimension2, i5 == 5 ? (int) typedArray.getDimension(i3, 0.0f) : m218h(i5) ? typedArray.getColor(i3, 0) : typedArray.getInt(i3, 0));
} else {
propertyValuesHolder = PropertyValuesHolder.ofInt(str, dimension2);
}
} else if (z2) {
propertyValuesHolder = PropertyValuesHolder.ofInt(str, i5 == 5 ? (int) typedArray.getDimension(i3, 0.0f) : m218h(i5) ? typedArray.getColor(i3, 0) : typedArray.getInt(i3, 0));
}
if (propertyValuesHolder == null || m205a == null) {
return propertyValuesHolder;
}
propertyValuesHolder.setEvaluator(m205a);
return propertyValuesHolder;
}
String string = typedArray.getString(i2);
String string2 = typedArray.getString(i3);
C1885j.C1887b[] m127d = C1885j.m127d(string);
C1885j.C1887b[] m127d2 = C1885j.m127d(string2);
if (m127d == null && m127d2 == null) {
return null;
}
if (m127d == null) {
if (m127d2 != null) {
return PropertyValuesHolder.ofObject(str, new C1851a(), m127d2);
}
return null;
}
C1851a c1851a = new C1851a();
if (m127d2 == null) {
ofObject = PropertyValuesHolder.ofObject(str, c1851a, m127d);
} else if (!C1885j.m129b(m127d, m127d2)) {
throw new InflateException(" Can't morph from " + string + " to " + string2);
} else {
ofObject = PropertyValuesHolder.ofObject(str, c1851a, m127d, m127d2);
}
return ofObject;
}
/* renamed from: f */
public static int m220f(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 && m218h(i3)) || (z2 && m218h(z2 ? peekValue2.type : 0))) ? 3 : 0;
}
/* renamed from: g */
public static int m219g(Resources resources, Resources.Theme theme, AttributeSet attributeSet, XmlPullParser xmlPullParser) {
TypedArray m248k = C1838q.m248k(resources, theme, attributeSet, C1840a.f4588j);
int i = 0;
TypedValue m247l = C1838q.m247l(m248k, xmlPullParser, "value", 0);
if ((m247l != null) && m218h(m247l.type)) {
i = 3;
}
m248k.recycle();
return i;
}
/* renamed from: h */
public static boolean m218h(int i) {
return i >= 28 && i <= 31;
}
/* renamed from: i */
public static Animator m217i(Context context, int i) {
return Build.VERSION.SDK_INT >= 24 ? AnimatorInflater.loadAnimator(context, i) : m216j(context, context.getResources(), context.getTheme(), i);
}
/* renamed from: j */
public static Animator m216j(Context context, Resources resources, Resources.Theme theme, int i) {
return m215k(context, resources, theme, i, 1.0f);
}
/* renamed from: k */
public static Animator m215k(Context context, Resources resources, Resources.Theme theme, int i, float f) {
XmlResourceParser xmlResourceParser = null;
try {
try {
try {
xmlResourceParser = resources.getAnimation(i);
return m225a(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();
}
}
}
/* renamed from: l */
public static ValueAnimator m214l(Context context, Resources resources, Resources.Theme theme, AttributeSet attributeSet, ValueAnimator valueAnimator, float f, XmlPullParser xmlPullParser) {
TypedArray m248k = C1838q.m248k(resources, theme, attributeSet, C1840a.f4585g);
TypedArray m248k2 = C1838q.m248k(resources, theme, attributeSet, C1840a.f4589k);
if (valueAnimator == null) {
valueAnimator = new ValueAnimator();
}
m209q(valueAnimator, m248k, m248k2, f, xmlPullParser);
int m251h = C1838q.m251h(m248k, xmlPullParser, "interpolator", 0, 0);
if (m251h > 0) {
valueAnimator.setInterpolator(C1849g.m226b(context, m251h));
}
m248k.recycle();
if (m248k2 != null) {
m248k2.recycle();
}
return valueAnimator;
}
/* renamed from: m */
public static Keyframe m213m(Context context, Resources resources, Resources.Theme theme, AttributeSet attributeSet, int i, XmlPullParser xmlPullParser) {
TypedArray m248k = C1838q.m248k(resources, theme, attributeSet, C1840a.f4588j);
float m253f = C1838q.m253f(m248k, xmlPullParser, "fraction", 3, -1.0f);
TypedValue m247l = C1838q.m247l(m248k, xmlPullParser, "value", 0);
boolean z = m247l != null;
if (i == 4) {
i = (z && m218h(m247l.type)) ? 3 : 0;
}
Keyframe ofInt = z ? i != 0 ? (i == 1 || i == 3) ? Keyframe.ofInt(m253f, C1838q.m252g(m248k, xmlPullParser, "value", 0, 0)) : null : Keyframe.ofFloat(m253f, C1838q.m253f(m248k, xmlPullParser, "value", 0, 0.0f)) : i == 0 ? Keyframe.ofFloat(m253f) : Keyframe.ofInt(m253f);
int m251h = C1838q.m251h(m248k, xmlPullParser, "interpolator", 1, 0);
if (m251h > 0) {
ofInt.setInterpolator(C1849g.m226b(context, m251h));
}
m248k.recycle();
return ofInt;
}
/* renamed from: n */
public static ObjectAnimator m212n(Context context, Resources resources, Resources.Theme theme, AttributeSet attributeSet, float f, XmlPullParser xmlPullParser) {
ObjectAnimator objectAnimator = new ObjectAnimator();
m214l(context, resources, theme, attributeSet, objectAnimator, f, xmlPullParser);
return objectAnimator;
}
/* renamed from: o */
public static PropertyValuesHolder m211o(Context context, Resources resources, Resources.Theme theme, XmlPullParser xmlPullParser, String str, int i) {
int size;
PropertyValuesHolder propertyValuesHolder = null;
ArrayList arrayList = null;
while (true) {
int next = xmlPullParser.next();
if (next == 3 || next == 1) {
break;
} else if (xmlPullParser.getName().equals("keyframe")) {
if (i == 4) {
i = m219g(resources, theme, Xml.asAttributeSet(xmlPullParser), xmlPullParser);
}
Keyframe m213m = m213m(context, resources, theme, Xml.asAttributeSet(xmlPullParser), i, xmlPullParser);
if (m213m != null) {
if (arrayList == null) {
arrayList = new ArrayList();
}
arrayList.add(m213m);
}
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(), m223c(keyframe2, 1.0f));
size++;
}
}
float fraction2 = keyframe.getFraction();
if (fraction2 != 0.0f) {
if (fraction2 < 0.0f) {
keyframe.setFraction(0.0f);
} else {
arrayList.add(0, m223c(keyframe, 0.0f));
size++;
}
}
Keyframe[] keyframeArr = new Keyframe[size];
arrayList.toArray(keyframeArr);
for (int i2 = 0; i2 < size; i2++) {
Keyframe keyframe3 = keyframeArr[i2];
if (keyframe3.getFraction() < 0.0f) {
if (i2 == 0) {
keyframe3.setFraction(0.0f);
} else {
int i3 = size - 1;
if (i2 == i3) {
keyframe3.setFraction(1.0f);
} else {
int i4 = i2;
for (int i5 = i2 + 1; i5 < i3 && keyframeArr[i5].getFraction() < 0.0f; i5++) {
i4 = i5;
}
m222d(keyframeArr, keyframeArr[i4 + 1].getFraction() - keyframeArr[i2 - 1].getFraction(), i2, i4);
}
}
}
}
propertyValuesHolder = PropertyValuesHolder.ofKeyframe(str, keyframeArr);
if (i == 3) {
propertyValuesHolder.setEvaluator(C1852i.m205a());
}
}
return propertyValuesHolder;
}
/* renamed from: p */
public static PropertyValuesHolder[] m210p(Context context, Resources resources, Resources.Theme theme, XmlPullParser xmlPullParser, AttributeSet attributeSet) {
int i;
PropertyValuesHolder[] propertyValuesHolderArr = null;
ArrayList arrayList = null;
while (true) {
int eventType = xmlPullParser.getEventType();
if (eventType == 3 || eventType == 1) {
break;
}
if (eventType == 2 && xmlPullParser.getName().equals("propertyValuesHolder")) {
TypedArray m248k = C1838q.m248k(resources, theme, attributeSet, C1840a.f4587i);
String m250i = C1838q.m250i(m248k, xmlPullParser, "propertyName", 3);
int m252g = C1838q.m252g(m248k, xmlPullParser, "valueType", 2, 4);
PropertyValuesHolder m211o = m211o(context, resources, theme, xmlPullParser, m250i, m252g);
if (m211o == null) {
m211o = m221e(m248k, m252g, 0, 1, m250i);
}
if (m211o != null) {
if (arrayList == null) {
arrayList = new ArrayList();
}
arrayList.add(m211o);
}
m248k.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;
}
/* renamed from: q */
public static void m209q(ValueAnimator valueAnimator, TypedArray typedArray, TypedArray typedArray2, float f, XmlPullParser xmlPullParser) {
long m252g = C1838q.m252g(typedArray, xmlPullParser, "duration", 1, 300);
long m252g2 = C1838q.m252g(typedArray, xmlPullParser, "startOffset", 2, 0);
int m252g3 = C1838q.m252g(typedArray, xmlPullParser, "valueType", 7, 4);
if (C1838q.m249j(xmlPullParser, "valueFrom") && C1838q.m249j(xmlPullParser, "valueTo")) {
if (m252g3 == 4) {
m252g3 = m220f(typedArray, 5, 6);
}
PropertyValuesHolder m221e = m221e(typedArray, m252g3, 5, 6, "");
if (m221e != null) {
valueAnimator.setValues(m221e);
}
}
valueAnimator.setDuration(m252g);
valueAnimator.setStartDelay(m252g2);
valueAnimator.setRepeatCount(C1838q.m252g(typedArray, xmlPullParser, "repeatCount", 3, 0));
valueAnimator.setRepeatMode(C1838q.m252g(typedArray, xmlPullParser, "repeatMode", 4, 1));
if (typedArray2 != null) {
m208r(valueAnimator, typedArray2, m252g3, f, xmlPullParser);
}
}
/* renamed from: r */
public static void m208r(ValueAnimator valueAnimator, TypedArray typedArray, int i, float f, XmlPullParser xmlPullParser) {
ObjectAnimator objectAnimator = (ObjectAnimator) valueAnimator;
String m250i = C1838q.m250i(typedArray, xmlPullParser, "pathData", 1);
if (m250i == null) {
objectAnimator.setPropertyName(C1838q.m250i(typedArray, xmlPullParser, "propertyName", 0));
return;
}
String m250i2 = C1838q.m250i(typedArray, xmlPullParser, "propertyXName", 2);
String m250i3 = C1838q.m250i(typedArray, xmlPullParser, "propertyYName", 3);
if (i != 2) {
}
if (m250i2 != null || m250i3 != null) {
m207s(C1885j.m126e(m250i), objectAnimator, f * 0.5f, m250i2, m250i3);
return;
}
throw new InflateException(typedArray.getPositionDescription() + " propertyXName or propertyYName is needed for PathData");
}
/* renamed from: s */
public static void m207s(Path path, ObjectAnimator objectAnimator, float f, String str, String str2) {
PathMeasure pathMeasure = new PathMeasure(path, false);
ArrayList arrayList = new ArrayList();
float f2 = 0.0f;
arrayList.add(Float.valueOf(0.0f));
float f3 = 0.0f;
do {
f3 += pathMeasure.getLength();
arrayList.add(Float.valueOf(f3));
} while (pathMeasure.nextContour());
PathMeasure pathMeasure2 = new PathMeasure(path, false);
int min = Math.min(100, ((int) (f3 / f)) + 1);
float[] fArr = new float[min];
float[] fArr2 = new float[min];
float[] fArr3 = new float[2];
float f4 = f3 / (min - 1);
int i = 0;
int i2 = 0;
while (true) {
if (i >= min) {
break;
}
pathMeasure2.getPosTan(f2 - ((Float) arrayList.get(i2)).floatValue(), fArr3, null);
fArr[i] = fArr3[0];
fArr2[i] = fArr3[1];
f2 += f4;
int i3 = i2 + 1;
if (i3 < arrayList.size() && f2 > ((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);
}
}
}