- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
65 lines
2.8 KiB
Java
65 lines
2.8 KiB
Java
package androidx.lifecycle;
|
|
|
|
import androidx.lifecycle.ViewModel;
|
|
import androidx.lifecycle.ViewModelProvider;
|
|
import androidx.lifecycle.viewmodel.CreationExtras;
|
|
import kotlin.Lazy;
|
|
import kotlin.jvm.JvmClassMappingKt;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.reflect.KClass;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class ViewModelLazy<VM extends ViewModel> implements Lazy {
|
|
private VM cached;
|
|
private final Function0 extrasProducer;
|
|
private final Function0 factoryProducer;
|
|
private final Function0 storeProducer;
|
|
private final KClass viewModelClass;
|
|
|
|
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
|
|
public ViewModelLazy(KClass viewModelClass, Function0 storeProducer, Function0 factoryProducer) {
|
|
this(viewModelClass, storeProducer, factoryProducer, null, 8, null);
|
|
Intrinsics.checkNotNullParameter(viewModelClass, "viewModelClass");
|
|
Intrinsics.checkNotNullParameter(storeProducer, "storeProducer");
|
|
Intrinsics.checkNotNullParameter(factoryProducer, "factoryProducer");
|
|
}
|
|
|
|
@Override // kotlin.Lazy
|
|
public boolean isInitialized() {
|
|
return this.cached != null;
|
|
}
|
|
|
|
public ViewModelLazy(KClass viewModelClass, Function0 storeProducer, Function0 factoryProducer, Function0 extrasProducer) {
|
|
Intrinsics.checkNotNullParameter(viewModelClass, "viewModelClass");
|
|
Intrinsics.checkNotNullParameter(storeProducer, "storeProducer");
|
|
Intrinsics.checkNotNullParameter(factoryProducer, "factoryProducer");
|
|
Intrinsics.checkNotNullParameter(extrasProducer, "extrasProducer");
|
|
this.viewModelClass = viewModelClass;
|
|
this.storeProducer = storeProducer;
|
|
this.factoryProducer = factoryProducer;
|
|
this.extrasProducer = extrasProducer;
|
|
}
|
|
|
|
public /* synthetic */ ViewModelLazy(KClass kClass, Function0 function0, Function0 function02, Function0 function03, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(kClass, function0, function02, (i & 8) != 0 ? new Function0() { // from class: androidx.lifecycle.ViewModelLazy.1
|
|
@Override // kotlin.jvm.functions.Function0
|
|
public final CreationExtras.Empty invoke() {
|
|
return CreationExtras.Empty.INSTANCE;
|
|
}
|
|
} : function03);
|
|
}
|
|
|
|
@Override // kotlin.Lazy
|
|
public VM getValue() {
|
|
VM vm = this.cached;
|
|
if (vm != null) {
|
|
return vm;
|
|
}
|
|
VM vm2 = (VM) new ViewModelProvider((ViewModelStore) this.storeProducer.invoke(), (ViewModelProvider.Factory) this.factoryProducer.invoke(), (CreationExtras) this.extrasProducer.invoke()).get(JvmClassMappingKt.getJavaClass(this.viewModelClass));
|
|
this.cached = vm2;
|
|
return vm2;
|
|
}
|
|
}
|