File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed
lib/java/com/google/android/material Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,9 @@ public void startListeningForBackCallbacks(
186
186
@ DoNotInline
187
187
@ Override
188
188
public void stopListeningForBackCallbacks (@ NonNull View view ) {
189
+ if (onBackInvokedCallback == null ) {
190
+ return ;
191
+ }
189
192
OnBackInvokedDispatcher onBackInvokedDispatcher = view .findOnBackInvokedDispatcher ();
190
193
if (onBackInvokedDispatcher == null ) {
191
194
return ;
Original file line number Diff line number Diff line change @@ -476,6 +476,8 @@ protected void onDetachedFromWindow() {
476
476
DrawerLayout drawerLayout = (DrawerLayout ) parent ;
477
477
drawerLayout .removeDrawerListener (backDrawerListener );
478
478
}
479
+
480
+ backOrchestrator .stopListeningForBackCallbacks ();
479
481
}
480
482
481
483
@ Override
Original file line number Diff line number Diff line change @@ -265,6 +265,13 @@ protected void onAttachedToWindow() {
265
265
MaterialShapeUtils .setParentAbsoluteElevation (this );
266
266
}
267
267
268
+ @ Override
269
+ protected void onDetachedFromWindow () {
270
+ super .onDetachedFromWindow ();
271
+
272
+ backOrchestrator .stopListeningForBackCallbacks ();
273
+ }
274
+
268
275
@ Override
269
276
@ NonNull
270
277
public CoordinatorLayout .Behavior <SearchView > getBehavior () {
You can’t perform that action at this time.
0 commit comments