apkfuckery/com.discord/smali/androidx/lifecycle/MediatorLiveData.smali
2019-12-06 04:29:40 +01:00

237 lines
6.2 KiB
Smali

.class public Landroidx/lifecycle/MediatorLiveData;
.super Landroidx/lifecycle/MutableLiveData;
.source "MediatorLiveData.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Landroidx/lifecycle/MediatorLiveData$Source;
}
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">",
"Landroidx/lifecycle/MutableLiveData<",
"TT;>;"
}
.end annotation
# instance fields
.field public mSources:Landroidx/arch/core/internal/SafeIterableMap;
.annotation system Ldalvik/annotation/Signature;
value = {
"Landroidx/arch/core/internal/SafeIterableMap<",
"Landroidx/lifecycle/LiveData<",
"*>;",
"Landroidx/lifecycle/MediatorLiveData$Source<",
"*>;>;"
}
.end annotation
.end field
# direct methods
.method public constructor <init>()V
.locals 1
invoke-direct {p0}, Landroidx/lifecycle/MutableLiveData;-><init>()V
new-instance v0, Landroidx/arch/core/internal/SafeIterableMap;
invoke-direct {v0}, Landroidx/arch/core/internal/SafeIterableMap;-><init>()V
iput-object v0, p0, Landroidx/lifecycle/MediatorLiveData;->mSources:Landroidx/arch/core/internal/SafeIterableMap;
return-void
.end method
# virtual methods
.method public addSource(Landroidx/lifecycle/LiveData;Landroidx/lifecycle/Observer;)V
.locals 2
.param p1 # Landroidx/lifecycle/LiveData;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2 # Landroidx/lifecycle/Observer;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/MainThread;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"<S:",
"Ljava/lang/Object;",
">(",
"Landroidx/lifecycle/LiveData<",
"TS;>;",
"Landroidx/lifecycle/Observer<",
"-TS;>;)V"
}
.end annotation
new-instance v0, Landroidx/lifecycle/MediatorLiveData$Source;
invoke-direct {v0, p1, p2}, Landroidx/lifecycle/MediatorLiveData$Source;-><init>(Landroidx/lifecycle/LiveData;Landroidx/lifecycle/Observer;)V
iget-object v1, p0, Landroidx/lifecycle/MediatorLiveData;->mSources:Landroidx/arch/core/internal/SafeIterableMap;
invoke-virtual {v1, p1, v0}, Landroidx/arch/core/internal/SafeIterableMap;->putIfAbsent(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Landroidx/lifecycle/MediatorLiveData$Source;
if-eqz p1, :cond_1
iget-object v1, p1, Landroidx/lifecycle/MediatorLiveData$Source;->mObserver:Landroidx/lifecycle/Observer;
if-ne v1, p2, :cond_0
goto :goto_0
:cond_0
new-instance p1, Ljava/lang/IllegalArgumentException;
const-string p2, "This source was already added with the different observer"
invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
:cond_1
:goto_0
if-eqz p1, :cond_2
return-void
:cond_2
invoke-virtual {p0}, Landroidx/lifecycle/LiveData;->hasActiveObservers()Z
move-result p1
if-eqz p1, :cond_3
invoke-virtual {v0}, Landroidx/lifecycle/MediatorLiveData$Source;->plug()V
:cond_3
return-void
.end method
.method public onActive()V
.locals 2
.annotation build Landroidx/annotation/CallSuper;
.end annotation
iget-object v0, p0, Landroidx/lifecycle/MediatorLiveData;->mSources:Landroidx/arch/core/internal/SafeIterableMap;
invoke-virtual {v0}, Landroidx/arch/core/internal/SafeIterableMap;->iterator()Ljava/util/Iterator;
move-result-object v0
:goto_0
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_0
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/util/Map$Entry;
invoke-interface {v1}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object v1
check-cast v1, Landroidx/lifecycle/MediatorLiveData$Source;
invoke-virtual {v1}, Landroidx/lifecycle/MediatorLiveData$Source;->plug()V
goto :goto_0
:cond_0
return-void
.end method
.method public onInactive()V
.locals 2
.annotation build Landroidx/annotation/CallSuper;
.end annotation
iget-object v0, p0, Landroidx/lifecycle/MediatorLiveData;->mSources:Landroidx/arch/core/internal/SafeIterableMap;
invoke-virtual {v0}, Landroidx/arch/core/internal/SafeIterableMap;->iterator()Ljava/util/Iterator;
move-result-object v0
:goto_0
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_0
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/util/Map$Entry;
invoke-interface {v1}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object v1
check-cast v1, Landroidx/lifecycle/MediatorLiveData$Source;
invoke-virtual {v1}, Landroidx/lifecycle/MediatorLiveData$Source;->unplug()V
goto :goto_0
:cond_0
return-void
.end method
.method public removeSource(Landroidx/lifecycle/LiveData;)V
.locals 1
.param p1 # Landroidx/lifecycle/LiveData;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/MainThread;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"<S:",
"Ljava/lang/Object;",
">(",
"Landroidx/lifecycle/LiveData<",
"TS;>;)V"
}
.end annotation
iget-object v0, p0, Landroidx/lifecycle/MediatorLiveData;->mSources:Landroidx/arch/core/internal/SafeIterableMap;
invoke-virtual {v0, p1}, Landroidx/arch/core/internal/SafeIterableMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Landroidx/lifecycle/MediatorLiveData$Source;
if-eqz p1, :cond_0
invoke-virtual {p1}, Landroidx/lifecycle/MediatorLiveData$Source;->unplug()V
:cond_0
return-void
.end method