Commit 3c8481d0 authored by Matthew Jones's avatar Matthew Jones Committed by Commit Bot

Consider bottom sheet closing state when picking a snackbar manager

This patch has ChromeActivity consider whether the bottom sheet is in
the process of closing before determining which container to place
a snackbar in. This avoids inadvertently blocking snackbars that are
shown when the sheet is about closed.

Bug: 950739
Change-Id: Ib7e0b3d2bbd58580dad84c2d146b13b98dcb13ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1559154Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649134}
parent 984f0229
......@@ -1436,10 +1436,11 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent>
*/
@Override
public SnackbarManager getSnackbarManager() {
return mBottomSheetController != null
&& mBottomSheetController.getBottomSheet().isSheetOpen()
? mBottomSheetController.getSnackbarManager()
: mSnackbarManager;
boolean useBottomSheetContainer = mBottomSheetController != null
&& mBottomSheetController.getBottomSheet().isSheetOpen()
&& !mBottomSheetController.getBottomSheet().isClosing();
return useBottomSheetContainer ? mBottomSheetController.getSnackbarManager()
: mSnackbarManager;
}
@Override
......
......@@ -472,6 +472,13 @@ public class BottomSheet
return mActionBarDelegate;
}
/**
* @return Whether the sheet is in the process of closing.
*/
public boolean isClosing() {
return mSettleAnimator != null && mTargetState == SheetState.HIDDEN;
}
@Override
public boolean onInterceptTouchEvent(MotionEvent e) {
// If touch is disabled, act like a black hole and consume touch events without doing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment