org.chromium.chrome.browser.compositor.layouts.eventfilter.EventFilter Java Examples

The following examples show how to use org.chromium.chrome.browser.compositor.layouts.eventfilter.EventFilter. 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 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;
}
 
Example #2
Source File: LayoutManager.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Gives the {@link LayoutManager} a chance to intercept and process touch events from the
 * Android {@link View} system.
 * @param e                 The {@link MotionEvent} that might be intercepted.
 * @param isKeyboardShowing Whether or not the keyboard is showing.
 * @return                  Whether or not this current touch gesture should be intercepted and
 *                          continually forwarded to this class.
 */
public boolean onInterceptTouchEvent(MotionEvent e, boolean isKeyboardShowing) {
    if (mActiveLayout == null) return false;

    if (e.getAction() == MotionEvent.ACTION_DOWN) {
        mLastTapX = (int) e.getX();
        mLastTapY = (int) e.getY();
    }

    PointF offsets = getMotionOffsets(e);

    EventFilter layoutFilter =
            mActiveLayout.findInterceptingEventFilter(e, offsets, isKeyboardShowing);
    mIsNewEventFilter = layoutFilter != mActiveEventFilter;
    mActiveEventFilter = layoutFilter;

    if (mActiveEventFilter != null) mActiveLayout.unstallImmediately();
    return mActiveEventFilter != null;
}
 
Example #3
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 #4
Source File: StackLayout.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * @param context     The current Android's context.
 * @param updateHost  The {@link LayoutUpdateHost} view for this layout.
 * @param renderHost  The {@link LayoutRenderHost} view for this layout.
 * @param eventFilter The {@link EventFilter} that is needed for this view.
 */
public StackLayout(Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost,
        EventFilter eventFilter) {
    super(context, updateHost, renderHost, eventFilter);

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mMinDirectionThreshold = configuration.getScaledTouchSlop();
    mMinShortPressThresholdSqr =
            configuration.getScaledPagingTouchSlop() * configuration.getScaledPagingTouchSlop();

    mMinMaxInnerMargin = (int) (MIN_INNER_MARGIN_PERCENT_DP + 0.5);
    mFlingSpeed = FLING_SPEED_DP;
    mStacks = new Stack[2];
    mStacks[0] = new Stack(context, this);
    mStacks[1] = new Stack(context, this);
    mStackRects = new RectF[2];
    mStackRects[0] = new RectF();
    mStackRects[1] = new RectF();

    mViewContainer = new FrameLayout(getContext());
    mSceneLayer = new TabListSceneLayer();
}
 
Example #5
Source File: StackLayout.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * @param context     The current Android's context.
 * @param updateHost  The {@link LayoutUpdateHost} view for this layout.
 * @param renderHost  The {@link LayoutRenderHost} view for this layout.
 * @param eventFilter The {@link EventFilter} that is needed for this view.
 */
public StackLayout(Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost,
        EventFilter eventFilter) {
    super(context, updateHost, renderHost, eventFilter);

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mMinDirectionThreshold = configuration.getScaledTouchSlop();
    mMinShortPressThresholdSqr =
            configuration.getScaledPagingTouchSlop() * configuration.getScaledPagingTouchSlop();

    mMinMaxInnerMargin = (int) (MIN_INNER_MARGIN_PERCENT_DP + 0.5);
    mFlingSpeed = FLING_SPEED_DP;
    mStacks = new Stack[2];
    mStacks[0] = new Stack(context, this);
    mStacks[1] = new Stack(context, this);
    mStackRects = new RectF[2];
    mStackRects[0] = new RectF();
    mStackRects[1] = new RectF();

    mViewContainer = new FrameLayout(getContext());
    mSceneLayer = new TabListSceneLayer();
}
 
Example #6
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 #7
Source File: Layout.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * The {@link Layout} is not usable until sizeChanged is called.
 * This is convenient this way so we can pre-create the layout before the host is fully defined.
 * @param context      The current Android's context.
 * @param updateHost   The parent {@link LayoutUpdateHost}.
 * @param renderHost   The parent {@link LayoutRenderHost}.
 * @param eventFilter  The {@link EventFilter} this {@link Layout} is listening to.
 */
public Layout(Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost,
        EventFilter eventFilter) {
    mContext = context;
    mUpdateHost = updateHost;
    mRenderHost = renderHost;
    mEventFilter = eventFilter;

    // Invalid sizes
    mWidth = -1;
    mHeight = -1;
    mHeightMinusTopControls = -1;

    mCurrentOrientation = Orientation.UNSET;
}
 
Example #8
Source File: ToolbarSwipeLayout.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * @param context             The current Android's context.
 * @param updateHost          The {@link LayoutUpdateHost} view for this layout.
 * @param renderHost          The {@link LayoutRenderHost} view for this layout.
 * @param eventFilter         The {@link EventFilter} that is needed for this view.
 */
public ToolbarSwipeLayout(Context context, LayoutUpdateHost updateHost,
        LayoutRenderHost renderHost, EventFilter eventFilter) {
    super(context, updateHost, renderHost, eventFilter);
    Resources res = context.getResources();
    final float pxToDp = 1.0f / res.getDisplayMetrics().density;
    mCommitDistanceFromEdge = res.getDimension(R.dimen.toolbar_swipe_commit_distance) * pxToDp;
    mSpaceBetweenTabs = res.getDimension(R.dimen.toolbar_swipe_space_between_tabs) * pxToDp;
    mSceneLayer = new TabListSceneLayer();
}
 
Example #9
Source File: StaticLayout.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance of the {@link StaticLayout}.
 * @param context             The current Android's context.
 * @param updateHost          The {@link LayoutUpdateHost} view for this layout.
 * @param renderHost          The {@link LayoutRenderHost} view for this layout.
 * @param eventFilter         The {@link EventFilter} that is needed for this view.
 * @param panelManager        The {@link OverlayPanelManager} responsible for showing panels.
 */
public StaticLayout(Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost,
        EventFilter eventFilter, OverlayPanelManager panelManager) {
    super(context, updateHost, renderHost, eventFilter);

    mHandler = new Handler();
    mUnstallRunnable = new UnstallRunnable();
    mUnstalling = false;
    mSceneLayer = new StaticTabSceneLayer(R.id.control_container);
}
 
Example #10
Source File: StaticLayout.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance of the {@link StaticLayout}.
 * @param context             The current Android's context.
 * @param updateHost          The {@link LayoutUpdateHost} view for this layout.
 * @param renderHost          The {@link LayoutRenderHost} view for this layout.
 * @param panelManager        The {@link OverlayPanelManager} responsible for showing panels.
 */
public StaticLayout(Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost,
        EventFilter eventFilter, OverlayPanelManager panelManager) {
    super(context, updateHost, renderHost);

    mHandler = new Handler();
    mUnstallRunnable = new UnstallRunnable();
    mUnstalling = false;
    mSceneLayer = new StaticTabSceneLayer(R.id.control_container);
}
 
Example #11
Source File: ToolbarSwipeLayout.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * @param context             The current Android's context.
 * @param updateHost          The {@link LayoutUpdateHost} view for this layout.
 * @param renderHost          The {@link LayoutRenderHost} view for this layout.
 * @param eventFilter         The {@link EventFilter} that is needed for this view.
 */
public ToolbarSwipeLayout(Context context, LayoutUpdateHost updateHost,
        LayoutRenderHost renderHost, EventFilter eventFilter) {
    super(context, updateHost, renderHost, eventFilter);
    Resources res = context.getResources();
    final float pxToDp = 1.0f / res.getDisplayMetrics().density;
    mCommitDistanceFromEdge = res.getDimension(R.dimen.toolbar_swipe_commit_distance) * pxToDp;
    mSpaceBetweenTabs = res.getDimension(R.dimen.toolbar_swipe_space_between_tabs) * pxToDp;
    mSceneLayer = new TabListSceneLayer();
}
 
Example #12
Source File: StaticLayout.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance of the {@link StaticLayout}.
 * @param context             The current Android's context.
 * @param updateHost          The {@link LayoutUpdateHost} view for this layout.
 * @param renderHost          The {@link LayoutRenderHost} view for this layout.
 * @param eventFilter         The {@link EventFilter} that is needed for this view.
 * @param panelManager        The {@link OverlayPanelManager} responsible for showing panels.
 */
public StaticLayout(Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost,
        EventFilter eventFilter, OverlayPanelManager panelManager) {
    super(context, updateHost, renderHost, eventFilter);

    mHandler = new Handler();
    mUnstallRunnable = new UnstallRunnable();
    mUnstalling = false;
    mSceneLayer = new StaticTabSceneLayer(R.id.control_container);
}
 
Example #13
Source File: Layout.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * The {@link Layout} is not usable until sizeChanged is called.
 * This is convenient this way so we can pre-create the layout before the host is fully defined.
 * @param context      The current Android's context.
 * @param updateHost   The parent {@link LayoutUpdateHost}.
 * @param renderHost   The parent {@link LayoutRenderHost}.
 * @param eventFilter  The {@link EventFilter} this {@link Layout} is listening to.
 */
public Layout(Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost,
        EventFilter eventFilter) {
    mContext = context;
    mUpdateHost = updateHost;
    mRenderHost = renderHost;
    mEventFilter = eventFilter;

    // Invalid sizes
    mWidth = -1;
    mHeight = -1;
    mHeightMinusBrowserControls = -1;

    mCurrentOrientation = Orientation.UNSET;
}
 
Example #14
Source File: StripLayoutHelperManager.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public EventFilter getEventFilter() {
    return mEventFilter;
}
 
Example #15
Source File: OverviewListLayout.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
public OverviewListLayout(Context context, LayoutUpdateHost updateHost,
        LayoutRenderHost renderHost, EventFilter eventFilter) {
    super(context, updateHost, renderHost, eventFilter);
    mDpToPx = context.getResources().getDisplayMetrics().density;
    mSceneLayer = new SceneLayer();
}
 
Example #16
Source File: ToolbarSceneLayer.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public EventFilter getEventFilter() {
    return null;
}
 
Example #17
Source File: OverlayPanel.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public EventFilter getEventFilter() {
    return mEventFilter;
}
 
Example #18
Source File: ToolbarSwipeLayout.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
protected EventFilter getEventFilter() {
    return mBlackHoleEventFilter;
}
 
Example #19
Source File: StaticLayout.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
protected EventFilter getEventFilter() {
    return null;
}
 
Example #20
Source File: StripLayoutHelperManager.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public EventFilter getEventFilter() {
    return mEventFilter;
}
 
Example #21
Source File: ChromeTabbedActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public Layout createOverviewLayout(Context context, LayoutUpdateHost updateHost,
        LayoutRenderHost renderHost, EventFilter eventFilter) {
    return new StackLayout(context, updateHost, renderHost, eventFilter);
}
 
Example #22
Source File: SimpleAnimationLayout.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
protected EventFilter getEventFilter() {
    return mBlackHoleEventFilter;
}
 
Example #23
Source File: ChromeTabbedActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public Layout createOverviewLayout(Context context, LayoutUpdateHost updateHost,
        LayoutRenderHost renderHost, EventFilter eventFilter) {
    return new StackLayout(context, updateHost, renderHost, eventFilter);
}
 
Example #24
Source File: OverviewListLayout.java    From delion with Apache License 2.0 4 votes vote down vote up
public OverviewListLayout(Context context, LayoutUpdateHost updateHost,
        LayoutRenderHost renderHost, EventFilter eventFilter) {
    super(context, updateHost, renderHost, eventFilter);
    mDpToPx = context.getResources().getDisplayMetrics().density;
    mSceneLayer = new SceneLayer();
}
 
Example #25
Source File: ToolbarSceneLayer.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public EventFilter getEventFilter() {
    return null;
}
 
Example #26
Source File: OverlayPanel.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public EventFilter getEventFilter() {
    return mEventFilter;
}
 
Example #27
Source File: StackLayout.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
protected EventFilter getEventFilter() {
    return mGestureEventFilter;
}
 
Example #28
Source File: OverlayPanel.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public EventFilter getEventFilter() {
    return mEventFilter;
}
 
Example #29
Source File: ToolbarSceneLayer.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public EventFilter getEventFilter() {
    return null;
}
 
Example #30
Source File: StripLayoutHelperManager.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public EventFilter getEventFilter() {
    return mEventFilter;
}