mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-28 18:12:31 -06:00
286 lines
20 KiB
Java
286 lines
20 KiB
Java
package androidx.compose.foundation.layout;
|
|
|
|
import android.graphics.Insets;
|
|
import android.os.CancellationSignal;
|
|
import android.view.View;
|
|
import android.view.WindowInsetsAnimationControlListener;
|
|
import android.view.WindowInsetsAnimationController;
|
|
import android.view.WindowInsetsController;
|
|
import androidx.compose.ui.geometry.Offset;
|
|
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection;
|
|
import androidx.compose.ui.unit.Density;
|
|
import androidx.compose.ui.unit.Velocity;
|
|
import io.sentry.protocol.TransactionInfo;
|
|
import java.util.concurrent.CancellationException;
|
|
import kotlin.Metadata;
|
|
import kotlin.Unit;
|
|
import kotlin.coroutines.Continuation;
|
|
import kotlin.coroutines.intrinsics.IntrinsicsKt;
|
|
import kotlin.coroutines.jvm.internal.DebugProbesKt;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.math.MathKt;
|
|
import kotlin.ranges.RangesKt;
|
|
import kotlinx.coroutines.CancellableContinuation;
|
|
import kotlinx.coroutines.CancellableContinuationImpl;
|
|
import kotlinx.coroutines.Job;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* compiled from: WindowInsetsConnection.android.kt */
|
|
@Metadata(d1 = {"\u0000v\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u0007\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u000f\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0010\b\n\u0002\b\u0006\b\u0003\u0018\u00002\u00020\u00012\u00020\u0002B%\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\u0006\u0010\u0005\u001a\u00020\u0006\u0012\u0006\u0010\u0007\u001a\u00020\b\u0012\u0006\u0010\t\u001a\u00020\n¢\u0006\u0002\u0010\u000bJ\u0010\u0010 \u001a\u00020!2\u0006\u0010\"\u001a\u00020\u0019H\u0002J\b\u0010#\u001a\u00020!H\u0002J\u0006\u0010$\u001a\u00020!J1\u0010%\u001a\u00020&2\u0006\u0010'\u001a\u00020&2\u0006\u0010(\u001a\u00020\u00192\u0006\u0010)\u001a\u00020\u0017H\u0082@ø\u0001\u0000ø\u0001\u0001ø\u0001\u0001¢\u0006\u0004\b*\u0010+J\u0013\u0010,\u001a\u0004\u0018\u00010\rH\u0082@ø\u0001\u0001¢\u0006\u0002\u0010-J\u0012\u0010.\u001a\u00020!2\b\u0010/\u001a\u0004\u0018\u00010\rH\u0016J\u0010\u00100\u001a\u00020!2\u0006\u0010/\u001a\u00020\rH\u0016J)\u00101\u001a\u00020&2\u0006\u00102\u001a\u00020&2\u0006\u0010'\u001a\u00020&H\u0096@ø\u0001\u0000ø\u0001\u0001ø\u0001\u0001¢\u0006\u0004\b3\u00104J-\u00105\u001a\u0002062\u0006\u00102\u001a\u0002062\u0006\u0010'\u001a\u0002062\u0006\u00107\u001a\u000208H\u0016ø\u0001\u0000ø\u0001\u0001¢\u0006\u0004\b9\u0010:J!\u0010;\u001a\u00020&2\u0006\u0010'\u001a\u00020&H\u0096@ø\u0001\u0000ø\u0001\u0001ø\u0001\u0001¢\u0006\u0004\b<\u0010=J%\u0010>\u001a\u0002062\u0006\u0010'\u001a\u0002062\u0006\u00107\u001a\u000208H\u0016ø\u0001\u0000ø\u0001\u0001¢\u0006\u0004\b?\u0010@J\u0018\u0010A\u001a\u00020!2\u0006\u0010/\u001a\u00020\r2\u0006\u0010B\u001a\u00020CH\u0016J\b\u0010D\u001a\u00020!H\u0002J%\u0010E\u001a\u0002062\u0006\u0010'\u001a\u0002062\u0006\u0010F\u001a\u00020\u0019H\u0002ø\u0001\u0000ø\u0001\u0001¢\u0006\u0004\bG\u0010HR\u0010\u0010\f\u001a\u0004\u0018\u00010\rX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u000e\u001a\u0004\u0018\u00010\u000fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u0011X\u0082\u0004¢\u0006\u0002\n\u0000R\u0018\u0010\u0012\u001a\f\u0012\u0006\u0012\u0004\u0018\u00010\r\u0018\u00010\u0013X\u0082\u000e¢\u0006\u0002\n\u0000R\u0011\u0010\t\u001a\u00020\n¢\u0006\b\n\u0000\u001a\u0004\b\u0014\u0010\u0015R\u000e\u0010\u0016\u001a\u00020\u0017X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0018\u001a\u00020\u0019X\u0082\u000e¢\u0006\u0002\n\u0000R\u0011\u0010\u0007\u001a\u00020\b¢\u0006\b\n\u0000\u001a\u0004\b\u001a\u0010\u001bR\u0011\u0010\u0005\u001a\u00020\u0006¢\u0006\b\n\u0000\u001a\u0004\b\u001c\u0010\u001dR\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u001e\u0010\u001f\u0082\u0002\u000b\n\u0005\b¡\u001e0\u0001\n\u0002\b\u0019¨\u0006I"}, d2 = {"Landroidx/compose/foundation/layout/WindowInsetsNestedScrollConnection;", "Landroidx/compose/ui/input/nestedscroll/NestedScrollConnection;", "Landroid/view/WindowInsetsAnimationControlListener;", "windowInsets", "Landroidx/compose/foundation/layout/AndroidWindowInsets;", "view", "Landroid/view/View;", "sideCalculator", "Landroidx/compose/foundation/layout/SideCalculator;", "density", "Landroidx/compose/ui/unit/Density;", "(Landroidx/compose/foundation/layout/AndroidWindowInsets;Landroid/view/View;Landroidx/compose/foundation/layout/SideCalculator;Landroidx/compose/ui/unit/Density;)V", "animationController", "Landroid/view/WindowInsetsAnimationController;", "animationJob", "Lkotlinx/coroutines/Job;", "cancellationSignal", "Landroid/os/CancellationSignal;", "continuation", "Lkotlinx/coroutines/CancellableContinuation;", "getDensity", "()Landroidx/compose/ui/unit/Density;", "isControllerRequested", "", "partialConsumption", "", "getSideCalculator", "()Landroidx/compose/foundation/layout/SideCalculator;", "getView", "()Landroid/view/View;", "getWindowInsets", "()Landroidx/compose/foundation/layout/AndroidWindowInsets;", "adjustInsets", "", "inset", "animationEnded", "dispose", "fling", "Landroidx/compose/ui/unit/Velocity;", "available", "flingAmount", "towardShown", "fling-huYlsQE", "(JFZLkotlin/coroutines/Continuation;)Ljava/lang/Object;", "getAnimationController", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "onCancelled", "controller", "onFinished", "onPostFling", "consumed", "onPostFling-RZ2iAVY", "(JJLkotlin/coroutines/Continuation;)Ljava/lang/Object;", "onPostScroll", "Landroidx/compose/ui/geometry/Offset;", TransactionInfo.JsonKeys.SOURCE, "Landroidx/compose/ui/input/nestedscroll/NestedScrollSource;", "onPostScroll-DzOQY0M", "(JJI)J", "onPreFling", "onPreFling-QWom1Mo", "(JLkotlin/coroutines/Continuation;)Ljava/lang/Object;", "onPreScroll", "onPreScroll-OzD1aCk", "(JI)J", "onReady", "types", "", "requestAnimationController", "scroll", "scrollAmount", "scroll-8S9VItk", "(JF)J", "foundation-layout_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes.dex */
|
|
public final class WindowInsetsNestedScrollConnection implements NestedScrollConnection, WindowInsetsAnimationControlListener {
|
|
private WindowInsetsAnimationController animationController;
|
|
private Job animationJob;
|
|
private final CancellationSignal cancellationSignal;
|
|
private CancellableContinuation<? super WindowInsetsAnimationController> continuation;
|
|
private final Density density;
|
|
private boolean isControllerRequested;
|
|
private float partialConsumption;
|
|
private final SideCalculator sideCalculator;
|
|
private final View view;
|
|
private final AndroidWindowInsets windowInsets;
|
|
|
|
public final Density getDensity() {
|
|
return this.density;
|
|
}
|
|
|
|
public final SideCalculator getSideCalculator() {
|
|
return this.sideCalculator;
|
|
}
|
|
|
|
public final View getView() {
|
|
return this.view;
|
|
}
|
|
|
|
public final AndroidWindowInsets getWindowInsets() {
|
|
return this.windowInsets;
|
|
}
|
|
|
|
public WindowInsetsNestedScrollConnection(AndroidWindowInsets windowInsets, View view, SideCalculator sideCalculator, Density density) {
|
|
Intrinsics.checkNotNullParameter(windowInsets, "windowInsets");
|
|
Intrinsics.checkNotNullParameter(view, "view");
|
|
Intrinsics.checkNotNullParameter(sideCalculator, "sideCalculator");
|
|
Intrinsics.checkNotNullParameter(density, "density");
|
|
this.windowInsets = windowInsets;
|
|
this.view = view;
|
|
this.sideCalculator = sideCalculator;
|
|
this.density = density;
|
|
this.cancellationSignal = new CancellationSignal();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final void requestAnimationController() {
|
|
if (this.isControllerRequested) {
|
|
return;
|
|
}
|
|
this.isControllerRequested = true;
|
|
WindowInsetsController windowInsetsController = this.view.getWindowInsetsController();
|
|
if (windowInsetsController != null) {
|
|
windowInsetsController.controlWindowInsetsAnimation(this.windowInsets.getType(), -1L, null, this.cancellationSignal, this);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.compose.ui.input.nestedscroll.NestedScrollConnection
|
|
/* renamed from: onPreScroll-OzD1aCk */
|
|
public long mo344onPreScrollOzD1aCk(long available, int source) {
|
|
return m566scroll8S9VItk(available, this.sideCalculator.hideMotion(Offset.m2400getXimpl(available), Offset.m2401getYimpl(available)));
|
|
}
|
|
|
|
@Override // androidx.compose.ui.input.nestedscroll.NestedScrollConnection
|
|
/* renamed from: onPostScroll-DzOQY0M */
|
|
public long mo343onPostScrollDzOQY0M(long consumed, long available, int source) {
|
|
return m566scroll8S9VItk(available, this.sideCalculator.showMotion(Offset.m2400getXimpl(available), Offset.m2401getYimpl(available)));
|
|
}
|
|
|
|
/* renamed from: scroll-8S9VItk, reason: not valid java name */
|
|
private final long m566scroll8S9VItk(long available, float scrollAmount) {
|
|
Job job = this.animationJob;
|
|
if (job != null) {
|
|
job.cancel((CancellationException) new WindowInsetsAnimationCancelledException());
|
|
this.animationJob = null;
|
|
}
|
|
WindowInsetsAnimationController windowInsetsAnimationController = this.animationController;
|
|
if (scrollAmount != 0.0f) {
|
|
if (this.windowInsets.isVisible() != (scrollAmount > 0.0f) || windowInsetsAnimationController != null) {
|
|
if (windowInsetsAnimationController == null) {
|
|
this.partialConsumption = 0.0f;
|
|
requestAnimationController();
|
|
return this.sideCalculator.mo518consumedOffsetsMKHz9U(available);
|
|
}
|
|
SideCalculator sideCalculator = this.sideCalculator;
|
|
Insets hiddenStateInsets = windowInsetsAnimationController.getHiddenStateInsets();
|
|
Intrinsics.checkNotNullExpressionValue(hiddenStateInsets, "animationController.hiddenStateInsets");
|
|
int valueOf = sideCalculator.valueOf(hiddenStateInsets);
|
|
SideCalculator sideCalculator2 = this.sideCalculator;
|
|
Insets shownStateInsets = windowInsetsAnimationController.getShownStateInsets();
|
|
Intrinsics.checkNotNullExpressionValue(shownStateInsets, "animationController.shownStateInsets");
|
|
int valueOf2 = sideCalculator2.valueOf(shownStateInsets);
|
|
Insets currentInsets = windowInsetsAnimationController.getCurrentInsets();
|
|
Intrinsics.checkNotNullExpressionValue(currentInsets, "animationController.currentInsets");
|
|
int valueOf3 = this.sideCalculator.valueOf(currentInsets);
|
|
if (valueOf3 == (scrollAmount > 0.0f ? valueOf2 : valueOf)) {
|
|
this.partialConsumption = 0.0f;
|
|
return Offset.INSTANCE.m2416getZeroF1C5BW0();
|
|
}
|
|
float f = valueOf3 + scrollAmount + this.partialConsumption;
|
|
int coerceIn = RangesKt.coerceIn(MathKt.roundToInt(f), valueOf, valueOf2);
|
|
this.partialConsumption = f - MathKt.roundToInt(f);
|
|
if (coerceIn != valueOf3) {
|
|
windowInsetsAnimationController.setInsetsAndAlpha(this.sideCalculator.adjustInsets(currentInsets, coerceIn), 1.0f, 0.0f);
|
|
}
|
|
return this.sideCalculator.mo518consumedOffsetsMKHz9U(available);
|
|
}
|
|
}
|
|
return Offset.INSTANCE.m2416getZeroF1C5BW0();
|
|
}
|
|
|
|
@Override // androidx.compose.ui.input.nestedscroll.NestedScrollConnection
|
|
/* renamed from: onPreFling-QWom1Mo, reason: not valid java name */
|
|
public Object mo567onPreFlingQWom1Mo(long j, Continuation<? super Velocity> continuation) {
|
|
return m565flinghuYlsQE(j, this.sideCalculator.hideMotion(Velocity.m5108getXimpl(j), Velocity.m5109getYimpl(j)), false, continuation);
|
|
}
|
|
|
|
@Override // androidx.compose.ui.input.nestedscroll.NestedScrollConnection
|
|
/* renamed from: onPostFling-RZ2iAVY */
|
|
public Object mo342onPostFlingRZ2iAVY(long j, long j2, Continuation<? super Velocity> continuation) {
|
|
return m565flinghuYlsQE(j2, this.sideCalculator.showMotion(Velocity.m5108getXimpl(j2), Velocity.m5109getYimpl(j2)), true, continuation);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* JADX WARN: Removed duplicated region for block: B:23:0x00b6 */
|
|
/* JADX WARN: Removed duplicated region for block: B:25:0x00c1 */
|
|
/* JADX WARN: Removed duplicated region for block: B:54:0x0069 */
|
|
/* JADX WARN: Removed duplicated region for block: B:8:0x0030 */
|
|
/* renamed from: fling-huYlsQE, reason: not valid java name */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public final java.lang.Object m565flinghuYlsQE(long r26, float r28, boolean r29, kotlin.coroutines.Continuation<? super androidx.compose.ui.unit.Velocity> r30) {
|
|
/*
|
|
Method dump skipped, instructions count: 434
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.compose.foundation.layout.WindowInsetsNestedScrollConnection.m565flinghuYlsQE(long, float, boolean, kotlin.coroutines.Continuation):java.lang.Object");
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final void adjustInsets(float inset) {
|
|
WindowInsetsAnimationController windowInsetsAnimationController = this.animationController;
|
|
if (windowInsetsAnimationController != null) {
|
|
Insets currentInsets = windowInsetsAnimationController.getCurrentInsets();
|
|
Intrinsics.checkNotNullExpressionValue(currentInsets, "it.currentInsets");
|
|
windowInsetsAnimationController.setInsetsAndAlpha(this.sideCalculator.adjustInsets(currentInsets, MathKt.roundToInt(inset)), 1.0f, 0.0f);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.WindowInsetsAnimationControlListener
|
|
public void onReady(WindowInsetsAnimationController controller, int types) {
|
|
Intrinsics.checkNotNullParameter(controller, "controller");
|
|
this.animationController = controller;
|
|
this.isControllerRequested = false;
|
|
CancellableContinuation<? super WindowInsetsAnimationController> cancellableContinuation = this.continuation;
|
|
if (cancellableContinuation != null) {
|
|
cancellableContinuation.resume(controller, new Function1<Throwable, Unit>() { // from class: androidx.compose.foundation.layout.WindowInsetsNestedScrollConnection$onReady$1
|
|
/* renamed from: invoke, reason: avoid collision after fix types in other method */
|
|
public final void invoke2(Throwable it) {
|
|
Intrinsics.checkNotNullParameter(it, "it");
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public /* bridge */ /* synthetic */ Unit invoke(Throwable th) {
|
|
invoke2(th);
|
|
return Unit.INSTANCE;
|
|
}
|
|
});
|
|
}
|
|
this.continuation = null;
|
|
}
|
|
|
|
public final void dispose() {
|
|
CancellableContinuation<? super WindowInsetsAnimationController> cancellableContinuation = this.continuation;
|
|
if (cancellableContinuation != null) {
|
|
cancellableContinuation.resume(null, new Function1<Throwable, Unit>() { // from class: androidx.compose.foundation.layout.WindowInsetsNestedScrollConnection$dispose$1
|
|
/* renamed from: invoke, reason: avoid collision after fix types in other method */
|
|
public final void invoke2(Throwable it) {
|
|
Intrinsics.checkNotNullParameter(it, "it");
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public /* bridge */ /* synthetic */ Unit invoke(Throwable th) {
|
|
invoke2(th);
|
|
return Unit.INSTANCE;
|
|
}
|
|
});
|
|
}
|
|
Job job = this.animationJob;
|
|
if (job != null) {
|
|
Job.DefaultImpls.cancel$default(job, (CancellationException) null, 1, (Object) null);
|
|
}
|
|
WindowInsetsAnimationController windowInsetsAnimationController = this.animationController;
|
|
if (windowInsetsAnimationController != null) {
|
|
windowInsetsAnimationController.finish(!Intrinsics.areEqual(windowInsetsAnimationController.getCurrentInsets(), windowInsetsAnimationController.getHiddenStateInsets()));
|
|
}
|
|
}
|
|
|
|
@Override // android.view.WindowInsetsAnimationControlListener
|
|
public void onFinished(WindowInsetsAnimationController controller) {
|
|
Intrinsics.checkNotNullParameter(controller, "controller");
|
|
animationEnded();
|
|
}
|
|
|
|
@Override // android.view.WindowInsetsAnimationControlListener
|
|
public void onCancelled(WindowInsetsAnimationController controller) {
|
|
animationEnded();
|
|
}
|
|
|
|
private final void animationEnded() {
|
|
WindowInsetsAnimationController windowInsetsAnimationController;
|
|
WindowInsetsAnimationController windowInsetsAnimationController2 = this.animationController;
|
|
if (windowInsetsAnimationController2 != null && windowInsetsAnimationController2.isReady() && (windowInsetsAnimationController = this.animationController) != null) {
|
|
windowInsetsAnimationController.finish(this.windowInsets.isVisible());
|
|
}
|
|
this.animationController = null;
|
|
CancellableContinuation<? super WindowInsetsAnimationController> cancellableContinuation = this.continuation;
|
|
if (cancellableContinuation != null) {
|
|
cancellableContinuation.resume(null, new Function1<Throwable, Unit>() { // from class: androidx.compose.foundation.layout.WindowInsetsNestedScrollConnection$animationEnded$1
|
|
/* renamed from: invoke, reason: avoid collision after fix types in other method */
|
|
public final void invoke2(Throwable it) {
|
|
Intrinsics.checkNotNullParameter(it, "it");
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public /* bridge */ /* synthetic */ Unit invoke(Throwable th) {
|
|
invoke2(th);
|
|
return Unit.INSTANCE;
|
|
}
|
|
});
|
|
}
|
|
this.continuation = null;
|
|
Job job = this.animationJob;
|
|
if (job != null) {
|
|
job.cancel((CancellationException) new WindowInsetsAnimationCancelledException());
|
|
}
|
|
this.animationJob = null;
|
|
this.partialConsumption = 0.0f;
|
|
this.isControllerRequested = false;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final Object getAnimationController(Continuation<? super WindowInsetsAnimationController> continuation) {
|
|
WindowInsetsAnimationController windowInsetsAnimationController = this.animationController;
|
|
if (windowInsetsAnimationController != null) {
|
|
return windowInsetsAnimationController;
|
|
}
|
|
CancellableContinuationImpl cancellableContinuationImpl = new CancellableContinuationImpl(IntrinsicsKt.intercepted(continuation), 1);
|
|
cancellableContinuationImpl.initCancellability();
|
|
this.continuation = cancellableContinuationImpl;
|
|
requestAnimationController();
|
|
Object result = cancellableContinuationImpl.getResult();
|
|
if (result == IntrinsicsKt.getCOROUTINE_SUSPENDED()) {
|
|
DebugProbesKt.probeCoroutineSuspended(continuation);
|
|
}
|
|
return result;
|
|
}
|
|
}
|