Rabbit-R1/original r1/java/sources/androidx/compose/foundation/layout/AndroidFlingSpline.java
2024-05-21 17:08:36 -04:00

167 lines
8.2 KiB
Java

package androidx.compose.foundation.layout;
import io.flutter.embedding.android.KeyboardMap;
import kotlin.Metadata;
import kotlin.jvm.JvmInline;
import kotlin.jvm.internal.FloatCompanionObject;
/* compiled from: WindowInsetsConnection.android.kt */
@Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0014\n\u0002\b\u0002\n\u0002\u0010\u0006\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\\u0002\u0018\u00002\u00020\u0001:\u0001\u0012B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\u000bJ\u001e\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u000bø\u0001\u0000ø\u0001\u0001ø\u0001\u0002¢\u0006\u0004\b\u0010\u0010\u0011R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000\u0082\u0002\u000f\n\u0002\b!\n\u0005\\u001e0\u0001\n\u0002\b\u0019¨\u0006\u0013"}, d2 = {"Landroidx/compose/foundation/layout/AndroidFlingSpline;", "", "()V", "NbSamples", "", "SplinePositions", "", "SplineTimes", "deceleration", "", "velocity", "", "friction", "flingPosition", "Landroidx/compose/foundation/layout/AndroidFlingSpline$FlingResult;", "time", "flingPosition-LfoxSSI", "(F)J", "FlingResult", "foundation-layout_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
final class AndroidFlingSpline {
private static final int NbSamples = 100;
public static final AndroidFlingSpline INSTANCE = new AndroidFlingSpline();
private static final float[] SplinePositions = new float[101];
private static final float[] SplineTimes = new float[101];
private AndroidFlingSpline() {
}
static {
float f;
float f2;
float f3;
float f4;
float f5;
float f6;
float f7;
float f8;
float f9 = 0.0f;
float f10 = 0.0f;
for (int i = 0; i < 100; i++) {
float f11 = i / 100;
float f12 = 1.0f;
while (true) {
f = ((f12 - f9) / 2.0f) + f9;
f2 = 1.0f - f;
f3 = f * 3.0f * f2;
f4 = f * f * f;
float f13 = (((f2 * 0.175f) + (f * 0.35000002f)) * f3) + f4;
if (Math.abs(f13 - f11) < 1.0E-5d) {
break;
} else if (f13 > f11) {
f12 = f;
} else {
f9 = f;
}
}
float f14 = 0.5f;
SplinePositions[i] = (f3 * ((f2 * 0.5f) + f)) + f4;
float f15 = 1.0f;
while (true) {
f5 = ((f15 - f10) / 2.0f) + f10;
f6 = 1.0f - f5;
f7 = f5 * 3.0f * f6;
f8 = f5 * f5 * f5;
float f16 = (((f6 * f14) + f5) * f7) + f8;
if (Math.abs(f16 - f11) >= 1.0E-5d) {
if (f16 > f11) {
f15 = f5;
} else {
f10 = f5;
}
f14 = 0.5f;
}
}
SplineTimes[i] = (f7 * ((f6 * 0.175f) + (f5 * 0.35000002f))) + f8;
}
SplineTimes[100] = 1.0f;
SplinePositions[100] = 1.0f;
}
/* renamed from: flingPosition-LfoxSSI, reason: not valid java name */
public final long m391flingPositionLfoxSSI(float time) {
float f;
float f2;
float f3 = 100;
int i = (int) (f3 * time);
if (i < 100) {
float f4 = i / f3;
int i2 = i + 1;
float f5 = i2 / f3;
float[] fArr = SplinePositions;
float f6 = fArr[i];
f2 = (fArr[i2] - f6) / (f5 - f4);
f = f6 + ((time - f4) * f2);
} else {
f = 1.0f;
f2 = 0.0f;
}
return FlingResult.m393constructorimpl((Float.floatToIntBits(f) << 32) | (Float.floatToIntBits(f2) & KeyboardMap.kValueMask));
}
public final double deceleration(float velocity, float friction) {
return Math.log((Math.abs(velocity) * 0.35f) / friction);
}
/* compiled from: WindowInsetsConnection.android.kt */
@Metadata(d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0010\u0007\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0003\b\u0087@\u0018\u00002\u00020\u0001B\u0012\u0012\u0006\u0010\u0002\u001a\u00020\u0003ø\u0001\u0000¢\u0006\u0004\b\u0004\u0010\u0005J\u001a\u0010\f\u001a\u00020\r2\b\u0010\u000e\u001a\u0004\u0018\u00010\u0001HÖ\u0003¢\u0006\u0004\b\u000f\u0010\u0010J\u0010\u0010\u0011\u001a\u00020\u0012HÖ\u0001¢\u0006\u0004\b\u0013\u0010\u0014J\u0010\u0010\u0015\u001a\u00020\u0016HÖ\u0001¢\u0006\u0004\b\u0017\u0010\u0018R\u0011\u0010\u0006\u001a\u00020\u00078F¢\u0006\u0006\u001a\u0004\b\b\u0010\tR\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\n\u001a\u00020\u00078F¢\u0006\u0006\u001a\u0004\b\u000b\u0010\t\u0088\u0001\u0002\u0092\u0001\u00020\u0003ø\u0001\u0000\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\u0019"}, d2 = {"Landroidx/compose/foundation/layout/AndroidFlingSpline$FlingResult;", "", "packedValue", "", "constructor-impl", "(J)J", "distanceCoefficient", "", "getDistanceCoefficient-impl", "(J)F", "velocityCoefficient", "getVelocityCoefficient-impl", "equals", "", "other", "equals-impl", "(JLjava/lang/Object;)Z", "hashCode", "", "hashCode-impl", "(J)I", "toString", "", "toString-impl", "(J)Ljava/lang/String;", "foundation-layout_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
@JvmInline
/* loaded from: classes.dex */
public static final class FlingResult {
private final long packedValue;
/* renamed from: box-impl, reason: not valid java name */
public static final /* synthetic */ FlingResult m392boximpl(long j) {
return new FlingResult(j);
}
/* renamed from: constructor-impl, reason: not valid java name */
public static long m393constructorimpl(long j) {
return j;
}
/* renamed from: equals-impl, reason: not valid java name */
public static boolean m394equalsimpl(long j, Object obj) {
return (obj instanceof FlingResult) && j == ((FlingResult) obj).getPackedValue();
}
/* renamed from: equals-impl0, reason: not valid java name */
public static final boolean m395equalsimpl0(long j, long j2) {
return j == j2;
}
/* renamed from: hashCode-impl, reason: not valid java name */
public static int m398hashCodeimpl(long j) {
return Long.hashCode(j);
}
/* renamed from: toString-impl, reason: not valid java name */
public static String m399toStringimpl(long j) {
return "FlingResult(packedValue=" + j + ')';
}
public boolean equals(Object obj) {
return m394equalsimpl(this.packedValue, obj);
}
public int hashCode() {
return m398hashCodeimpl(this.packedValue);
}
public String toString() {
return m399toStringimpl(this.packedValue);
}
/* renamed from: unbox-impl, reason: not valid java name and from getter */
public final /* synthetic */ long getPackedValue() {
return this.packedValue;
}
private /* synthetic */ FlingResult(long j) {
this.packedValue = j;
}
/* renamed from: getDistanceCoefficient-impl, reason: not valid java name */
public static final float m396getDistanceCoefficientimpl(long j) {
FloatCompanionObject floatCompanionObject = FloatCompanionObject.INSTANCE;
return Float.intBitsToFloat((int) (j >> 32));
}
/* renamed from: getVelocityCoefficient-impl, reason: not valid java name */
public static final float m397getVelocityCoefficientimpl(long j) {
FloatCompanionObject floatCompanionObject = FloatCompanionObject.INSTANCE;
return Float.intBitsToFloat((int) (j & KeyboardMap.kValueMask));
}
}
}