/** * Constructs a {@link ContextualSearchStaticEventFilter}. * * @param context The current Android {@link Context}. * @param host The @{link EventFilterHost} associated to this filter. * @param panelManager The @{link OverlayPanelManager} responsible for showing different panels. * @param swipeHandler The @{link EdgeSwipeHandler} for Contextual Search events. */ public ContextualSearchStaticEventFilter( Context context, EventFilterHost host, OverlayPanelManager panelManager, EdgeSwipeHandler swipeHandler, ContextualSearchTapHandler tapHandler) { super(context, host); mPanelManager = panelManager; mSwipeRecognizer = new SwipeRecognizerImpl(context); mSwipeRecognizer.setSwipeHandler(swipeHandler); mTapHandler = tapHandler; }
@Override protected boolean onTouchEventInternal(MotionEvent event) { OverlayPanel activePanel = mPanelManager.getActivePanel(); if (activePanel == null) return false; if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { // To avoid a gray flash of empty content, show the search content // view immediately on tap rather than waiting for panel expansion. // TODO(pedrosimonetti): Once we implement "side-swipe to dismiss" // we'll have to revisit this because we don't want to set the // Content View visibility to true when the side-swipe is detected. activePanel.notifyPanelTouched(); } mSwipeRecognizer.onTouchEvent(event); return true; }