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.
163 lines
6.0 KiB
163 lines
6.0 KiB
package p072y0;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Resources;
|
|
import android.content.res.TypedArray;
|
|
import android.graphics.Path;
|
|
import android.graphics.PathMeasure;
|
|
import android.util.AttributeSet;
|
|
import android.view.InflateException;
|
|
import android.view.animation.Interpolator;
|
|
import org.xmlpull.v1.XmlPullParser;
|
|
import p071y.C1838q;
|
|
import p073z.C1885j;
|
|
|
|
/* renamed from: y0.j reason: invalid class name */
|
|
/* loaded from: classes.dex */
|
|
public class animationInterpolatorC1853j implements Interpolator {
|
|
|
|
/* renamed from: a */
|
|
public float[] f4606a;
|
|
|
|
/* renamed from: b */
|
|
public float[] f4607b;
|
|
|
|
public animationInterpolatorC1853j(Context context, AttributeSet attributeSet, XmlPullParser xmlPullParser) {
|
|
this(context.getResources(), context.getTheme(), attributeSet, xmlPullParser);
|
|
}
|
|
|
|
public animationInterpolatorC1853j(Resources resources, Resources.Theme theme, AttributeSet attributeSet, XmlPullParser xmlPullParser) {
|
|
TypedArray m248k = C1838q.m248k(resources, theme, attributeSet, C1840a.f4590l);
|
|
m201d(m248k, xmlPullParser);
|
|
m248k.recycle();
|
|
}
|
|
|
|
/* renamed from: a */
|
|
public final void m204a(float f, float f2, float f3, float f4) {
|
|
Path path = new Path();
|
|
path.moveTo(0.0f, 0.0f);
|
|
path.cubicTo(f, f2, f3, f4, 1.0f, 1.0f);
|
|
m203b(path);
|
|
}
|
|
|
|
/* renamed from: b */
|
|
public final void m203b(Path path) {
|
|
int i = 0;
|
|
PathMeasure pathMeasure = new PathMeasure(path, false);
|
|
float length = pathMeasure.getLength();
|
|
int min = Math.min(3000, ((int) (length / 0.002f)) + 1);
|
|
if (min <= 0) {
|
|
throw new IllegalArgumentException("The Path has a invalid length " + length);
|
|
}
|
|
this.f4606a = new float[min];
|
|
this.f4607b = new float[min];
|
|
float[] fArr = new float[2];
|
|
for (int i2 = 0; i2 < min; i2++) {
|
|
pathMeasure.getPosTan((i2 * length) / (min - 1), fArr, null);
|
|
this.f4606a[i2] = fArr[0];
|
|
this.f4607b[i2] = fArr[1];
|
|
}
|
|
if (Math.abs(this.f4606a[0]) <= 1.0E-5d && Math.abs(this.f4607b[0]) <= 1.0E-5d) {
|
|
int i3 = min - 1;
|
|
if (Math.abs(this.f4606a[i3] - 1.0f) <= 1.0E-5d && Math.abs(this.f4607b[i3] - 1.0f) <= 1.0E-5d) {
|
|
float f = 0.0f;
|
|
int i4 = 0;
|
|
while (i < min) {
|
|
float[] fArr2 = this.f4606a;
|
|
int i5 = i4 + 1;
|
|
float f2 = fArr2[i4];
|
|
if (f2 < f) {
|
|
throw new IllegalArgumentException("The Path cannot loop back on itself, x :" + f2);
|
|
}
|
|
fArr2[i] = f2;
|
|
i++;
|
|
f = f2;
|
|
i4 = i5;
|
|
}
|
|
if (pathMeasure.nextContour()) {
|
|
throw new IllegalArgumentException("The Path should be continuous, can't have 2+ contours");
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("The Path must start at (0,0) and end at (1,1) start: ");
|
|
sb.append(this.f4606a[0]);
|
|
sb.append(",");
|
|
sb.append(this.f4607b[0]);
|
|
sb.append(" end:");
|
|
int i6 = min - 1;
|
|
sb.append(this.f4606a[i6]);
|
|
sb.append(",");
|
|
sb.append(this.f4607b[i6]);
|
|
throw new IllegalArgumentException(sb.toString());
|
|
}
|
|
|
|
/* renamed from: c */
|
|
public final void m202c(float f, float f2) {
|
|
Path path = new Path();
|
|
path.moveTo(0.0f, 0.0f);
|
|
path.quadTo(f, f2, 1.0f, 1.0f);
|
|
m203b(path);
|
|
}
|
|
|
|
/* renamed from: d */
|
|
public final void m201d(TypedArray typedArray, XmlPullParser xmlPullParser) {
|
|
if (C1838q.m249j(xmlPullParser, "pathData")) {
|
|
String m250i = C1838q.m250i(typedArray, xmlPullParser, "pathData", 4);
|
|
Path m126e = C1885j.m126e(m250i);
|
|
if (m126e != null) {
|
|
m203b(m126e);
|
|
return;
|
|
}
|
|
throw new InflateException("The path is null, which is created from " + m250i);
|
|
} else if (!C1838q.m249j(xmlPullParser, "controlX1")) {
|
|
throw new InflateException("pathInterpolator requires the controlX1 attribute");
|
|
} else {
|
|
if (!C1838q.m249j(xmlPullParser, "controlY1")) {
|
|
throw new InflateException("pathInterpolator requires the controlY1 attribute");
|
|
}
|
|
float m253f = C1838q.m253f(typedArray, xmlPullParser, "controlX1", 0, 0.0f);
|
|
float m253f2 = C1838q.m253f(typedArray, xmlPullParser, "controlY1", 1, 0.0f);
|
|
boolean m249j = C1838q.m249j(xmlPullParser, "controlX2");
|
|
if (m249j != C1838q.m249j(xmlPullParser, "controlY2")) {
|
|
throw new InflateException("pathInterpolator requires both controlX2 and controlY2 for cubic Beziers.");
|
|
}
|
|
if (m249j) {
|
|
m204a(m253f, m253f2, C1838q.m253f(typedArray, xmlPullParser, "controlX2", 2, 0.0f), C1838q.m253f(typedArray, xmlPullParser, "controlY2", 3, 0.0f));
|
|
} else {
|
|
m202c(m253f, m253f2);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.animation.TimeInterpolator
|
|
public float getInterpolation(float f) {
|
|
if (f <= 0.0f) {
|
|
return 0.0f;
|
|
}
|
|
if (f >= 1.0f) {
|
|
return 1.0f;
|
|
}
|
|
int length = this.f4606a.length - 1;
|
|
int i = 0;
|
|
while (length - i > 1) {
|
|
int i2 = (i + length) / 2;
|
|
if (f < this.f4606a[i2]) {
|
|
length = i2;
|
|
} else {
|
|
i = i2;
|
|
}
|
|
}
|
|
float[] fArr = this.f4606a;
|
|
float f2 = fArr[length];
|
|
float f3 = fArr[i];
|
|
float f4 = f2 - f3;
|
|
if (f4 == 0.0f) {
|
|
return this.f4607b[i];
|
|
}
|
|
float[] fArr2 = this.f4607b;
|
|
float f5 = fArr2[i];
|
|
return f5 + (((f - f3) / f4) * (fArr2[length] - f5));
|
|
}
|
|
} |