apkfuckery/com.discord/smali/androidx/activity/OnBackPressedDispatcher.smali
2020-11-21 22:11:07 +00:00

230 lines
6.7 KiB
Smali

.class public final Landroidx/activity/OnBackPressedDispatcher;
.super Ljava/lang/Object;
.source "OnBackPressedDispatcher.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Landroidx/activity/OnBackPressedDispatcher$LifecycleOnBackPressedCancellable;,
Landroidx/activity/OnBackPressedDispatcher$OnBackPressedCancellable;
}
.end annotation
# instance fields
.field private final mFallbackOnBackPressed:Ljava/lang/Runnable;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end field
.field public final mOnBackPressedCallbacks:Ljava/util/ArrayDeque;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/ArrayDeque<",
"Landroidx/activity/OnBackPressedCallback;",
">;"
}
.end annotation
.end field
# direct methods
.method public constructor <init>()V
.locals 1
const/4 v0, 0x0
invoke-direct {p0, v0}, Landroidx/activity/OnBackPressedDispatcher;-><init>(Ljava/lang/Runnable;)V
return-void
.end method
.method public constructor <init>(Ljava/lang/Runnable;)V
.locals 1
.param p1 # Ljava/lang/Runnable;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
new-instance v0, Ljava/util/ArrayDeque;
invoke-direct {v0}, Ljava/util/ArrayDeque;-><init>()V
iput-object v0, p0, Landroidx/activity/OnBackPressedDispatcher;->mOnBackPressedCallbacks:Ljava/util/ArrayDeque;
iput-object p1, p0, Landroidx/activity/OnBackPressedDispatcher;->mFallbackOnBackPressed:Ljava/lang/Runnable;
return-void
.end method
# virtual methods
.method public addCallback(Landroidx/activity/OnBackPressedCallback;)V
.locals 0
.param p1 # Landroidx/activity/OnBackPressedCallback;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/MainThread;
.end annotation
invoke-virtual {p0, p1}, Landroidx/activity/OnBackPressedDispatcher;->addCancellableCallback(Landroidx/activity/OnBackPressedCallback;)Landroidx/activity/Cancellable;
return-void
.end method
.method public addCallback(Landroidx/lifecycle/LifecycleOwner;Landroidx/activity/OnBackPressedCallback;)V
.locals 2
.param p1 # Landroidx/lifecycle/LifecycleOwner;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2 # Landroidx/activity/OnBackPressedCallback;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroid/annotation/SuppressLint;
value = {
"LambdaLast"
}
.end annotation
.annotation build Landroidx/annotation/MainThread;
.end annotation
invoke-interface {p1}, Landroidx/lifecycle/LifecycleOwner;->getLifecycle()Landroidx/lifecycle/Lifecycle;
move-result-object p1
invoke-virtual {p1}, Landroidx/lifecycle/Lifecycle;->getCurrentState()Landroidx/lifecycle/Lifecycle$State;
move-result-object v0
sget-object v1, Landroidx/lifecycle/Lifecycle$State;->DESTROYED:Landroidx/lifecycle/Lifecycle$State;
if-ne v0, v1, :cond_0
return-void
:cond_0
new-instance v0, Landroidx/activity/OnBackPressedDispatcher$LifecycleOnBackPressedCancellable;
invoke-direct {v0, p0, p1, p2}, Landroidx/activity/OnBackPressedDispatcher$LifecycleOnBackPressedCancellable;-><init>(Landroidx/activity/OnBackPressedDispatcher;Landroidx/lifecycle/Lifecycle;Landroidx/activity/OnBackPressedCallback;)V
invoke-virtual {p2, v0}, Landroidx/activity/OnBackPressedCallback;->addCancellable(Landroidx/activity/Cancellable;)V
return-void
.end method
.method public addCancellableCallback(Landroidx/activity/OnBackPressedCallback;)Landroidx/activity/Cancellable;
.locals 1
.param p1 # Landroidx/activity/OnBackPressedCallback;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/MainThread;
.end annotation
.annotation build Landroidx/annotation/NonNull;
.end annotation
iget-object v0, p0, Landroidx/activity/OnBackPressedDispatcher;->mOnBackPressedCallbacks:Ljava/util/ArrayDeque;
invoke-virtual {v0, p1}, Ljava/util/ArrayDeque;->add(Ljava/lang/Object;)Z
new-instance v0, Landroidx/activity/OnBackPressedDispatcher$OnBackPressedCancellable;
invoke-direct {v0, p0, p1}, Landroidx/activity/OnBackPressedDispatcher$OnBackPressedCancellable;-><init>(Landroidx/activity/OnBackPressedDispatcher;Landroidx/activity/OnBackPressedCallback;)V
invoke-virtual {p1, v0}, Landroidx/activity/OnBackPressedCallback;->addCancellable(Landroidx/activity/Cancellable;)V
return-object v0
.end method
.method public hasEnabledCallbacks()Z
.locals 2
.annotation build Landroidx/annotation/MainThread;
.end annotation
iget-object v0, p0, Landroidx/activity/OnBackPressedDispatcher;->mOnBackPressedCallbacks:Ljava/util/ArrayDeque;
invoke-virtual {v0}, Ljava/util/ArrayDeque;->descendingIterator()Ljava/util/Iterator;
move-result-object v0
:cond_0
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_1
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Landroidx/activity/OnBackPressedCallback;
invoke-virtual {v1}, Landroidx/activity/OnBackPressedCallback;->isEnabled()Z
move-result v1
if-eqz v1, :cond_0
const/4 v0, 0x1
return v0
:cond_1
const/4 v0, 0x0
return v0
.end method
.method public onBackPressed()V
.locals 3
.annotation build Landroidx/annotation/MainThread;
.end annotation
iget-object v0, p0, Landroidx/activity/OnBackPressedDispatcher;->mOnBackPressedCallbacks:Ljava/util/ArrayDeque;
invoke-virtual {v0}, Ljava/util/ArrayDeque;->descendingIterator()Ljava/util/Iterator;
move-result-object v0
:cond_0
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_1
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Landroidx/activity/OnBackPressedCallback;
invoke-virtual {v1}, Landroidx/activity/OnBackPressedCallback;->isEnabled()Z
move-result v2
if-eqz v2, :cond_0
invoke-virtual {v1}, Landroidx/activity/OnBackPressedCallback;->handleOnBackPressed()V
return-void
:cond_1
iget-object v0, p0, Landroidx/activity/OnBackPressedDispatcher;->mFallbackOnBackPressed:Ljava/lang/Runnable;
if-eqz v0, :cond_2
invoke-interface {v0}, Ljava/lang/Runnable;->run()V
:cond_2
return-void
.end method