mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
583 lines
39 KiB
Java
583 lines
39 KiB
Java
|
package androidx.compose.foundation.lazy.grid;
|
||
|
|
||
|
import androidx.compose.foundation.gestures.ScrollableState;
|
||
|
import androidx.compose.foundation.gestures.ScrollableStateKt;
|
||
|
import androidx.compose.foundation.interaction.InteractionSource;
|
||
|
import androidx.compose.foundation.interaction.InteractionSourceKt;
|
||
|
import androidx.compose.foundation.interaction.MutableInteractionSource;
|
||
|
import androidx.compose.foundation.lazy.layout.AwaitFirstLayoutModifier;
|
||
|
import androidx.compose.foundation.lazy.layout.LazyAnimateScrollKt;
|
||
|
import androidx.compose.foundation.lazy.layout.LazyLayoutBeyondBoundsInfo;
|
||
|
import androidx.compose.foundation.lazy.layout.LazyLayoutPinnedItemList;
|
||
|
import androidx.compose.foundation.lazy.layout.LazyLayoutPrefetchState;
|
||
|
import androidx.compose.runtime.MutableIntState;
|
||
|
import androidx.compose.runtime.MutableState;
|
||
|
import androidx.compose.runtime.SnapshotIntStateKt;
|
||
|
import androidx.compose.runtime.SnapshotStateKt__SnapshotStateKt;
|
||
|
import androidx.compose.runtime.collection.MutableVector;
|
||
|
import androidx.compose.runtime.saveable.ListSaverKt;
|
||
|
import androidx.compose.runtime.saveable.Saver;
|
||
|
import androidx.compose.runtime.saveable.SaverScope;
|
||
|
import androidx.compose.runtime.snapshots.Snapshot;
|
||
|
import androidx.compose.ui.layout.Remeasurement;
|
||
|
import androidx.compose.ui.layout.RemeasurementModifier;
|
||
|
import androidx.compose.ui.unit.Constraints;
|
||
|
import androidx.compose.ui.unit.Density;
|
||
|
import androidx.compose.ui.unit.DensityKt;
|
||
|
import java.util.List;
|
||
|
import kotlin.Metadata;
|
||
|
import kotlin.Pair;
|
||
|
import kotlin.Unit;
|
||
|
import kotlin.collections.CollectionsKt;
|
||
|
import kotlin.coroutines.Continuation;
|
||
|
import kotlin.coroutines.intrinsics.IntrinsicsKt;
|
||
|
import kotlin.jvm.functions.Function1;
|
||
|
import kotlin.jvm.functions.Function2;
|
||
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
||
|
import kotlin.jvm.internal.Intrinsics;
|
||
|
import kotlin.ranges.IntRange;
|
||
|
|
||
|
/* compiled from: LazyGridState.kt */
|
||
|
@Metadata(d1 = {"\u0000ð\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0010\u0007\n\u0002\b\f\n\u0002\u0010\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u000b\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0007\u0018\u0000 \u009b\u00012\u00020\u0001:\u0002\u009b\u0001B\u0019\u0012\b\b\u0002\u0010\u0002\u001a\u00020\u0003\u0012\b\b\u0002\u0010\u0004\u001a\u00020\u0003¢\u0006\u0002\u0010\u0005J#\u0010x\u001a\u00020y2\u0006\u0010z\u001a\u00020\u00032\b\b\u0002\u0010{\u001a\u00020\u0003H\u0086@ø\u0001\u0000¢\u0006\u0002\u0010|J\u0016\u0010}\u001a\u00020y2\u0006\u0010~\u001a\u00020\u007fH\u0000¢\u0006\u0003\b\u0080\u0001J\u0012\u0010\u0081\u0001\u001a\u00020y2\u0007\u0010\u0082\u0001\u001a\u000206H\u0002J\u0012\u0010\u0083\u0001\u001a\u00020l2\u0007\u0010\u0084\u0001\u001a\u00020lH\u0016J\u0012\u0010\u0085\u0001\u001a\u00020y2\u0007\u0010\u0084\u0001\u001a\u00020lH\u0002J\u0018\u0010\u0086\u0001\u001a\u00020l2\u0007\u0010\u0087\u0001\u001a\u00020lH\u0000¢\u0006\u0003\b\u0088\u0001JL\u0010\u0089\u0001\u001a\u00020y2\b\u0010\u008a\u0001\u001a\u00030\u008b\u00012-\u0010\u008c\u0001\u001a(\b\u0001\u0012\u0005\u0012\u00030\u008e\u0001\u0012\u000b\u0012\t\u0012\u0004\u0012\u00020y0\u008f\u0001\u0012\u0007\u0012\u0005\u0018\u00010\u0090\u00010\u008d\u0001¢\u0006\u0003\b\u0091\u0001H\u0096@ø\u0001\u0000¢\u0006\u0003\u0010\u0092\u0001J$\u0010\u0093\u0001\u001a\u00020y2\u0006\u0010z\u001a\u00020\u00032\b\b\u0002\u0010{\u001a\u00020\u0003H\u0086@ø\u0001\u0000¢\u0006\u0002\u0010|J\u001f\u0010\u0094\u0001\u001a\u00020y2\u0006\u0010z\u001a\u00020\u00032\u0006\u0010{\u001a\u00020\u0003H\u0000¢\u0006\u0003\b\u0095\u0001J$\u0010\u0096\u0001\u001a\u00020\u00032\b\u0010\u0097\u0001\u001a\u00030\u0098\u00012\t\b\u0002\u0010\u0099\u0001\u001a\u00020\u0003H\u0000¢\u0006\u0003\b\u009a\u0001R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\b\u001a\u00020\tX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000bR\u0014\u0010\f\u001a\u00020\rX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u000e\u0010\u000fR+\u0010\u0012\u001a\u00020\u00112\u0006\u0010\u0010\u001a\u00020\u00118V@RX\u0096\u008e\u0002¢\u0006\u0012\n\u0004\b\u0017\u0010\u0018\u001a\u0004\b\u0013\u0010\u0014\"\u0004\b\u0015\u0010\u0016R+\u0010\u0019\u001a\u00020\u00112\u0006\u0010\u0010\u001a\u00020\u00118V@RX\u0096\u008e\u0002¢\u0006\u0012\n\u0004\b\u001c\u0010\u0018\u001a\u0004\b\u001a\u0010\u0014\"\u0004\b\u001b\u0010\u0016R\u0014\u0010\u001d\u001a\b\u0012\u0004\u0012\u00020\u001f0\u001eX\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010 \u001a\u00020!X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\"\u0010#\"\u0004\b$\u0010%R\u0011\u0010\u0002\u001a\u00020\u00038F¢\u0006\u0006\u001a\u0004\b&\u0010'R\u0011\u0010\u0004\u001a\u00020\u00038F¢\u0006\u0006\u001a\u0004\b(\u0010'R\u0011\u0010)\u001a\u00020*8F¢\u0006\u0006\u001a\u0004\b+\u0010,R\u0014\u0010-\u001a\u00020.X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b/\u00100R\u0014\u00101\u001a\u00020\u00118VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b1\u0010\u0014R\u001a\u00102\u001a\u00020\u0011X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b3\u0010\u0014\"\u0004\b4\u0010\u0016R\u0011\u00105\u001a\
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class LazyGridState implements ScrollableState {
|
||
|
public static final int $stable = 0;
|
||
|
|
||
|
/* renamed from: Companion, reason: from kotlin metadata */
|
||
|
public static final Companion INSTANCE = new Companion(null);
|
||
|
private static final Saver<LazyGridState, ?> Saver = ListSaverKt.listSaver(new Function2<SaverScope, LazyGridState, List<? extends Integer>>() { // from class: androidx.compose.foundation.lazy.grid.LazyGridState$Companion$Saver$1
|
||
|
@Override // kotlin.jvm.functions.Function2
|
||
|
public final List<Integer> invoke(SaverScope listSaver, LazyGridState it) {
|
||
|
Intrinsics.checkNotNullParameter(listSaver, "$this$listSaver");
|
||
|
Intrinsics.checkNotNullParameter(it, "it");
|
||
|
return CollectionsKt.listOf((Object[]) new Integer[]{Integer.valueOf(it.getFirstVisibleItemIndex()), Integer.valueOf(it.getFirstVisibleItemScrollOffset())});
|
||
|
}
|
||
|
}, new Function1<List<? extends Integer>, LazyGridState>() { // from class: androidx.compose.foundation.lazy.grid.LazyGridState$Companion$Saver$2
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public /* bridge */ /* synthetic */ LazyGridState invoke(List<? extends Integer> list) {
|
||
|
return invoke2((List<Integer>) list);
|
||
|
}
|
||
|
|
||
|
/* renamed from: invoke, reason: avoid collision after fix types in other method */
|
||
|
public final LazyGridState invoke2(List<Integer> it) {
|
||
|
Intrinsics.checkNotNullParameter(it, "it");
|
||
|
return new LazyGridState(it.get(0).intValue(), it.get(1).intValue());
|
||
|
}
|
||
|
});
|
||
|
private final LazyGridAnimateScrollScope animateScrollScope;
|
||
|
private final AwaitFirstLayoutModifier awaitLayoutModifier;
|
||
|
private final LazyLayoutBeyondBoundsInfo beyondBoundsInfo;
|
||
|
|
||
|
/* renamed from: canScrollBackward$delegate, reason: from kotlin metadata */
|
||
|
private final MutableState canScrollBackward;
|
||
|
|
||
|
/* renamed from: canScrollForward$delegate, reason: from kotlin metadata */
|
||
|
private final MutableState canScrollForward;
|
||
|
private final MutableVector<LazyLayoutPrefetchState.PrefetchHandle> currentLinePrefetchHandles;
|
||
|
private Density density;
|
||
|
private final MutableInteractionSource internalInteractionSource;
|
||
|
private boolean isVertical;
|
||
|
private final MutableState<LazyGridLayoutInfo> layoutInfoState;
|
||
|
private int lineToPrefetch;
|
||
|
private int numMeasurePasses;
|
||
|
private final LazyLayoutPinnedItemList pinnedItems;
|
||
|
private final LazyGridItemPlacementAnimator placementAnimator;
|
||
|
|
||
|
/* renamed from: prefetchInfoRetriever$delegate, reason: from kotlin metadata */
|
||
|
private final MutableState prefetchInfoRetriever;
|
||
|
private final LazyLayoutPrefetchState prefetchState;
|
||
|
private boolean prefetchingEnabled;
|
||
|
private Remeasurement remeasurement;
|
||
|
private final RemeasurementModifier remeasurementModifier;
|
||
|
private final LazyGridScrollPosition scrollPosition;
|
||
|
private float scrollToBeConsumed;
|
||
|
private final ScrollableState scrollableState;
|
||
|
|
||
|
/* renamed from: slotsPerLine$delegate, reason: from kotlin metadata */
|
||
|
private final MutableIntState slotsPerLine;
|
||
|
private boolean wasScrollingForward;
|
||
|
|
||
|
public LazyGridState() {
|
||
|
this(0, 0, 3, null);
|
||
|
}
|
||
|
|
||
|
/* renamed from: getAwaitLayoutModifier$foundation_release, reason: from getter */
|
||
|
public final AwaitFirstLayoutModifier getAwaitLayoutModifier() {
|
||
|
return this.awaitLayoutModifier;
|
||
|
}
|
||
|
|
||
|
/* renamed from: getBeyondBoundsInfo$foundation_release, reason: from getter */
|
||
|
public final LazyLayoutBeyondBoundsInfo getBeyondBoundsInfo() {
|
||
|
return this.beyondBoundsInfo;
|
||
|
}
|
||
|
|
||
|
/* renamed from: getDensity$foundation_release, reason: from getter */
|
||
|
public final Density getDensity() {
|
||
|
return this.density;
|
||
|
}
|
||
|
|
||
|
/* renamed from: getInternalInteractionSource$foundation_release, reason: from getter */
|
||
|
public final MutableInteractionSource getInternalInteractionSource() {
|
||
|
return this.internalInteractionSource;
|
||
|
}
|
||
|
|
||
|
/* renamed from: getNumMeasurePasses$foundation_release, reason: from getter */
|
||
|
public final int getNumMeasurePasses() {
|
||
|
return this.numMeasurePasses;
|
||
|
}
|
||
|
|
||
|
/* renamed from: getPinnedItems$foundation_release, reason: from getter */
|
||
|
public final LazyLayoutPinnedItemList getPinnedItems() {
|
||
|
return this.pinnedItems;
|
||
|
}
|
||
|
|
||
|
/* renamed from: getPlacementAnimator$foundation_release, reason: from getter */
|
||
|
public final LazyGridItemPlacementAnimator getPlacementAnimator() {
|
||
|
return this.placementAnimator;
|
||
|
}
|
||
|
|
||
|
/* renamed from: getPrefetchState$foundation_release, reason: from getter */
|
||
|
public final LazyLayoutPrefetchState getPrefetchState() {
|
||
|
return this.prefetchState;
|
||
|
}
|
||
|
|
||
|
/* renamed from: getPrefetchingEnabled$foundation_release, reason: from getter */
|
||
|
public final boolean getPrefetchingEnabled() {
|
||
|
return this.prefetchingEnabled;
|
||
|
}
|
||
|
|
||
|
/* renamed from: getRemeasurement$foundation_release, reason: from getter */
|
||
|
public final Remeasurement getRemeasurement() {
|
||
|
return this.remeasurement;
|
||
|
}
|
||
|
|
||
|
/* renamed from: getRemeasurementModifier$foundation_release, reason: from getter */
|
||
|
public final RemeasurementModifier getRemeasurementModifier() {
|
||
|
return this.remeasurementModifier;
|
||
|
}
|
||
|
|
||
|
/* renamed from: getScrollToBeConsumed$foundation_release, reason: from getter */
|
||
|
public final float getScrollToBeConsumed() {
|
||
|
return this.scrollToBeConsumed;
|
||
|
}
|
||
|
|
||
|
/* renamed from: isVertical$foundation_release, reason: from getter */
|
||
|
public final boolean getIsVertical() {
|
||
|
return this.isVertical;
|
||
|
}
|
||
|
|
||
|
public final void setDensity$foundation_release(Density density) {
|
||
|
Intrinsics.checkNotNullParameter(density, "<set-?>");
|
||
|
this.density = density;
|
||
|
}
|
||
|
|
||
|
public final void setPrefetchingEnabled$foundation_release(boolean z) {
|
||
|
this.prefetchingEnabled = z;
|
||
|
}
|
||
|
|
||
|
public final void setRemeasurement$foundation_release(Remeasurement remeasurement) {
|
||
|
this.remeasurement = remeasurement;
|
||
|
}
|
||
|
|
||
|
public final void setVertical$foundation_release(boolean z) {
|
||
|
this.isVertical = z;
|
||
|
}
|
||
|
|
||
|
public LazyGridState(int i, int i2) {
|
||
|
MutableState<LazyGridLayoutInfo> mutableStateOf$default;
|
||
|
MutableState mutableStateOf$default2;
|
||
|
MutableState mutableStateOf$default3;
|
||
|
MutableState mutableStateOf$default4;
|
||
|
LazyGridScrollPosition lazyGridScrollPosition = new LazyGridScrollPosition(i, i2);
|
||
|
this.scrollPosition = lazyGridScrollPosition;
|
||
|
mutableStateOf$default = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(EmptyLazyGridLayoutInfo.INSTANCE, null, 2, null);
|
||
|
this.layoutInfoState = mutableStateOf$default;
|
||
|
this.internalInteractionSource = InteractionSourceKt.MutableInteractionSource();
|
||
|
this.slotsPerLine = SnapshotIntStateKt.mutableIntStateOf(0);
|
||
|
this.density = DensityKt.Density(1.0f, 1.0f);
|
||
|
this.isVertical = true;
|
||
|
this.scrollableState = ScrollableStateKt.ScrollableState(new Function1<Float, Float>() { // from class: androidx.compose.foundation.lazy.grid.LazyGridState$scrollableState$1
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
{
|
||
|
super(1);
|
||
|
}
|
||
|
|
||
|
public final Float invoke(float f) {
|
||
|
return Float.valueOf(-LazyGridState.this.onScroll$foundation_release(-f));
|
||
|
}
|
||
|
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public /* bridge */ /* synthetic */ Float invoke(Float f) {
|
||
|
return invoke(f.floatValue());
|
||
|
}
|
||
|
});
|
||
|
this.prefetchingEnabled = true;
|
||
|
this.lineToPrefetch = -1;
|
||
|
this.currentLinePrefetchHandles = new MutableVector<>(new LazyLayoutPrefetchState.PrefetchHandle[16], 0);
|
||
|
this.remeasurementModifier = new RemeasurementModifier() { // from class: androidx.compose.foundation.lazy.grid.LazyGridState$remeasurementModifier$1
|
||
|
@Override // androidx.compose.ui.layout.RemeasurementModifier
|
||
|
public void onRemeasurementAvailable(Remeasurement remeasurement) {
|
||
|
Intrinsics.checkNotNullParameter(remeasurement, "remeasurement");
|
||
|
LazyGridState.this.setRemeasurement$foundation_release(remeasurement);
|
||
|
}
|
||
|
};
|
||
|
this.awaitLayoutModifier = new AwaitFirstLayoutModifier();
|
||
|
mutableStateOf$default2 = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(new Function1<Integer, List<? extends Pair<? extends Integer, ? extends Constraints>>>() { // from class: androidx.compose.foundation.lazy.grid.LazyGridState$prefetchInfoRetriever$2
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public /* bridge */ /* synthetic */ List<? extends Pair<? extends Integer, ? extends Constraints>> invoke(Integer num) {
|
||
|
return invoke(num.intValue());
|
||
|
}
|
||
|
|
||
|
public final List<Pair<Integer, Constraints>> invoke(int i3) {
|
||
|
return CollectionsKt.emptyList();
|
||
|
}
|
||
|
}, null, 2, null);
|
||
|
this.prefetchInfoRetriever = mutableStateOf$default2;
|
||
|
this.placementAnimator = new LazyGridItemPlacementAnimator();
|
||
|
this.beyondBoundsInfo = new LazyLayoutBeyondBoundsInfo();
|
||
|
this.animateScrollScope = new LazyGridAnimateScrollScope(this);
|
||
|
this.pinnedItems = new LazyLayoutPinnedItemList();
|
||
|
lazyGridScrollPosition.getNearestRangeState();
|
||
|
mutableStateOf$default3 = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(false, null, 2, null);
|
||
|
this.canScrollForward = mutableStateOf$default3;
|
||
|
mutableStateOf$default4 = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(false, null, 2, null);
|
||
|
this.canScrollBackward = mutableStateOf$default4;
|
||
|
this.prefetchState = new LazyLayoutPrefetchState();
|
||
|
}
|
||
|
|
||
|
public /* synthetic */ LazyGridState(int i, int i2, int i3, DefaultConstructorMarker defaultConstructorMarker) {
|
||
|
this((i3 & 1) != 0 ? 0 : i, (i3 & 2) != 0 ? 0 : i2);
|
||
|
}
|
||
|
|
||
|
public final int getFirstVisibleItemIndex() {
|
||
|
return this.scrollPosition.getIndex();
|
||
|
}
|
||
|
|
||
|
public final int getFirstVisibleItemScrollOffset() {
|
||
|
return this.scrollPosition.getScrollOffset();
|
||
|
}
|
||
|
|
||
|
public final LazyGridLayoutInfo getLayoutInfo() {
|
||
|
return this.layoutInfoState.getValue();
|
||
|
}
|
||
|
|
||
|
public final InteractionSource getInteractionSource() {
|
||
|
return this.internalInteractionSource;
|
||
|
}
|
||
|
|
||
|
public final int getSlotsPerLine$foundation_release() {
|
||
|
return this.slotsPerLine.getIntValue();
|
||
|
}
|
||
|
|
||
|
public final Function1<Integer, List<Pair<Integer, Constraints>>> getPrefetchInfoRetriever$foundation_release() {
|
||
|
return (Function1) this.prefetchInfoRetriever.getValue();
|
||
|
}
|
||
|
|
||
|
public final IntRange getNearestRange$foundation_release() {
|
||
|
return this.scrollPosition.getNearestRangeState().getValue();
|
||
|
}
|
||
|
|
||
|
public static /* synthetic */ Object scrollToItem$default(LazyGridState lazyGridState, int i, int i2, Continuation continuation, int i3, Object obj) {
|
||
|
if ((i3 & 2) != 0) {
|
||
|
i2 = 0;
|
||
|
}
|
||
|
return lazyGridState.scrollToItem(i, i2, continuation);
|
||
|
}
|
||
|
|
||
|
public final Object scrollToItem(int i, int i2, Continuation<? super Unit> continuation) {
|
||
|
Object scroll$default = ScrollableState.scroll$default(this, null, new LazyGridState$scrollToItem$2(this, i, i2, null), continuation, 1, null);
|
||
|
return scroll$default == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? scroll$default : Unit.INSTANCE;
|
||
|
}
|
||
|
|
||
|
public final void snapToItemIndexInternal$foundation_release(int index, int scrollOffset) {
|
||
|
this.scrollPosition.requestPosition(index, scrollOffset);
|
||
|
this.placementAnimator.reset();
|
||
|
Remeasurement remeasurement = this.remeasurement;
|
||
|
if (remeasurement != null) {
|
||
|
remeasurement.forceRemeasure();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Removed duplicated region for block: B:19:0x006c A[RETURN] */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:20:0x0047 */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:8:0x0025 */
|
||
|
@Override // androidx.compose.foundation.gestures.ScrollableState
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
public java.lang.Object scroll(androidx.compose.foundation.MutatePriority r6, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.gestures.ScrollScope, ? super kotlin.coroutines.Continuation<? super kotlin.Unit>, ? extends java.lang.Object> r7, kotlin.coroutines.Continuation<? super kotlin.Unit> r8) {
|
||
|
/*
|
||
|
r5 = this;
|
||
|
boolean r0 = r8 instanceof androidx.compose.foundation.lazy.grid.LazyGridState$scroll$1
|
||
|
if (r0 == 0) goto L14
|
||
|
r0 = r8
|
||
|
androidx.compose.foundation.lazy.grid.LazyGridState$scroll$1 r0 = (androidx.compose.foundation.lazy.grid.LazyGridState$scroll$1) r0
|
||
|
int r1 = r0.label
|
||
|
r2 = -2147483648(0xffffffff80000000, float:-0.0)
|
||
|
r1 = r1 & r2
|
||
|
if (r1 == 0) goto L14
|
||
|
int r8 = r0.label
|
||
|
int r8 = r8 - r2
|
||
|
r0.label = r8
|
||
|
goto L19
|
||
|
L14:
|
||
|
androidx.compose.foundation.lazy.grid.LazyGridState$scroll$1 r0 = new androidx.compose.foundation.lazy.grid.LazyGridState$scroll$1
|
||
|
r0.<init>(r5, r8)
|
||
|
L19:
|
||
|
java.lang.Object r8 = r0.result
|
||
|
java.lang.Object r1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()
|
||
|
int r2 = r0.label
|
||
|
r3 = 2
|
||
|
r4 = 1
|
||
|
if (r2 == 0) goto L47
|
||
|
if (r2 == r4) goto L35
|
||
|
if (r2 != r3) goto L2d
|
||
|
kotlin.ResultKt.throwOnFailure(r8)
|
||
|
goto L6d
|
||
|
L2d:
|
||
|
java.lang.IllegalStateException r5 = new java.lang.IllegalStateException
|
||
|
java.lang.String r6 = "call to 'resume' before 'invoke' with coroutine"
|
||
|
r5.<init>(r6)
|
||
|
throw r5
|
||
|
L35:
|
||
|
java.lang.Object r5 = r0.L$2
|
||
|
r7 = r5
|
||
|
kotlin.jvm.functions.Function2 r7 = (kotlin.jvm.functions.Function2) r7
|
||
|
java.lang.Object r5 = r0.L$1
|
||
|
r6 = r5
|
||
|
androidx.compose.foundation.MutatePriority r6 = (androidx.compose.foundation.MutatePriority) r6
|
||
|
java.lang.Object r5 = r0.L$0
|
||
|
androidx.compose.foundation.lazy.grid.LazyGridState r5 = (androidx.compose.foundation.lazy.grid.LazyGridState) r5
|
||
|
kotlin.ResultKt.throwOnFailure(r8)
|
||
|
goto L5b
|
||
|
L47:
|
||
|
kotlin.ResultKt.throwOnFailure(r8)
|
||
|
androidx.compose.foundation.lazy.layout.AwaitFirstLayoutModifier r8 = r5.awaitLayoutModifier
|
||
|
r0.L$0 = r5
|
||
|
r0.L$1 = r6
|
||
|
r0.L$2 = r7
|
||
|
r0.label = r4
|
||
|
java.lang.Object r8 = r8.waitForFirstLayout(r0)
|
||
|
if (r8 != r1) goto L5b
|
||
|
return r1
|
||
|
L5b:
|
||
|
androidx.compose.foundation.gestures.ScrollableState r5 = r5.scrollableState
|
||
|
r8 = 0
|
||
|
r0.L$0 = r8
|
||
|
r0.L$1 = r8
|
||
|
r0.L$2 = r8
|
||
|
r0.label = r3
|
||
|
java.lang.Object r5 = r5.scroll(r6, r7, r0)
|
||
|
if (r5 != r1) goto L6d
|
||
|
return r1
|
||
|
L6d:
|
||
|
kotlin.Unit r5 = kotlin.Unit.INSTANCE
|
||
|
return r5
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: androidx.compose.foundation.lazy.grid.LazyGridState.scroll(androidx.compose.foundation.MutatePriority, kotlin.jvm.functions.Function2, kotlin.coroutines.Continuation):java.lang.Object");
|
||
|
}
|
||
|
|
||
|
@Override // androidx.compose.foundation.gestures.ScrollableState
|
||
|
public float dispatchRawDelta(float delta) {
|
||
|
return this.scrollableState.dispatchRawDelta(delta);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.compose.foundation.gestures.ScrollableState
|
||
|
public boolean isScrollInProgress() {
|
||
|
return this.scrollableState.isScrollInProgress();
|
||
|
}
|
||
|
|
||
|
private void setCanScrollForward(boolean z) {
|
||
|
this.canScrollForward.setValue(Boolean.valueOf(z));
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
@Override // androidx.compose.foundation.gestures.ScrollableState
|
||
|
public boolean getCanScrollForward() {
|
||
|
return ((Boolean) this.canScrollForward.getValue()).booleanValue();
|
||
|
}
|
||
|
|
||
|
private void setCanScrollBackward(boolean z) {
|
||
|
this.canScrollBackward.setValue(Boolean.valueOf(z));
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
@Override // androidx.compose.foundation.gestures.ScrollableState
|
||
|
public boolean getCanScrollBackward() {
|
||
|
return ((Boolean) this.canScrollBackward.getValue()).booleanValue();
|
||
|
}
|
||
|
|
||
|
public final float onScroll$foundation_release(float distance) {
|
||
|
if ((distance < 0.0f && !getCanScrollForward()) || (distance > 0.0f && !getCanScrollBackward())) {
|
||
|
return 0.0f;
|
||
|
}
|
||
|
if (Math.abs(this.scrollToBeConsumed) > 0.5f) {
|
||
|
throw new IllegalStateException(("entered drag with non-zero pending scroll: " + this.scrollToBeConsumed).toString());
|
||
|
}
|
||
|
float f = this.scrollToBeConsumed + distance;
|
||
|
this.scrollToBeConsumed = f;
|
||
|
if (Math.abs(f) > 0.5f) {
|
||
|
float f2 = this.scrollToBeConsumed;
|
||
|
Remeasurement remeasurement = this.remeasurement;
|
||
|
if (remeasurement != null) {
|
||
|
remeasurement.forceRemeasure();
|
||
|
}
|
||
|
if (this.prefetchingEnabled) {
|
||
|
notifyPrefetch(f2 - this.scrollToBeConsumed);
|
||
|
}
|
||
|
}
|
||
|
if (Math.abs(this.scrollToBeConsumed) <= 0.5f) {
|
||
|
return distance;
|
||
|
}
|
||
|
float f3 = distance - this.scrollToBeConsumed;
|
||
|
this.scrollToBeConsumed = 0.0f;
|
||
|
return f3;
|
||
|
}
|
||
|
|
||
|
private final void notifyPrefetch(float delta) {
|
||
|
int row;
|
||
|
int index;
|
||
|
MutableVector<LazyLayoutPrefetchState.PrefetchHandle> mutableVector;
|
||
|
int size;
|
||
|
LazyLayoutPrefetchState lazyLayoutPrefetchState = this.prefetchState;
|
||
|
if (this.prefetchingEnabled) {
|
||
|
LazyGridLayoutInfo layoutInfo = getLayoutInfo();
|
||
|
if (!layoutInfo.getVisibleItemsInfo().isEmpty()) {
|
||
|
boolean z = delta < 0.0f;
|
||
|
if (z) {
|
||
|
LazyGridItemInfo lazyGridItemInfo = (LazyGridItemInfo) CollectionsKt.last((List) layoutInfo.getVisibleItemsInfo());
|
||
|
row = (this.isVertical ? lazyGridItemInfo.getRow() : lazyGridItemInfo.getColumn()) + 1;
|
||
|
index = ((LazyGridItemInfo) CollectionsKt.last((List) layoutInfo.getVisibleItemsInfo())).getIndex() + 1;
|
||
|
} else {
|
||
|
LazyGridItemInfo lazyGridItemInfo2 = (LazyGridItemInfo) CollectionsKt.first((List) layoutInfo.getVisibleItemsInfo());
|
||
|
row = (this.isVertical ? lazyGridItemInfo2.getRow() : lazyGridItemInfo2.getColumn()) - 1;
|
||
|
index = ((LazyGridItemInfo) CollectionsKt.first((List) layoutInfo.getVisibleItemsInfo())).getIndex() - 1;
|
||
|
}
|
||
|
if (row == this.lineToPrefetch || index < 0 || index >= layoutInfo.getTotalItemsCount()) {
|
||
|
return;
|
||
|
}
|
||
|
if (this.wasScrollingForward != z && (size = (mutableVector = this.currentLinePrefetchHandles).getSize()) > 0) {
|
||
|
LazyLayoutPrefetchState.PrefetchHandle[] content = mutableVector.getContent();
|
||
|
int i = 0;
|
||
|
do {
|
||
|
content[i].cancel();
|
||
|
i++;
|
||
|
} while (i < size);
|
||
|
}
|
||
|
this.wasScrollingForward = z;
|
||
|
this.lineToPrefetch = row;
|
||
|
this.currentLinePrefetchHandles.clear();
|
||
|
List<Pair<Integer, Constraints>> invoke = getPrefetchInfoRetriever$foundation_release().invoke(Integer.valueOf(row));
|
||
|
int size2 = invoke.size();
|
||
|
for (int i2 = 0; i2 < size2; i2++) {
|
||
|
Pair<Integer, Constraints> pair = invoke.get(i2);
|
||
|
this.currentLinePrefetchHandles.add(lazyLayoutPrefetchState.m649schedulePrefetch0kLqBqw(pair.getFirst().intValue(), pair.getSecond().getValue()));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private final void cancelPrefetchIfVisibleItemsChanged(LazyGridLayoutInfo info) {
|
||
|
int row;
|
||
|
if (this.lineToPrefetch == -1 || !(!info.getVisibleItemsInfo().isEmpty())) {
|
||
|
return;
|
||
|
}
|
||
|
if (this.wasScrollingForward) {
|
||
|
LazyGridItemInfo lazyGridItemInfo = (LazyGridItemInfo) CollectionsKt.last((List) info.getVisibleItemsInfo());
|
||
|
row = (this.isVertical ? lazyGridItemInfo.getRow() : lazyGridItemInfo.getColumn()) + 1;
|
||
|
} else {
|
||
|
LazyGridItemInfo lazyGridItemInfo2 = (LazyGridItemInfo) CollectionsKt.first((List) info.getVisibleItemsInfo());
|
||
|
row = (this.isVertical ? lazyGridItemInfo2.getRow() : lazyGridItemInfo2.getColumn()) - 1;
|
||
|
}
|
||
|
if (this.lineToPrefetch != row) {
|
||
|
this.lineToPrefetch = -1;
|
||
|
MutableVector<LazyLayoutPrefetchState.PrefetchHandle> mutableVector = this.currentLinePrefetchHandles;
|
||
|
int size = mutableVector.getSize();
|
||
|
if (size > 0) {
|
||
|
LazyLayoutPrefetchState.PrefetchHandle[] content = mutableVector.getContent();
|
||
|
int i = 0;
|
||
|
do {
|
||
|
content[i].cancel();
|
||
|
i++;
|
||
|
} while (i < size);
|
||
|
}
|
||
|
this.currentLinePrefetchHandles.clear();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static /* synthetic */ Object animateScrollToItem$default(LazyGridState lazyGridState, int i, int i2, Continuation continuation, int i3, Object obj) {
|
||
|
if ((i3 & 2) != 0) {
|
||
|
i2 = 0;
|
||
|
}
|
||
|
return lazyGridState.animateScrollToItem(i, i2, continuation);
|
||
|
}
|
||
|
|
||
|
public final Object animateScrollToItem(int i, int i2, Continuation<? super Unit> continuation) {
|
||
|
Object animateScrollToItem = LazyAnimateScrollKt.animateScrollToItem(this.animateScrollScope, i, i2, continuation);
|
||
|
return animateScrollToItem == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? animateScrollToItem : Unit.INSTANCE;
|
||
|
}
|
||
|
|
||
|
public final void applyMeasureResult$foundation_release(LazyGridMeasureResult result) {
|
||
|
Intrinsics.checkNotNullParameter(result, "result");
|
||
|
this.scrollPosition.updateFromMeasureResult(result);
|
||
|
this.scrollToBeConsumed -= result.getConsumedScroll();
|
||
|
this.layoutInfoState.setValue(result);
|
||
|
setCanScrollForward(result.getCanScrollForward());
|
||
|
LazyGridMeasuredLine firstVisibleLine = result.getFirstVisibleLine();
|
||
|
setCanScrollBackward(((firstVisibleLine == null || firstVisibleLine.getIndex() == 0) && result.getFirstVisibleLineScrollOffset() == 0) ? false : true);
|
||
|
this.numMeasurePasses++;
|
||
|
cancelPrefetchIfVisibleItemsChanged(result);
|
||
|
}
|
||
|
|
||
|
public static /* synthetic */ int updateScrollPositionIfTheFirstItemWasMoved$foundation_release$default(LazyGridState lazyGridState, LazyGridItemProvider lazyGridItemProvider, int i, int i2, Object obj) {
|
||
|
if ((i2 & 2) != 0) {
|
||
|
Snapshot createNonObservableSnapshot = Snapshot.INSTANCE.createNonObservableSnapshot();
|
||
|
try {
|
||
|
Snapshot makeCurrent = createNonObservableSnapshot.makeCurrent();
|
||
|
try {
|
||
|
int index = lazyGridState.scrollPosition.getIndex();
|
||
|
createNonObservableSnapshot.dispose();
|
||
|
i = index;
|
||
|
} finally {
|
||
|
createNonObservableSnapshot.restoreCurrent(makeCurrent);
|
||
|
}
|
||
|
} catch (Throwable th) {
|
||
|
createNonObservableSnapshot.dispose();
|
||
|
throw th;
|
||
|
}
|
||
|
}
|
||
|
return lazyGridState.updateScrollPositionIfTheFirstItemWasMoved$foundation_release(lazyGridItemProvider, i);
|
||
|
}
|
||
|
|
||
|
public final int updateScrollPositionIfTheFirstItemWasMoved$foundation_release(LazyGridItemProvider itemProvider, int firstItemIndex) {
|
||
|
Intrinsics.checkNotNullParameter(itemProvider, "itemProvider");
|
||
|
return this.scrollPosition.updateScrollPositionIfTheFirstItemWasMoved(itemProvider, firstItemIndex);
|
||
|
}
|
||
|
|
||
|
/* compiled from: LazyGridState.kt */
|
||
|
@Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u001b\u0010\u0003\u001a\f\u0012\u0004\u0012\u00020\u0005\u0012\u0002\b\u00030\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007¨\u0006\b"}, d2 = {"Landroidx/compose/foundation/lazy/grid/LazyGridState$Companion;", "", "()V", "Saver", "Landroidx/compose/runtime/saveable/Saver;", "Landroidx/compose/foundation/lazy/grid/LazyGridState;", "getSaver", "()Landroidx/compose/runtime/saveable/Saver;", "foundation_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||
|
/* loaded from: classes.dex */
|
||
|
public static final class Companion {
|
||
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
||
|
this();
|
||
|
}
|
||
|
|
||
|
private Companion() {
|
||
|
}
|
||
|
|
||
|
public final Saver<LazyGridState, ?> getSaver() {
|
||
|
return LazyGridState.Saver;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final void setSlotsPerLine$foundation_release(int i) {
|
||
|
this.slotsPerLine.setIntValue(i);
|
||
|
}
|
||
|
|
||
|
public final void setPrefetchInfoRetriever$foundation_release(Function1<? super Integer, ? extends List<Pair<Integer, Constraints>>> function1) {
|
||
|
Intrinsics.checkNotNullParameter(function1, "<set-?>");
|
||
|
this.prefetchInfoRetriever.setValue(function1);
|
||
|
}
|
||
|
}
|