Rabbit-R1/android (non root)/java/sources/androidx/compose/material/ripple/RippleAnimation.java

244 lines
15 KiB
Java
Raw Normal View History

2024-05-21 16:08:36 -05:00
package androidx.compose.material.ripple;
import androidx.compose.animation.core.Animatable;
import androidx.compose.animation.core.AnimatableKt;
import androidx.compose.animation.core.AnimationVector1D;
import androidx.compose.material3.MenuKt;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.SnapshotStateKt__SnapshotStateKt;
import androidx.compose.ui.geometry.Offset;
import androidx.compose.ui.geometry.OffsetKt;
import androidx.compose.ui.geometry.Size;
import androidx.compose.ui.graphics.ClipOp;
import androidx.compose.ui.graphics.Color;
import androidx.compose.ui.graphics.drawscope.DrawContext;
import androidx.compose.ui.graphics.drawscope.DrawScope;
import androidx.compose.ui.util.MathHelpersKt;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.CompletableDeferred;
import kotlinx.coroutines.CompletableDeferredKt;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.Job;
/* compiled from: RippleAnimation.kt */
@Metadata(d1 = {"\u0000H\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0007\n\u0002\u0018\u0002\n\u0002\b\u000b\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u000f\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0000\u0018\u00002\u00020\u0001B\"\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007ø\u0001\u0000¢\u0006\u0002\u0010\bJ\u0011\u0010#\u001a\u00020\u0019H\u0086@ø\u0001\u0000¢\u0006\u0002\u0010$J\u0011\u0010%\u001a\u00020\u0019H\u0082@ø\u0001\u0000¢\u0006\u0002\u0010$J\u0011\u0010&\u001a\u00020\u0019H\u0082@ø\u0001\u0000¢\u0006\u0002\u0010$J\u0006\u0010'\u001a\u00020\u0019J\u001f\u0010(\u001a\u00020\u0019*\u00020)2\u0006\u0010*\u001a\u00020+ø\u0001\u0001ø\u0001\u0000¢\u0006\u0004\b,\u0010-R\u001a\u0010\t\u001a\u000e\u0012\u0004\u0012\u00020\u000b\u0012\u0004\u0012\u00020\f0\nX\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010\r\u001a\u000e\u0012\u0004\u0012\u00020\u000b\u0012\u0004\u0012\u00020\f0\nX\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010\u000e\u001a\u000e\u0012\u0004\u0012\u00020\u000b\u0012\u0004\u0012\u00020\f0\nX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R+\u0010\u0010\u001a\u00020\u00072\u0006\u0010\u000f\u001a\u00020\u00078B@BX\u0082\u008e\u0002¢\u0006\u0012\n\u0004\b\u0015\u0010\u0016\u001a\u0004\b\u0011\u0010\u0012\"\u0004\b\u0013\u0010\u0014R\u0014\u0010\u0017\u001a\b\u0012\u0004\u0012\u00020\u00190\u0018X\u0082\u0004¢\u0006\u0002\n\u0000R+\u0010\u001a\u001a\u00020\u00072\u0006\u0010\u000f\u001a\u00020\u00078B@BX\u0082\u008e\u0002¢\u0006\u0012\n\u0004\b\u001d\u0010\u0016\u001a\u0004\b\u001b\u0010\u0012\"\u0004\b\u001c\u0010\u0014R\u0019\u0010\u0002\u001a\u0004\u0018\u00010\u0003X\u0082\u000eø\u0001\u0000ø\u0001\u0001ø\u0001\u0002¢\u0006\u0002\n\u0000R\u0019\u0010\u0004\u001a\u00020\u0005X\u0082\u0004ø\u0001\u0000ø\u0001\u0001ø\u0001\u0002¢\u0006\u0004\n\u0002\u0010\u001eR\u0012\u0010\u001f\u001a\u0004\u0018\u00010\u000bX\u0082\u000e¢\u0006\u0004\n\u0002\u0010 R\u0019\u0010!\u001a\u0004\u0018\u00010\u0003X\u0082\u000eø\u0001\u0000ø\u0001\u0001ø\u0001\u0002¢\u0006\u0002\n\u0000R\u0012\u0010\"\u001a\u0004\u0018\u00010\u000bX\u0082\u000e¢\u0006\u0004\n\u0002\u0010 \u0082\u0002\u000f\n\u0002\b\u0019\n\u0005\\u001e0\u0001\n\u0002\b!¨\u0006."}, d2 = {"Landroidx/compose/material/ripple/RippleAnimation;", "", "origin", "Landroidx/compose/ui/geometry/Offset;", "radius", "Landroidx/compose/ui/unit/Dp;", "bounded", "", "(Landroidx/compose/ui/geometry/Offset;FZLkotlin/jvm/internal/DefaultConstructorMarker;)V", "animatedAlpha", "Landroidx/compose/animation/core/Animatable;", "", "Landroidx/compose/animation/core/AnimationVector1D;", "animatedCenterPercent", "animatedRadiusPercent", "<set-?>", "finishRequested", "getFinishRequested", "()Z", "setFinishRequested", "(Z)V", "finishRequested$delegate", "Landroidx/compose/runtime/MutableState;", "finishSignalDeferred", "Lkotlinx/coroutines/CompletableDeferred;", "", "finishedFadingIn", "getFinishedFadingIn", "setFinishedFadingIn", "finishedFadingIn$delegate", "F", "startRadius", "Ljava/lang/Float;", "targetCenter", "targetRadius", "animate", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "fadeIn", "fadeOut", "finish", "draw", "Landroidx/compose/ui/graphics/drawscope/DrawScope;", "color", "Landroidx/compose/ui/graphics/Color;", "draw-4WTKRHQ", "(Landroidx/compose/ui/graphics/drawscope/DrawScope;J)V", "material-ripple_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class RippleAnimation {
private final Animatable<Float, AnimationVector1D> animatedAlpha;
private final Animatable<Float, AnimationVector1D> animatedCenterPercent;
private final Animatable<Float, AnimationVector1D> animatedRadiusPercent;
private final boolean bounded;
/* renamed from: finishRequested$delegate, reason: from kotlin metadata */
private final MutableState finishRequested;
private final CompletableDeferred<Unit> finishSignalDeferred;
/* renamed from: finishedFadingIn$delegate, reason: from kotlin metadata */
private final MutableState finishedFadingIn;
private Offset origin;
private final float radius;
private Float startRadius;
private Offset targetCenter;
private Float targetRadius;
public /* synthetic */ RippleAnimation(Offset offset, float f, boolean z, DefaultConstructorMarker defaultConstructorMarker) {
this(offset, f, z);
}
private RippleAnimation(Offset offset, float f, boolean z) {
MutableState mutableStateOf$default;
MutableState mutableStateOf$default2;
this.origin = offset;
this.radius = f;
this.bounded = z;
this.animatedAlpha = AnimatableKt.Animatable$default(0.0f, 0.0f, 2, null);
this.animatedRadiusPercent = AnimatableKt.Animatable$default(0.0f, 0.0f, 2, null);
this.animatedCenterPercent = AnimatableKt.Animatable$default(0.0f, 0.0f, 2, null);
this.finishSignalDeferred = CompletableDeferredKt.CompletableDeferred((Job) null);
mutableStateOf$default = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(false, null, 2, null);
this.finishedFadingIn = mutableStateOf$default;
mutableStateOf$default2 = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(false, null, 2, null);
this.finishRequested = mutableStateOf$default2;
}
/* JADX WARN: Multi-variable type inference failed */
private final boolean getFinishedFadingIn() {
return ((Boolean) this.finishedFadingIn.getValue()).booleanValue();
}
private final void setFinishedFadingIn(boolean z) {
this.finishedFadingIn.setValue(Boolean.valueOf(z));
}
/* JADX WARN: Multi-variable type inference failed */
private final boolean getFinishRequested() {
return ((Boolean) this.finishRequested.getValue()).booleanValue();
}
private final void setFinishRequested(boolean z) {
this.finishRequested.setValue(Boolean.valueOf(z));
}
/* JADX WARN: Removed duplicated region for block: B:20:0x0071 A[RETURN] */
/* JADX WARN: Removed duplicated region for block: B:24:0x0065 A[RETURN] */
/* JADX WARN: Removed duplicated region for block: B:25:0x0048 */
/* JADX WARN: Removed duplicated region for block: B:8:0x0026 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final java.lang.Object animate(kotlin.coroutines.Continuation<? super kotlin.Unit> r7) {
/*
r6 = this;
boolean r0 = r7 instanceof androidx.compose.material.ripple.RippleAnimation$animate$1
if (r0 == 0) goto L14
r0 = r7
androidx.compose.material.ripple.RippleAnimation$animate$1 r0 = (androidx.compose.material.ripple.RippleAnimation$animate$1) r0
int r1 = r0.label
r2 = -2147483648(0xffffffff80000000, float:-0.0)
r1 = r1 & r2
if (r1 == 0) goto L14
int r7 = r0.label
int r7 = r7 - r2
r0.label = r7
goto L19
L14:
androidx.compose.material.ripple.RippleAnimation$animate$1 r0 = new androidx.compose.material.ripple.RippleAnimation$animate$1
r0.<init>(r6, r7)
L19:
java.lang.Object r7 = r0.result
java.lang.Object r1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()
int r2 = r0.label
r3 = 3
r4 = 2
r5 = 1
if (r2 == 0) goto L48
if (r2 == r5) goto L40
if (r2 == r4) goto L38
if (r2 != r3) goto L30
kotlin.ResultKt.throwOnFailure(r7)
goto L72
L30:
java.lang.IllegalStateException r6 = new java.lang.IllegalStateException
java.lang.String r7 = "call to 'resume' before 'invoke' with coroutine"
r6.<init>(r7)
throw r6
L38:
java.lang.Object r6 = r0.L$0
androidx.compose.material.ripple.RippleAnimation r6 = (androidx.compose.material.ripple.RippleAnimation) r6
kotlin.ResultKt.throwOnFailure(r7)
goto L66
L40:
java.lang.Object r6 = r0.L$0
androidx.compose.material.ripple.RippleAnimation r6 = (androidx.compose.material.ripple.RippleAnimation) r6
kotlin.ResultKt.throwOnFailure(r7)
goto L56
L48:
kotlin.ResultKt.throwOnFailure(r7)
r0.L$0 = r6
r0.label = r5
java.lang.Object r7 = r6.fadeIn(r0)
if (r7 != r1) goto L56
return r1
L56:
r6.setFinishedFadingIn(r5)
kotlinx.coroutines.CompletableDeferred<kotlin.Unit> r7 = r6.finishSignalDeferred
r0.L$0 = r6
r0.label = r4
java.lang.Object r7 = r7.await(r0)
if (r7 != r1) goto L66
return r1
L66:
r7 = 0
r0.L$0 = r7
r0.label = r3
java.lang.Object r6 = r6.fadeOut(r0)
if (r6 != r1) goto L72
return r1
L72:
kotlin.Unit r6 = kotlin.Unit.INSTANCE
return r6
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.compose.material.ripple.RippleAnimation.animate(kotlin.coroutines.Continuation):java.lang.Object");
}
/* JADX INFO: Access modifiers changed from: private */
public final Object fadeIn(Continuation<? super Unit> continuation) {
Object coroutineScope = CoroutineScopeKt.coroutineScope(new RippleAnimation$fadeIn$2(this, null), continuation);
return coroutineScope == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? coroutineScope : Unit.INSTANCE;
}
/* JADX INFO: Access modifiers changed from: private */
public final Object fadeOut(Continuation<? super Unit> continuation) {
Object coroutineScope = CoroutineScopeKt.coroutineScope(new RippleAnimation$fadeOut$2(this, null), continuation);
return coroutineScope == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? coroutineScope : Unit.INSTANCE;
}
public final void finish() {
setFinishRequested(true);
this.finishSignalDeferred.complete(Unit.INSTANCE);
}
/* renamed from: draw-4WTKRHQ, reason: not valid java name */
public final void m969draw4WTKRHQ(DrawScope draw, long j) {
Float valueOf;
Intrinsics.checkNotNullParameter(draw, "$this$draw");
if (this.startRadius == null) {
this.startRadius = Float.valueOf(RippleAnimationKt.m971getRippleStartRadiusuvyYCjk(draw.mo3182getSizeNHjbRc()));
}
if (this.targetRadius == null) {
if (Float.isNaN(this.radius)) {
valueOf = Float.valueOf(RippleAnimationKt.m970getRippleEndRadiuscSwnlzA(draw, this.bounded, draw.mo3182getSizeNHjbRc()));
} else {
valueOf = Float.valueOf(draw.mo335toPx0680j_4(this.radius));
}
this.targetRadius = valueOf;
}
if (this.origin == null) {
this.origin = Offset.m2389boximpl(draw.mo3181getCenterF1C5BW0());
}
if (this.targetCenter == null) {
this.targetCenter = Offset.m2389boximpl(OffsetKt.Offset(Size.m2469getWidthimpl(draw.mo3182getSizeNHjbRc()) / 2.0f, Size.m2466getHeightimpl(draw.mo3182getSizeNHjbRc()) / 2.0f));
}
float floatValue = (!getFinishRequested() || getFinishedFadingIn()) ? this.animatedAlpha.getValue().floatValue() : 1.0f;
Float f = this.startRadius;
Intrinsics.checkNotNull(f);
float floatValue2 = f.floatValue();
Float f2 = this.targetRadius;
Intrinsics.checkNotNull(f2);
float lerp = MathHelpersKt.lerp(floatValue2, f2.floatValue(), this.animatedRadiusPercent.getValue().floatValue());
Offset offset = this.origin;
Intrinsics.checkNotNull(offset);
float m2400getXimpl = Offset.m2400getXimpl(offset.getPackedValue());
Offset offset2 = this.targetCenter;
Intrinsics.checkNotNull(offset2);
float lerp2 = MathHelpersKt.lerp(m2400getXimpl, Offset.m2400getXimpl(offset2.getPackedValue()), this.animatedCenterPercent.getValue().floatValue());
Offset offset3 = this.origin;
Intrinsics.checkNotNull(offset3);
float m2401getYimpl = Offset.m2401getYimpl(offset3.getPackedValue());
Offset offset4 = this.targetCenter;
Intrinsics.checkNotNull(offset4);
long Offset = OffsetKt.Offset(lerp2, MathHelpersKt.lerp(m2401getYimpl, Offset.m2401getYimpl(offset4.getPackedValue()), this.animatedCenterPercent.getValue().floatValue()));
long m2638copywmQWz5c$default = Color.m2638copywmQWz5c$default(j, Color.m2641getAlphaimpl(j) * floatValue, 0.0f, 0.0f, 0.0f, 14, null);
if (!this.bounded) {
DrawScope.m3164drawCircleVaOC9Bg$default(draw, m2638copywmQWz5c$default, lerp, Offset, 0.0f, null, null, 0, MenuKt.InTransitionDuration, null);
return;
}
float m2469getWidthimpl = Size.m2469getWidthimpl(draw.mo3182getSizeNHjbRc());
float m2466getHeightimpl = Size.m2466getHeightimpl(draw.mo3182getSizeNHjbRc());
int m2628getIntersectrtfAjoo = ClipOp.INSTANCE.m2628getIntersectrtfAjoo();
DrawContext drawContext = draw.getDrawContext();
long mo3107getSizeNHjbRc = drawContext.mo3107getSizeNHjbRc();
drawContext.getCanvas().save();
drawContext.getTransform().mo3110clipRectN_I0leg(0.0f, 0.0f, m2469getWidthimpl, m2466getHeightimpl, m2628getIntersectrtfAjoo);
DrawScope.m3164drawCircleVaOC9Bg$default(draw, m2638copywmQWz5c$default, lerp, Offset, 0.0f, null, null, 0, MenuKt.InTransitionDuration, null);
drawContext.getCanvas().restore();
drawContext.mo3108setSizeuvyYCjk(mo3107getSizeNHjbRc);
}
}