Java Code Examples for org.chromium.chrome.browser.compositor.layouts.eventfilter.EventFilter#onInterceptTouchEvent()

The following examples show how to use org.chromium.chrome.browser.compositor.layouts.eventfilter.EventFilter#onInterceptTouchEvent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Layout.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * @param e                 The {@link MotionEvent} to consider.
 * @param offsets           The current touch offsets that should be applied to the
 *                          {@link EventFilter}s.
 * @param isKeyboardShowing Whether or not the keyboard is showing.
 * @return The {@link EventFilter} the {@link Layout} is listening to.
 */
public EventFilter findInterceptingEventFilter(
        MotionEvent e, Point offsets, boolean isKeyboardShowing) {
    // The last added overlay will be drawn on top of everything else, therefore the last
    // filter added should have the first chance to intercept any touch events.
    for (int i = mSceneOverlays.size() - 1; i >= 0; i--) {
        EventFilter eventFilter = mSceneOverlays.get(i).getEventFilter();
        if (eventFilter == null) continue;
        if (offsets != null) eventFilter.setCurrentMotionEventOffsets(offsets.x, offsets.y);
        if (eventFilter.onInterceptTouchEvent(e, isKeyboardShowing)) return eventFilter;
    }

    if (mEventFilter != null) {
        if (offsets != null) mEventFilter.setCurrentMotionEventOffsets(offsets.x, offsets.y);
        if (mEventFilter.onInterceptTouchEvent(e, isKeyboardShowing)) return mEventFilter;
    }
    return null;
}
 
Example 2
Source File: Layout.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * @param e                 The {@link MotionEvent} to consider.
 * @param offsets           The current touch offsets that should be applied to the
 *                          {@link EventFilter}s.
 * @param isKeyboardShowing Whether or not the keyboard is showing.
 * @return The {@link EventFilter} the {@link Layout} is listening to.
 */
public EventFilter findInterceptingEventFilter(
        MotionEvent e, Point offsets, boolean isKeyboardShowing) {
    // The last added overlay will be drawn on top of everything else, therefore the last
    // filter added should have the first chance to intercept any touch events.
    for (int i = mSceneOverlays.size() - 1; i >= 0; i--) {
        EventFilter eventFilter = mSceneOverlays.get(i).getEventFilter();
        if (eventFilter == null) continue;
        if (offsets != null) eventFilter.setCurrentMotionEventOffsets(offsets.x, offsets.y);
        if (eventFilter.onInterceptTouchEvent(e, isKeyboardShowing)) return eventFilter;
    }

    if (mEventFilter != null) {
        if (offsets != null) mEventFilter.setCurrentMotionEventOffsets(offsets.x, offsets.y);
        if (mEventFilter.onInterceptTouchEvent(e, isKeyboardShowing)) return mEventFilter;
    }
    return null;
}
 
Example 3
Source File: Layout.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * @param e                 The {@link MotionEvent} to consider.
 * @param offsets           The current touch offsets that should be applied to the
 *                          {@link EventFilter}s.
 * @param isKeyboardShowing Whether or not the keyboard is showing.
 * @return The {@link EventFilter} the {@link Layout} is listening to.
 */
public EventFilter findInterceptingEventFilter(
        MotionEvent e, PointF offsets, boolean isKeyboardShowing) {
    // The last added overlay will be drawn on top of everything else, therefore the last
    // filter added should have the first chance to intercept any touch events.
    for (int i = mSceneOverlays.size() - 1; i >= 0; i--) {
        EventFilter eventFilter = mSceneOverlays.get(i).getEventFilter();
        if (eventFilter == null) continue;
        if (offsets != null) eventFilter.setCurrentMotionEventOffsets(offsets.x, offsets.y);
        if (eventFilter.onInterceptTouchEvent(e, isKeyboardShowing)) return eventFilter;
    }

    EventFilter layoutEventFilter = getEventFilter();
    if (layoutEventFilter != null) {
        if (offsets != null) {
            layoutEventFilter.setCurrentMotionEventOffsets(offsets.x, offsets.y);
        }
        if (layoutEventFilter.onInterceptTouchEvent(e, isKeyboardShowing)) {
            return layoutEventFilter;
        }
    }
    return null;
}