From 18de94a83f19759061844162310a8d9e56cc5d65 Mon Sep 17 00:00:00 2001 From: Doug Lee Date: Mon, 28 Nov 2016 15:53:24 -0800 Subject: [PATCH] Don't clear listeners at the end of dismissSheet() animation. We already have documentation telling users to handle removal. --- .../java/com/flipboard/bottomsheet/BottomSheetLayout.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bottomsheet/src/main/java/com/flipboard/bottomsheet/BottomSheetLayout.java b/bottomsheet/src/main/java/com/flipboard/bottomsheet/BottomSheetLayout.java index 9904298dfd..2c961b4cb8 100644 --- a/bottomsheet/src/main/java/com/flipboard/bottomsheet/BottomSheetLayout.java +++ b/bottomsheet/src/main/java/com/flipboard/bottomsheet/BottomSheetLayout.java @@ -693,7 +693,7 @@ public void onLayoutChange(View sheetView, int left, int top, int right, int bot public void dismissSheet() { dismissSheet(null); } - + private void dismissSheet(Runnable runAfterDismissThis) { if (state == State.HIDDEN) { runAfterDismiss = null; @@ -723,8 +723,6 @@ public void onAnimationEnd(Animator animation) { // Remove sheet specific properties viewTransformer = null; - onSheetDismissedListeners.clear(); - onSheetStateChangeListeners.clear(); if (runAfterDismiss != null) { runAfterDismiss.run(); runAfterDismiss = null; @@ -835,6 +833,8 @@ public void setUseHardwareLayerWhileAnimating(boolean useHardwareLayerWhileAnima /** * Adds an {@link OnSheetStateChangeListener} which will be notified when the state of the presented sheet changes. + * The listener will not be automatically removed, so remember to remove it when it's no longer needed + * (probably when the sheet is HIDDEN) * * @param onSheetStateChangeListener the listener to be notified. */ @@ -845,6 +845,8 @@ public void addOnSheetStateChangeListener(@NonNull OnSheetStateChangeListener on /** * Adds an {@link OnSheetDismissedListener} which will be notified when the state of the presented sheet changes. + * The listener will not be automatically removed, so remember to remove it when it's no longer needed + * (probably when the sheet is HIDDEN) * * @param onSheetDismissedListener the listener to be notified. */