Rabbit-R1/switch port/java/sources/androidx/compose/foundation/ClickablePointerInputNode.java
2024-05-21 17:08:36 -04:00

66 lines
5 KiB
Java

package androidx.compose.foundation;
import androidx.compose.foundation.AbstractClickableNode;
import androidx.compose.foundation.gestures.TapGestureDetectorKt;
import androidx.compose.foundation.interaction.MutableInteractionSource;
import androidx.compose.ui.geometry.Offset;
import androidx.compose.ui.geometry.OffsetKt;
import androidx.compose.ui.input.pointer.PointerInputScope;
import androidx.compose.ui.unit.IntOffset;
import androidx.compose.ui.unit.IntSizeKt;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: Clickable.kt */
@Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0002\u0018\u00002\u00020\u0001B+\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\f\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u0007\u0012\u0006\u0010\t\u001a\u00020\\u0006\u0002\u0010\u000bJ$\u0010\f\u001a\u00020\b2\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\f\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u0007J\u0015\u0010\r\u001a\u00020\b*\u00020\u000eH\u0094@ø\u0001\u0000¢\u0006\u0002\u0010\u000f\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\u0010"}, d2 = {"Landroidx/compose/foundation/ClickablePointerInputNode;", "Landroidx/compose/foundation/AbstractClickablePointerInputNode;", "enabled", "", "interactionSource", "Landroidx/compose/foundation/interaction/MutableInteractionSource;", "onClick", "Lkotlin/Function0;", "", "interactionData", "Landroidx/compose/foundation/AbstractClickableNode$InteractionData;", "(ZLandroidx/compose/foundation/interaction/MutableInteractionSource;Lkotlin/jvm/functions/Function0;Landroidx/compose/foundation/AbstractClickableNode$InteractionData;)V", "update", "pointerInput", "Landroidx/compose/ui/input/pointer/PointerInputScope;", "(Landroidx/compose/ui/input/pointer/PointerInputScope;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "foundation_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
final class ClickablePointerInputNode extends AbstractClickablePointerInputNode {
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public ClickablePointerInputNode(boolean z, MutableInteractionSource interactionSource, Function0<Unit> onClick, AbstractClickableNode.InteractionData interactionData) {
super(z, interactionSource, onClick, interactionData, null);
Intrinsics.checkNotNullParameter(interactionSource, "interactionSource");
Intrinsics.checkNotNullParameter(onClick, "onClick");
Intrinsics.checkNotNullParameter(interactionData, "interactionData");
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // androidx.compose.foundation.AbstractClickablePointerInputNode
public Object pointerInput(PointerInputScope pointerInputScope, Continuation<? super Unit> continuation) {
AbstractClickableNode.InteractionData interactionData = getInteractionData();
long m5049getCenterozmzZPI = IntSizeKt.m5049getCenterozmzZPI(pointerInputScope.getBoundsSize());
interactionData.m156setCentreOffsetk4lQ0M(OffsetKt.Offset(IntOffset.m5001getXimpl(m5049getCenterozmzZPI), IntOffset.m5002getYimpl(m5049getCenterozmzZPI)));
Object detectTapAndPress = TapGestureDetectorKt.detectTapAndPress(pointerInputScope, new ClickablePointerInputNode$pointerInput$2(this, null), new Function1<Offset, Unit>() { // from class: androidx.compose.foundation.ClickablePointerInputNode$pointerInput$3
/* JADX INFO: Access modifiers changed from: package-private */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(Offset offset) {
m213invokek4lQ0M(offset.getPackedValue());
return Unit.INSTANCE;
}
/* renamed from: invoke-k-4lQ0M, reason: not valid java name */
public final void m213invokek4lQ0M(long j) {
if (ClickablePointerInputNode.this.getEnabled()) {
ClickablePointerInputNode.this.getOnClick().invoke();
}
}
}, continuation);
return detectTapAndPress == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? detectTapAndPress : Unit.INSTANCE;
}
public final void update(boolean enabled, MutableInteractionSource interactionSource, Function0<Unit> onClick) {
Intrinsics.checkNotNullParameter(interactionSource, "interactionSource");
Intrinsics.checkNotNullParameter(onClick, "onClick");
setEnabled(enabled);
setOnClick(onClick);
setInteractionSource(interactionSource);
}
}