Commit f3b75573 authored by Matthew Jones's avatar Matthew Jones Committed by Commit Bot

Prevent BottomSheet from receiving multiple onShowContextualSearch events

Contextual Search show/hide events are not 1:1. Show can be called
multiple times when the text selection changes (which is pretty
often). This would cause the bottom sheet to remain hidden after
Contextual Search was gone.

This patch checks if Contextual Search is already showing in the
BottomSheetController as not to change the behavior of other
Contextual Search observers.

Bug: 827353
Change-Id: Ib133224042cef6509d3cd7b81df78810093190f8
Reviewed-on: https://chromium-review.googlesource.com/1012193Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550689}
parent 907a5169
...@@ -170,6 +170,8 @@ public class BottomSheetController implements ApplicationStatus.ActivityStateLis ...@@ -170,6 +170,8 @@ public class BottomSheetController implements ApplicationStatus.ActivityStateLis
@Override @Override
public void onShowContextualSearch( public void onShowContextualSearch(
@Nullable GSAContextDisplaySelection selectionContext) { @Nullable GSAContextDisplaySelection selectionContext) {
// Contextual Search can call this method more than once per show event.
if (mIsCompositedUIShowing) return;
mWasSheetShowing = mBottomSheet.getSheetState() == BottomSheet.SHEET_STATE_PEEK; mWasSheetShowing = mBottomSheet.getSheetState() == BottomSheet.SHEET_STATE_PEEK;
mIsCompositedUIShowing = true; mIsCompositedUIShowing = true;
mBottomSheet.setSheetState(BottomSheet.SHEET_STATE_HIDDEN, false, mBottomSheet.setSheetState(BottomSheet.SHEET_STATE_HIDDEN, false,
......
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