mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-30 11:02:31 -06:00
71 lines
4.3 KiB
Java
71 lines
4.3 KiB
Java
|
package androidx.compose.foundation;
|
||
|
|
||
|
import androidx.compose.foundation.interaction.FocusInteraction;
|
||
|
import androidx.compose.foundation.interaction.Interaction;
|
||
|
import androidx.compose.foundation.interaction.MutableInteractionSource;
|
||
|
import androidx.compose.ui.Modifier;
|
||
|
import kotlin.Metadata;
|
||
|
import kotlin.jvm.internal.Intrinsics;
|
||
|
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* compiled from: Focusable.kt */
|
||
|
@Metadata(d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\b\u0002\u0018\u00002\u00020\u0001B\u000f\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003¢\u0006\u0002\u0010\u0004J\b\u0010\u0007\u001a\u00020\bH\u0002J\u000e\u0010\t\u001a\u00020\b2\u0006\u0010\n\u001a\u00020\u000bJ\u0010\u0010\f\u001a\u00020\b2\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003J\u0014\u0010\r\u001a\u00020\b*\u00020\u00032\u0006\u0010\u000e\u001a\u00020\u000fH\u0002R\u0010\u0010\u0005\u001a\u0004\u0018\u00010\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0002\u001a\u0004\u0018\u00010\u0003X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0010"}, d2 = {"Landroidx/compose/foundation/FocusableInteractionNode;", "Landroidx/compose/ui/Modifier$Node;", "interactionSource", "Landroidx/compose/foundation/interaction/MutableInteractionSource;", "(Landroidx/compose/foundation/interaction/MutableInteractionSource;)V", "focusedInteraction", "Landroidx/compose/foundation/interaction/FocusInteraction$Focus;", "disposeInteractionSource", "", "setFocus", "isFocused", "", "update", "emitWithFallback", "interaction", "Landroidx/compose/foundation/interaction/Interaction;", "foundation_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class FocusableInteractionNode extends Modifier.Node {
|
||
|
private FocusInteraction.Focus focusedInteraction;
|
||
|
private MutableInteractionSource interactionSource;
|
||
|
|
||
|
public FocusableInteractionNode(MutableInteractionSource mutableInteractionSource) {
|
||
|
this.interactionSource = mutableInteractionSource;
|
||
|
}
|
||
|
|
||
|
public final void setFocus(boolean isFocused) {
|
||
|
MutableInteractionSource mutableInteractionSource = this.interactionSource;
|
||
|
if (mutableInteractionSource != null) {
|
||
|
if (!isFocused) {
|
||
|
FocusInteraction.Focus focus = this.focusedInteraction;
|
||
|
if (focus != null) {
|
||
|
emitWithFallback(mutableInteractionSource, new FocusInteraction.Unfocus(focus));
|
||
|
this.focusedInteraction = null;
|
||
|
return;
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
FocusInteraction.Focus focus2 = this.focusedInteraction;
|
||
|
if (focus2 != null) {
|
||
|
emitWithFallback(mutableInteractionSource, new FocusInteraction.Unfocus(focus2));
|
||
|
this.focusedInteraction = null;
|
||
|
}
|
||
|
FocusInteraction.Focus focus3 = new FocusInteraction.Focus();
|
||
|
emitWithFallback(mutableInteractionSource, focus3);
|
||
|
this.focusedInteraction = focus3;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final void update(MutableInteractionSource interactionSource) {
|
||
|
if (Intrinsics.areEqual(this.interactionSource, interactionSource)) {
|
||
|
return;
|
||
|
}
|
||
|
disposeInteractionSource();
|
||
|
this.interactionSource = interactionSource;
|
||
|
}
|
||
|
|
||
|
private final void disposeInteractionSource() {
|
||
|
FocusInteraction.Focus focus;
|
||
|
MutableInteractionSource mutableInteractionSource = this.interactionSource;
|
||
|
if (mutableInteractionSource != null && (focus = this.focusedInteraction) != null) {
|
||
|
mutableInteractionSource.tryEmit(new FocusInteraction.Unfocus(focus));
|
||
|
}
|
||
|
this.focusedInteraction = null;
|
||
|
}
|
||
|
|
||
|
private final void emitWithFallback(MutableInteractionSource mutableInteractionSource, Interaction interaction) {
|
||
|
if (getIsAttached()) {
|
||
|
BuildersKt__Builders_commonKt.launch$default(getCoroutineScope(), null, null, new FocusableInteractionNode$emitWithFallback$1(mutableInteractionSource, interaction, null), 3, null);
|
||
|
} else {
|
||
|
mutableInteractionSource.tryEmit(interaction);
|
||
|
}
|
||
|
}
|
||
|
}
|