2021-07-24 02:37:17 +00:00
|
|
|
package androidx.lifecycle;
|
|
|
|
|
|
|
|
import androidx.lifecycle.ViewModel;
|
|
|
|
import androidx.lifecycle.ViewModelProvider;
|
2021-11-01 07:19:03 +00:00
|
|
|
import d0.e0.c;
|
|
|
|
import d0.z.a;
|
|
|
|
import d0.z.d.m;
|
2021-07-24 02:37:17 +00:00
|
|
|
import kotlin.Lazy;
|
|
|
|
import kotlin.jvm.functions.Function0;
|
|
|
|
/* compiled from: ViewModelProvider.kt */
|
|
|
|
public final class ViewModelLazy<VM extends ViewModel> implements Lazy<VM> {
|
|
|
|
private VM cached;
|
|
|
|
private final Function0<ViewModelProvider.Factory> factoryProducer;
|
|
|
|
private final Function0<ViewModelStore> storeProducer;
|
|
|
|
private final c<VM> viewModelClass;
|
|
|
|
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelStore> */
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelProvider$Factory> */
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
public ViewModelLazy(c<VM> cVar, Function0<? extends ViewModelStore> function0, Function0<? extends ViewModelProvider.Factory> function02) {
|
|
|
|
m.checkNotNullParameter(cVar, "viewModelClass");
|
|
|
|
m.checkNotNullParameter(function0, "storeProducer");
|
|
|
|
m.checkNotNullParameter(function02, "factoryProducer");
|
|
|
|
this.viewModelClass = cVar;
|
|
|
|
this.storeProducer = function0;
|
|
|
|
this.factoryProducer = function02;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // kotlin.Lazy
|
|
|
|
public VM getValue() {
|
|
|
|
VM vm = this.cached;
|
|
|
|
if (vm != null) {
|
|
|
|
return vm;
|
|
|
|
}
|
2021-11-01 07:19:03 +00:00
|
|
|
VM vm2 = (VM) new ViewModelProvider(this.storeProducer.mo1invoke(), this.factoryProducer.mo1invoke()).get(a.getJavaClass(this.viewModelClass));
|
2021-07-24 02:37:17 +00:00
|
|
|
this.cached = vm2;
|
|
|
|
m.checkNotNullExpressionValue(vm2, "ViewModelProvider(store,…ed = it\n }");
|
|
|
|
return vm2;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // kotlin.Lazy
|
|
|
|
public boolean isInitialized() {
|
|
|
|
return this.cached != null;
|
|
|
|
}
|
|
|
|
}
|