139 lines
4.6 KiB
Java
139 lines
4.6 KiB
Java
package o;
|
|
|
|
import android.app.Application;
|
|
import android.os.Bundle;
|
|
import androidx.lifecycle.SavedStateHandleController;
|
|
import java.lang.reflect.Constructor;
|
|
import o.VLM;
|
|
|
|
/* renamed from: o.rAP, reason: case insensitive filesystem */
|
|
/* loaded from: classes.dex */
|
|
public final class C16768rAP extends VLM.RVV implements VLM.LWm {
|
|
private FNE a;
|
|
private Bundle b;
|
|
private wdQ c;
|
|
private Application d;
|
|
private final VLM.LWm e;
|
|
|
|
public C16768rAP() {
|
|
this.e = new VLM.Sts();
|
|
}
|
|
|
|
public C16768rAP(Application application, InterfaceC9254dgJ interfaceC9254dgJ, Bundle bundle) {
|
|
VLM.Sts sts;
|
|
VLM.Sts sts2;
|
|
VLM.Sts sts3;
|
|
C14957gcv.e(interfaceC9254dgJ, "");
|
|
this.a = interfaceC9254dgJ.getSavedStateRegistry();
|
|
this.c = interfaceC9254dgJ.getLifecycle();
|
|
this.b = bundle;
|
|
this.d = application;
|
|
if (application != null) {
|
|
VLM.Sts.IeS ieS = VLM.Sts.e;
|
|
C14957gcv.e(application, "");
|
|
sts2 = VLM.Sts.d;
|
|
if (sts2 == null) {
|
|
VLM.Sts.d = new VLM.Sts(application);
|
|
}
|
|
sts3 = VLM.Sts.d;
|
|
C14957gcv.e(sts3);
|
|
sts = sts3;
|
|
} else {
|
|
sts = new VLM.Sts();
|
|
}
|
|
this.e = sts;
|
|
}
|
|
|
|
@Override // o.VLM.LWm
|
|
public final <T extends VKL> T create(Class<T> cls, CWH cwh) {
|
|
Constructor d;
|
|
C14957gcv.e(cls, "");
|
|
C14957gcv.e(cwh, "");
|
|
String str = (String) cwh.d(VLM.IeS.c);
|
|
if (str == null) {
|
|
throw new IllegalStateException("VIEW_MODEL_KEY must always be provided by ViewModelProvider");
|
|
}
|
|
if (cwh.d(HLt.a) == null || cwh.d(HLt.b) == null) {
|
|
if (this.c != null) {
|
|
return (T) b(str, cls);
|
|
}
|
|
throw new IllegalStateException("SAVED_STATE_REGISTRY_OWNER_KEY andVIEW_MODEL_STORE_OWNER_KEY must be provided in the creation extras tosuccessfully create a ViewModel.");
|
|
}
|
|
Application application = (Application) cwh.d(VLM.Sts.a);
|
|
boolean isAssignableFrom = XRU.class.isAssignableFrom(cls);
|
|
if (isAssignableFrom && application != null) {
|
|
d = Plq.d(cls, Plq.e());
|
|
} else {
|
|
d = Plq.d(cls, Plq.c());
|
|
}
|
|
if (d == null) {
|
|
return (T) this.e.create(cls, cwh);
|
|
}
|
|
if (isAssignableFrom && application != null) {
|
|
return (T) Plq.c(cls, d, application, HLt.a(cwh));
|
|
}
|
|
return (T) Plq.c(cls, d, HLt.a(cwh));
|
|
}
|
|
|
|
private <T extends VKL> T b(String str, Class<T> cls) {
|
|
Constructor d;
|
|
T t;
|
|
Application application;
|
|
C14957gcv.e(str, "");
|
|
C14957gcv.e(cls, "");
|
|
if (this.c == null) {
|
|
throw new UnsupportedOperationException("SavedStateViewModelFactory constructed with empty constructor supports only calls to create(modelClass: Class<T>, extras: CreationExtras).");
|
|
}
|
|
boolean isAssignableFrom = XRU.class.isAssignableFrom(cls);
|
|
if (isAssignableFrom && this.d != null) {
|
|
d = Plq.d(cls, Plq.e());
|
|
} else {
|
|
d = Plq.d(cls, Plq.c());
|
|
}
|
|
if (d == null) {
|
|
if (this.d != null) {
|
|
return (T) this.e.create(cls);
|
|
}
|
|
VLM.IeS.RVV rvv = VLM.IeS.b;
|
|
if (VLM.IeS.a == null) {
|
|
VLM.IeS.a = new VLM.IeS();
|
|
}
|
|
VLM.IeS ieS = VLM.IeS.a;
|
|
C14957gcv.e(ieS);
|
|
return (T) ieS.create(cls);
|
|
}
|
|
SavedStateHandleController zs_ = C14821gNe.zs_(this.a, this.c, str, this.b);
|
|
if (isAssignableFrom && (application = this.d) != null) {
|
|
C14957gcv.e(application);
|
|
NER ner = zs_.d;
|
|
C14957gcv.c(ner, "");
|
|
t = (T) Plq.c(cls, d, application, ner);
|
|
} else {
|
|
NER ner2 = zs_.d;
|
|
C14957gcv.c(ner2, "");
|
|
t = (T) Plq.c(cls, d, ner2);
|
|
}
|
|
t.setTagIfAbsent("androidx.lifecycle.savedstate.vm.tag", zs_);
|
|
return t;
|
|
}
|
|
|
|
@Override // o.VLM.LWm
|
|
public final <T extends VKL> T create(Class<T> cls) {
|
|
C14957gcv.e(cls, "");
|
|
String canonicalName = cls.getCanonicalName();
|
|
if (canonicalName == null) {
|
|
throw new IllegalArgumentException("Local and anonymous classes can not be ViewModels");
|
|
}
|
|
return (T) b(canonicalName, cls);
|
|
}
|
|
|
|
@Override // o.VLM.RVV
|
|
public final void e(VKL vkl) {
|
|
C14957gcv.e(vkl, "");
|
|
wdQ wdq = this.c;
|
|
if (wdq != null) {
|
|
C14821gNe.c(vkl, this.a, wdq);
|
|
}
|
|
}
|
|
}
|