apkfuckery/com.discord/smali/androidx/activity/OnBackPressedDispatcher.smali

225 lines
6.6 KiB
Smali
Raw Normal View History

2019-10-07 23:23:22 +00:00
.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
2019-12-06 03:29:40 +00:00
.field public final mFallbackOnBackPressed:Ljava/lang/Runnable;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end field
2019-10-07 23:23:22 +00:00
2019-12-06 03:29:40 +00:00
.field public final mOnBackPressedCallbacks:Ljava/util/ArrayDeque;
2019-10-07 23:23:22 +00:00
.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
2019-12-06 03:29:40 +00:00
.param p1 # Ljava/lang/Runnable;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
2019-10-07 23:23:22 +00:00
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
2019-12-06 03:29:40 +00:00
.method public addCallback(Landroidx/activity/OnBackPressedCallback;)V
2019-10-07 23:23:22 +00:00
.locals 0
2019-12-06 03:29:40 +00:00
.param p1 # Landroidx/activity/OnBackPressedCallback;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/MainThread;
.end annotation
2019-10-07 23:23:22 +00:00
invoke-virtual {p0, p1}, Landroidx/activity/OnBackPressedDispatcher;->addCancellableCallback(Landroidx/activity/OnBackPressedCallback;)Landroidx/activity/Cancellable;
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public addCallback(Landroidx/lifecycle/LifecycleOwner;Landroidx/activity/OnBackPressedCallback;)V
2019-10-07 23:23:22 +00:00
.locals 2
2019-12-06 03:29:40 +00:00
.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 Landroidx/annotation/MainThread;
.end annotation
2019-10-07 23:23:22 +00:00
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
2019-12-06 03:29:40 +00:00
.method public addCancellableCallback(Landroidx/activity/OnBackPressedCallback;)Landroidx/activity/Cancellable;
2019-10-07 23:23:22 +00:00
.locals 1
2019-12-06 03:29:40 +00:00
.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
2019-10-07 23:23:22 +00:00
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
2019-12-06 03:29:40 +00:00
.method public hasEnabledCallbacks()Z
2019-10-07 23:23:22 +00:00
.locals 2
2019-12-06 03:29:40 +00:00
.annotation build Landroidx/annotation/MainThread;
.end annotation
2019-10-07 23:23:22 +00:00
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
2019-12-06 03:29:40 +00:00
.method public onBackPressed()V
2019-10-07 23:23:22 +00:00
.locals 3
2019-12-06 03:29:40 +00:00
.annotation build Landroidx/annotation/MainThread;
.end annotation
2019-10-07 23:23:22 +00:00
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