mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
84 lines
5.5 KiB
Java
84 lines
5.5 KiB
Java
package androidx.slidingpanelayout.widget;
|
|
|
|
import android.app.Activity;
|
|
import androidx.window.layout.DisplayFeature;
|
|
import androidx.window.layout.FoldingFeature;
|
|
import androidx.window.layout.WindowInfoTracker;
|
|
import androidx.window.layout.WindowLayoutInfo;
|
|
import java.util.Iterator;
|
|
import java.util.concurrent.CancellationException;
|
|
import java.util.concurrent.Executor;
|
|
import kotlin.Metadata;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
|
|
import kotlinx.coroutines.CoroutineScopeKt;
|
|
import kotlinx.coroutines.ExecutorsKt;
|
|
import kotlinx.coroutines.Job;
|
|
|
|
/* compiled from: FoldingFeatureObserver.kt */
|
|
@Metadata(d1 = {"\u0000>\n\u0002\u0018\u0002\n\u0002\u0010\u0000\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\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0000\u0018\u00002\u00020\u0001:\u0001\u0015B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\u0012\u0010\u000b\u001a\u0004\u0018\u00010\f2\u0006\u0010\r\u001a\u00020\u000eH\u0002J\u000e\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0012J\u000e\u0010\u0013\u001a\u00020\u00102\u0006\u0010\t\u001a\u00020\nJ\u0006\u0010\u0014\u001a\u00020\u0010R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0007\u001a\u0004\u0018\u00010\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\t\u001a\u0004\u0018\u00010\nX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0016"}, d2 = {"Landroidx/slidingpanelayout/widget/FoldingFeatureObserver;", "", "windowInfoTracker", "Landroidx/window/layout/WindowInfoTracker;", "executor", "Ljava/util/concurrent/Executor;", "(Landroidx/window/layout/WindowInfoTracker;Ljava/util/concurrent/Executor;)V", "job", "Lkotlinx/coroutines/Job;", "onFoldingFeatureChangeListener", "Landroidx/slidingpanelayout/widget/FoldingFeatureObserver$OnFoldingFeatureChangeListener;", "getFoldingFeature", "Landroidx/window/layout/FoldingFeature;", "windowLayoutInfo", "Landroidx/window/layout/WindowLayoutInfo;", "registerLayoutStateChangeCallback", "", "activity", "Landroid/app/Activity;", "setOnFoldingFeatureChangeListener", "unregisterLayoutStateChangeCallback", "OnFoldingFeatureChangeListener", "slidingpanelayout_release"}, k = 1, mv = {1, 6, 0}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public final class FoldingFeatureObserver {
|
|
private final Executor executor;
|
|
private Job job;
|
|
private OnFoldingFeatureChangeListener onFoldingFeatureChangeListener;
|
|
private final WindowInfoTracker windowInfoTracker;
|
|
|
|
/* compiled from: FoldingFeatureObserver.kt */
|
|
@Metadata(d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b`\u0018\u00002\u00020\u0001J\u0010\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0005H&¨\u0006\u0006"}, d2 = {"Landroidx/slidingpanelayout/widget/FoldingFeatureObserver$OnFoldingFeatureChangeListener;", "", "onFoldingFeatureChange", "", "foldingFeature", "Landroidx/window/layout/FoldingFeature;", "slidingpanelayout_release"}, k = 1, mv = {1, 6, 0}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public interface OnFoldingFeatureChangeListener {
|
|
void onFoldingFeatureChange(FoldingFeature foldingFeature);
|
|
}
|
|
|
|
public final void setOnFoldingFeatureChangeListener(OnFoldingFeatureChangeListener onFoldingFeatureChangeListener) {
|
|
Intrinsics.checkNotNullParameter(onFoldingFeatureChangeListener, "onFoldingFeatureChangeListener");
|
|
this.onFoldingFeatureChangeListener = onFoldingFeatureChangeListener;
|
|
}
|
|
|
|
public FoldingFeatureObserver(WindowInfoTracker windowInfoTracker, Executor executor) {
|
|
Intrinsics.checkNotNullParameter(windowInfoTracker, "windowInfoTracker");
|
|
Intrinsics.checkNotNullParameter(executor, "executor");
|
|
this.windowInfoTracker = windowInfoTracker;
|
|
this.executor = executor;
|
|
}
|
|
|
|
public final void registerLayoutStateChangeCallback(Activity activity) {
|
|
Job launch$default;
|
|
Intrinsics.checkNotNullParameter(activity, "activity");
|
|
Job job = this.job;
|
|
if (job != null) {
|
|
Job.DefaultImpls.cancel$default(job, (CancellationException) null, 1, (Object) null);
|
|
}
|
|
launch$default = BuildersKt__Builders_commonKt.launch$default(CoroutineScopeKt.CoroutineScope(ExecutorsKt.from(this.executor)), null, null, new FoldingFeatureObserver$registerLayoutStateChangeCallback$1(this, activity, null), 3, null);
|
|
this.job = launch$default;
|
|
}
|
|
|
|
public final void unregisterLayoutStateChangeCallback() {
|
|
Job job = this.job;
|
|
if (job == null) {
|
|
return;
|
|
}
|
|
Job.DefaultImpls.cancel$default(job, (CancellationException) null, 1, (Object) null);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final FoldingFeature getFoldingFeature(WindowLayoutInfo windowLayoutInfo) {
|
|
Object obj;
|
|
Iterator<T> it = windowLayoutInfo.getDisplayFeatures().iterator();
|
|
while (true) {
|
|
if (!it.hasNext()) {
|
|
obj = null;
|
|
break;
|
|
}
|
|
obj = it.next();
|
|
if (((DisplayFeature) obj) instanceof FoldingFeature) {
|
|
break;
|
|
}
|
|
}
|
|
if (obj instanceof FoldingFeature) {
|
|
return (FoldingFeature) obj;
|
|
}
|
|
return null;
|
|
}
|
|
}
|