.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; .field 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 ()V .locals 1 const/4 v0, 0x0 invoke-direct {p0, v0}, Landroidx/activity/OnBackPressedDispatcher;->(Ljava/lang/Runnable;)V return-void .end method .method public constructor (Ljava/lang/Runnable;)V .locals 1 invoke-direct {p0}, Ljava/lang/Object;->()V new-instance v0, Ljava/util/ArrayDeque; invoke-direct {v0}, Ljava/util/ArrayDeque;->()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 final addCallback(Landroidx/activity/OnBackPressedCallback;)V .locals 0 invoke-virtual {p0, p1}, Landroidx/activity/OnBackPressedDispatcher;->addCancellableCallback(Landroidx/activity/OnBackPressedCallback;)Landroidx/activity/Cancellable; return-void .end method .method public final addCallback(Landroidx/lifecycle/LifecycleOwner;Landroidx/activity/OnBackPressedCallback;)V .locals 2 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;->(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 final addCancellableCallback(Landroidx/activity/OnBackPressedCallback;)Landroidx/activity/Cancellable; .locals 1 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;->(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 final hasEnabledCallbacks()Z .locals 2 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 final onBackPressed()V .locals 3 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