46 lines
1.7 KiB
Java
46 lines
1.7 KiB
Java
package androidx.transition;
|
|
|
|
import android.graphics.Path;
|
|
import android.graphics.PathMeasure;
|
|
import android.graphics.PointF;
|
|
import android.util.Property;
|
|
public class PathProperty<T> extends Property<T, Float> {
|
|
private float mCurrentFraction;
|
|
private final float mPathLength;
|
|
private final PathMeasure mPathMeasure;
|
|
private final PointF mPointF = new PointF();
|
|
private final float[] mPosition = new float[2];
|
|
private final Property<T, PointF> mProperty;
|
|
|
|
public PathProperty(Property<T, PointF> property, Path path) {
|
|
super(Float.class, property.getName());
|
|
this.mProperty = property;
|
|
PathMeasure pathMeasure = new PathMeasure(path, false);
|
|
this.mPathMeasure = pathMeasure;
|
|
this.mPathLength = pathMeasure.getLength();
|
|
}
|
|
|
|
@Override // android.util.Property
|
|
public Float get(T t) {
|
|
return Float.valueOf(this.mCurrentFraction);
|
|
}
|
|
|
|
public void set(T t, Float f) {
|
|
this.mCurrentFraction = f.floatValue();
|
|
this.mPathMeasure.getPosTan(f.floatValue() * this.mPathLength, this.mPosition, null);
|
|
PointF pointF = this.mPointF;
|
|
float[] fArr = this.mPosition;
|
|
pointF.x = fArr[0];
|
|
pointF.y = fArr[1];
|
|
this.mProperty.set(t, pointF);
|
|
}
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */
|
|
/* JADX DEBUG: Multi-variable search result rejected for r1v0, resolved type: java.lang.Object */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // android.util.Property
|
|
public /* bridge */ /* synthetic */ void set(Object obj, Float f) {
|
|
set((PathProperty<T>) obj, f);
|
|
}
|
|
}
|