176 lines
5.5 KiB
Smali
176 lines
5.5 KiB
Smali
.class public Landroidx/lifecycle/ViewModelProvider;
|
|
.super Ljava/lang/Object;
|
|
.source "ViewModelProvider.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Landroidx/lifecycle/ViewModelProvider$AndroidViewModelFactory;,
|
|
Landroidx/lifecycle/ViewModelProvider$NewInstanceFactory;,
|
|
Landroidx/lifecycle/ViewModelProvider$Factory;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field private static final DEFAULT_KEY:Ljava/lang/String; = "androidx.lifecycle.ViewModelProvider.DefaultKey"
|
|
|
|
|
|
# instance fields
|
|
.field private final mFactory:Landroidx/lifecycle/ViewModelProvider$Factory;
|
|
|
|
.field private final mViewModelStore:Landroidx/lifecycle/ViewModelStore;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Landroidx/lifecycle/ViewModelStore;Landroidx/lifecycle/ViewModelProvider$Factory;)V
|
|
.locals 0
|
|
.param p1 # Landroidx/lifecycle/ViewModelStore;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p2 # Landroidx/lifecycle/ViewModelProvider$Factory;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
iput-object p2, p0, Landroidx/lifecycle/ViewModelProvider;->mFactory:Landroidx/lifecycle/ViewModelProvider$Factory;
|
|
|
|
iput-object p1, p0, Landroidx/lifecycle/ViewModelProvider;->mViewModelStore:Landroidx/lifecycle/ViewModelStore;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Landroidx/lifecycle/ViewModelStoreOwner;Landroidx/lifecycle/ViewModelProvider$Factory;)V
|
|
.locals 0
|
|
.param p1 # Landroidx/lifecycle/ViewModelStoreOwner;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p2 # Landroidx/lifecycle/ViewModelProvider$Factory;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
|
|
invoke-interface {p1}, Landroidx/lifecycle/ViewModelStoreOwner;->getViewModelStore()Landroidx/lifecycle/ViewModelStore;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p0, p1, p2}, Landroidx/lifecycle/ViewModelProvider;-><init>(Landroidx/lifecycle/ViewModelStore;Landroidx/lifecycle/ViewModelProvider$Factory;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public get(Ljava/lang/Class;)Landroidx/lifecycle/ViewModel;
|
|
.locals 2
|
|
.param p1 # Ljava/lang/Class;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.annotation build Landroidx/annotation/MainThread;
|
|
.end annotation
|
|
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T:",
|
|
"Landroidx/lifecycle/ViewModel;",
|
|
">(",
|
|
"Ljava/lang/Class<",
|
|
"TT;>;)TT;"
|
|
}
|
|
.end annotation
|
|
|
|
invoke-virtual {p1}, Ljava/lang/Class;->getCanonicalName()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
const-string v1, "androidx.lifecycle.ViewModelProvider.DefaultKey:"
|
|
|
|
invoke-static {v0}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v1, v0}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p0, v0, p1}, Landroidx/lifecycle/ViewModelProvider;->get(Ljava/lang/String;Ljava/lang/Class;)Landroidx/lifecycle/ViewModel;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
|
|
:cond_0
|
|
new-instance p1, Ljava/lang/IllegalArgumentException;
|
|
|
|
const-string v0, "Local and anonymous classes can not be ViewModels"
|
|
|
|
invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public get(Ljava/lang/String;Ljava/lang/Class;)Landroidx/lifecycle/ViewModel;
|
|
.locals 2
|
|
.param p1 # Ljava/lang/String;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p2 # Ljava/lang/Class;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.annotation build Landroidx/annotation/MainThread;
|
|
.end annotation
|
|
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T:",
|
|
"Landroidx/lifecycle/ViewModel;",
|
|
">(",
|
|
"Ljava/lang/String;",
|
|
"Ljava/lang/Class<",
|
|
"TT;>;)TT;"
|
|
}
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Landroidx/lifecycle/ViewModelProvider;->mViewModelStore:Landroidx/lifecycle/ViewModelStore;
|
|
|
|
invoke-virtual {v0, p1}, Landroidx/lifecycle/ViewModelStore;->get(Ljava/lang/String;)Landroidx/lifecycle/ViewModel;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p2, v0}, Ljava/lang/Class;->isInstance(Ljava/lang/Object;)Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
return-object v0
|
|
|
|
:cond_0
|
|
iget-object v0, p0, Landroidx/lifecycle/ViewModelProvider;->mFactory:Landroidx/lifecycle/ViewModelProvider$Factory;
|
|
|
|
invoke-interface {v0, p2}, Landroidx/lifecycle/ViewModelProvider$Factory;->create(Ljava/lang/Class;)Landroidx/lifecycle/ViewModel;
|
|
|
|
move-result-object p2
|
|
|
|
iget-object v0, p0, Landroidx/lifecycle/ViewModelProvider;->mViewModelStore:Landroidx/lifecycle/ViewModelStore;
|
|
|
|
invoke-virtual {v0, p1, p2}, Landroidx/lifecycle/ViewModelStore;->put(Ljava/lang/String;Landroidx/lifecycle/ViewModel;)V
|
|
|
|
return-object p2
|
|
.end method
|