mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-25 08:32:38 -06:00
69 lines
4.4 KiB
Java
69 lines
4.4 KiB
Java
package androidx.lifecycle;
|
|
|
|
import androidx.lifecycle.Lifecycle;
|
|
import java.util.concurrent.CancellationException;
|
|
import kotlin.Metadata;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlinx.coroutines.Job;
|
|
|
|
/* compiled from: LifecycleController.kt */
|
|
@Metadata(d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\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\u0010\u0002\n\u0002\b\u0002\b\u0001\u0018\u00002\u00020\u0001B%\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\t¢\u0006\u0002\u0010\nJ\b\u0010\r\u001a\u00020\u000eH\u0007J\u0011\u0010\u000f\u001a\u00020\u000e2\u0006\u0010\b\u001a\u00020\tH\u0082\bR\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\fX\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0010"}, d2 = {"Landroidx/lifecycle/LifecycleController;", "", "lifecycle", "Landroidx/lifecycle/Lifecycle;", "minState", "Landroidx/lifecycle/Lifecycle$State;", "dispatchQueue", "Landroidx/lifecycle/DispatchQueue;", "parentJob", "Lkotlinx/coroutines/Job;", "(Landroidx/lifecycle/Lifecycle;Landroidx/lifecycle/Lifecycle$State;Landroidx/lifecycle/DispatchQueue;Lkotlinx/coroutines/Job;)V", "observer", "Landroidx/lifecycle/LifecycleEventObserver;", "finish", "", "handleDestroy", "lifecycle-common"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public final class LifecycleController {
|
|
private final DispatchQueue dispatchQueue;
|
|
private final Lifecycle lifecycle;
|
|
private final Lifecycle.State minState;
|
|
private final LifecycleEventObserver observer;
|
|
|
|
public LifecycleController(Lifecycle lifecycle, Lifecycle.State minState, DispatchQueue dispatchQueue, final Job parentJob) {
|
|
Intrinsics.checkNotNullParameter(lifecycle, "lifecycle");
|
|
Intrinsics.checkNotNullParameter(minState, "minState");
|
|
Intrinsics.checkNotNullParameter(dispatchQueue, "dispatchQueue");
|
|
Intrinsics.checkNotNullParameter(parentJob, "parentJob");
|
|
this.lifecycle = lifecycle;
|
|
this.minState = minState;
|
|
this.dispatchQueue = dispatchQueue;
|
|
LifecycleEventObserver lifecycleEventObserver = new LifecycleEventObserver() { // from class: androidx.lifecycle.LifecycleController$$ExternalSyntheticLambda0
|
|
@Override // androidx.lifecycle.LifecycleEventObserver
|
|
public final void onStateChanged(LifecycleOwner lifecycleOwner, Lifecycle.Event event) {
|
|
LifecycleController.observer$lambda$0(LifecycleController.this, parentJob, lifecycleOwner, event);
|
|
}
|
|
};
|
|
this.observer = lifecycleEventObserver;
|
|
if (lifecycle.getState() != Lifecycle.State.DESTROYED) {
|
|
lifecycle.addObserver(lifecycleEventObserver);
|
|
} else {
|
|
Job.DefaultImpls.cancel$default(parentJob, (CancellationException) null, 1, (Object) null);
|
|
finish();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static final void observer$lambda$0(LifecycleController this$0, Job parentJob, LifecycleOwner source, Lifecycle.Event event) {
|
|
Intrinsics.checkNotNullParameter(this$0, "this$0");
|
|
Intrinsics.checkNotNullParameter(parentJob, "$parentJob");
|
|
Intrinsics.checkNotNullParameter(source, "source");
|
|
Intrinsics.checkNotNullParameter(event, "<anonymous parameter 1>");
|
|
if (source.getLifecycle().getState() != Lifecycle.State.DESTROYED) {
|
|
if (source.getLifecycle().getState().compareTo(this$0.minState) < 0) {
|
|
this$0.dispatchQueue.pause();
|
|
return;
|
|
} else {
|
|
this$0.dispatchQueue.resume();
|
|
return;
|
|
}
|
|
}
|
|
Job.DefaultImpls.cancel$default(parentJob, (CancellationException) null, 1, (Object) null);
|
|
this$0.finish();
|
|
}
|
|
|
|
private final void handleDestroy(Job parentJob) {
|
|
Job.DefaultImpls.cancel$default(parentJob, (CancellationException) null, 1, (Object) null);
|
|
finish();
|
|
}
|
|
|
|
public final void finish() {
|
|
this.lifecycle.removeObserver(this.observer);
|
|
this.dispatchQueue.finish();
|
|
}
|
|
}
|