apkfuckery/com.discord/smali/androidx/lifecycle/ViewModelProviders.smali
2019-08-30 22:04:20 +02:00

143 lines
4.5 KiB
Smali

.class public Landroidx/lifecycle/ViewModelProviders;
.super Ljava/lang/Object;
.source "ViewModelProviders.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Landroidx/lifecycle/ViewModelProviders$DefaultFactory;
}
.end annotation
# direct methods
.method public constructor <init>()V
.locals 0
.annotation runtime Ljava/lang/Deprecated;
.end annotation
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method private static checkActivity(Landroidx/fragment/app/Fragment;)Landroid/app/Activity;
.locals 1
invoke-virtual {p0}, Landroidx/fragment/app/Fragment;->getActivity()Landroidx/fragment/app/FragmentActivity;
move-result-object p0
if-eqz p0, :cond_0
return-object p0
:cond_0
new-instance p0, Ljava/lang/IllegalStateException;
const-string v0, "Can\'t create ViewModelProvider for detached fragment"
invoke-direct {p0, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p0
.end method
.method private static checkApplication(Landroid/app/Activity;)Landroid/app/Application;
.locals 1
invoke-virtual {p0}, Landroid/app/Activity;->getApplication()Landroid/app/Application;
move-result-object p0
if-eqz p0, :cond_0
return-object p0
:cond_0
new-instance p0, Ljava/lang/IllegalStateException;
const-string v0, "Your activity/fragment is not yet attached to Application. You can\'t request ViewModel before onCreate call."
invoke-direct {p0, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p0
.end method
.method public static of(Landroidx/fragment/app/Fragment;)Landroidx/lifecycle/ViewModelProvider;
.locals 1
const/4 v0, 0x0
invoke-static {p0, v0}, Landroidx/lifecycle/ViewModelProviders;->of(Landroidx/fragment/app/Fragment;Landroidx/lifecycle/ViewModelProvider$Factory;)Landroidx/lifecycle/ViewModelProvider;
move-result-object p0
return-object p0
.end method
.method public static of(Landroidx/fragment/app/Fragment;Landroidx/lifecycle/ViewModelProvider$Factory;)Landroidx/lifecycle/ViewModelProvider;
.locals 1
invoke-static {p0}, Landroidx/lifecycle/ViewModelProviders;->checkActivity(Landroidx/fragment/app/Fragment;)Landroid/app/Activity;
move-result-object v0
invoke-static {v0}, Landroidx/lifecycle/ViewModelProviders;->checkApplication(Landroid/app/Activity;)Landroid/app/Application;
move-result-object v0
if-nez p1, :cond_0
invoke-static {v0}, Landroidx/lifecycle/ViewModelProvider$AndroidViewModelFactory;->getInstance(Landroid/app/Application;)Landroidx/lifecycle/ViewModelProvider$AndroidViewModelFactory;
move-result-object p1
:cond_0
new-instance v0, Landroidx/lifecycle/ViewModelProvider;
invoke-virtual {p0}, Landroidx/fragment/app/Fragment;->getViewModelStore()Landroidx/lifecycle/ViewModelStore;
move-result-object p0
invoke-direct {v0, p0, p1}, Landroidx/lifecycle/ViewModelProvider;-><init>(Landroidx/lifecycle/ViewModelStore;Landroidx/lifecycle/ViewModelProvider$Factory;)V
return-object v0
.end method
.method public static of(Landroidx/fragment/app/FragmentActivity;)Landroidx/lifecycle/ViewModelProvider;
.locals 1
const/4 v0, 0x0
invoke-static {p0, v0}, Landroidx/lifecycle/ViewModelProviders;->of(Landroidx/fragment/app/FragmentActivity;Landroidx/lifecycle/ViewModelProvider$Factory;)Landroidx/lifecycle/ViewModelProvider;
move-result-object p0
return-object p0
.end method
.method public static of(Landroidx/fragment/app/FragmentActivity;Landroidx/lifecycle/ViewModelProvider$Factory;)Landroidx/lifecycle/ViewModelProvider;
.locals 1
invoke-static {p0}, Landroidx/lifecycle/ViewModelProviders;->checkApplication(Landroid/app/Activity;)Landroid/app/Application;
move-result-object v0
if-nez p1, :cond_0
invoke-static {v0}, Landroidx/lifecycle/ViewModelProvider$AndroidViewModelFactory;->getInstance(Landroid/app/Application;)Landroidx/lifecycle/ViewModelProvider$AndroidViewModelFactory;
move-result-object p1
:cond_0
new-instance v0, Landroidx/lifecycle/ViewModelProvider;
invoke-virtual {p0}, Landroidx/fragment/app/FragmentActivity;->getViewModelStore()Landroidx/lifecycle/ViewModelStore;
move-result-object p0
invoke-direct {v0, p0, p1}, Landroidx/lifecycle/ViewModelProvider;-><init>(Landroidx/lifecycle/ViewModelStore;Landroidx/lifecycle/ViewModelProvider$Factory;)V
return-object v0
.end method