org.chromium.chrome.browser.compositor.layouts.phone.StackLayout Java Examples

The following examples show how to use org.chromium.chrome.browser.compositor.layouts.phone.StackLayout. 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: LayoutManagerChrome.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the {@link LayoutManagerChrome} instance.
 * @param host              A {@link LayoutManagerHost} instance.
 */
public LayoutManagerChrome(LayoutManagerHost host, boolean createOverviewLayout) {
    super(host);
    Context context = host.getContext();
    LayoutRenderHost renderHost = host.getLayoutRenderHost();

    mOverviewModeObservers = new ObserverList<OverviewModeObserver>();

    // Build Event Filter Handlers
    mToolbarSwipeHandler = createToolbarSwipeHandler(this);

    // Build Layouts
    mOverviewListLayout = new OverviewListLayout(context, this, renderHost);
    mToolbarSwipeLayout = new ToolbarSwipeLayout(context, this, renderHost);
    if (createOverviewLayout) {
        mOverviewLayout = new StackLayout(context, this, renderHost);
    }
}
 
Example #2
Source File: ChromeTabbedActivity.java    From delion with Apache License 2.0 5 votes vote down vote up
private void toggleOverview() {
    Tab currentTab = getActivityTab();
    ContentViewCore contentViewCore =
            currentTab != null ? currentTab.getContentViewCore() : null;

    if (!mLayoutManager.overviewVisible()) {
        getCompositorViewHolder().hideKeyboard(new Runnable() {
            @Override
            public void run() {
                mLayoutManager.showOverview(true);
            }
        });
        if (contentViewCore != null) {
            contentViewCore.setAccessibilityState(false);
        }
    } else {
        Layout activeLayout = mLayoutManager.getActiveLayout();
        if (activeLayout instanceof StackLayout) {
            ((StackLayout) activeLayout).commitOutstandingModelState(LayoutManager.time());
        }
        if (getCurrentTabModel().getCount() != 0) {
            // Don't hide overview if current tab stack is empty()
            mLayoutManager.hideOverview(true);

            // hideOverview could change the current tab.  Update the local variables.
            currentTab = getActivityTab();
            contentViewCore = currentTab != null ? currentTab.getContentViewCore() : null;

            if (contentViewCore != null) {
                contentViewCore.setAccessibilityState(true);
            }
        }
    }
}
 
Example #3
Source File: LayoutManagerDocumentTabSwitcher.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a {@link LayoutManagerDocumentTabSwitcher} instance.
 * @param host            A {@link LayoutManagerHost} instance.
 */
public LayoutManagerDocumentTabSwitcher(LayoutManagerHost host) {
    super(host);
    Context context = host.getContext();
    LayoutRenderHost renderHost = host.getLayoutRenderHost();

    mBlackHoleEventFilter = new BlackHoleEventFilter(context, this);
    mGestureEventFilter = new GestureEventFilter(context, this, mGestureHandler);
    mOverviewListLayout =
            new OverviewListLayout(context, this, renderHost, mBlackHoleEventFilter);
    mOverviewLayout = new StackLayout(context, this, renderHost, mGestureEventFilter);
}
 
Example #4
Source File: LayoutManagerDocumentTabSwitcher.java    From delion with Apache License 2.0 5 votes vote down vote up
public void toggleOverview() {
    Tab tab = getTabModelSelector().getCurrentTab();
    ContentViewCore contentViewCore = tab != null ? tab.getContentViewCore() : null;

    if (!overviewVisible()) {
        mHost.hideKeyboard(new Runnable() {
            @Override
            public void run() {
                showOverview(true);
            }
        });
        if (contentViewCore != null) {
            contentViewCore.setAccessibilityState(false);
        }
    } else {
        Layout activeLayout = getActiveLayout();
        if (activeLayout instanceof StackLayout) {
            ((StackLayout) activeLayout).commitOutstandingModelState(LayoutManager.time());
        }
        if (getTabModelSelector().getCurrentModel().getCount() != 0) {
            // Don't hide overview if current tab stack is empty()
            hideOverview(true);

            // hideOverview could change the current tab.  Update the local variables.
            tab = getTabModelSelector().getCurrentTab();
            contentViewCore = tab != null ? tab.getContentViewCore() : null;

            if (contentViewCore != null) {
                contentViewCore.setAccessibilityState(true);
            }
        }
    }
}
 
Example #5
Source File: ChromeTabbedActivity.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void toggleOverview() {
    Tab currentTab = getActivityTab();
    ContentViewCore contentViewCore =
            currentTab != null ? currentTab.getContentViewCore() : null;

    if (!mLayoutManager.overviewVisible()) {
        getCompositorViewHolder().hideKeyboard(new Runnable() {
            @Override
            public void run() {
                mLayoutManager.showOverview(true);
            }
        });
        if (contentViewCore != null) {
            contentViewCore.setAccessibilityState(false);
        }
    } else {
        Layout activeLayout = mLayoutManager.getActiveLayout();
        if (activeLayout instanceof StackLayout) {
            ((StackLayout) activeLayout).commitOutstandingModelState(LayoutManager.time());
        }
        if (getCurrentTabModel().getCount() != 0) {
            // Don't hide overview if current tab stack is empty()
            mLayoutManager.hideOverview(true);

            // hideOverview could change the current tab.  Update the local variables.
            currentTab = getActivityTab();
            contentViewCore = currentTab != null ? currentTab.getContentViewCore() : null;

            if (contentViewCore != null) {
                contentViewCore.setAccessibilityState(true);
            }
        }
    }
}
 
Example #6
Source File: ChromeTabbedActivity.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void toggleOverview() {
    Tab currentTab = getActivityTab();
    ContentViewCore contentViewCore =
            currentTab != null ? currentTab.getContentViewCore() : null;

    if (!mLayoutManager.overviewVisible()) {
        getCompositorViewHolder().hideKeyboard(new Runnable() {
            @Override
            public void run() {
                mLayoutManager.showOverview(true);
            }
        });
        if (contentViewCore != null) {
            contentViewCore.setAccessibilityState(false);
        }
    } else {
        Layout activeLayout = mLayoutManager.getActiveLayout();
        if (activeLayout instanceof StackLayout) {
            ((StackLayout) activeLayout).commitOutstandingModelState(LayoutManager.time());
        }
        if (getCurrentTabModel().getCount() != 0) {
            // Don't hide overview if current tab stack is empty()
            mLayoutManager.hideOverview(true);

            // hideOverview could change the current tab.  Update the local variables.
            currentTab = getActivityTab();
            contentViewCore = currentTab != null ? currentTab.getContentViewCore() : null;

            if (contentViewCore != null) {
                contentViewCore.setAccessibilityState(true);
            }
        }
    }
}
 
Example #7
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 #8
Source File: Stack.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * @param layout The parent layout.
 */
public Stack(Context context, StackLayout layout) {
    mLayout = layout;
    contextChanged(context);
}
 
Example #9
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 #10
Source File: Stack.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * @param layout The parent layout.
 */
public Stack(Context context, StackLayout layout) {
    mLayout = layout;
    contextChanged(context);
}
 
Example #11
Source File: Stack.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * @param layout The parent layout.
 */
public Stack(Context context, StackLayout layout) {
    mLayout = layout;
    contextChanged(context);
}
 
Example #12
Source File: LayoutManagerChrome.java    From 365browser with Apache License 2.0 3 votes vote down vote up
/**
 * Simulates a click on the view at the specified pixel offset
 * from the top left of the view.
 * This is used by UI tests.
 * @param x Coordinate of the click in dp.
 * @param y Coordinate of the click in dp.
 */
@VisibleForTesting
public void simulateClick(float x, float y) {
    if (getActiveLayout() instanceof StackLayout) {
        ((StackLayout) getActiveLayout()).simulateClick(x, y);
    }
}
 
Example #13
Source File: LayoutManagerChrome.java    From 365browser with Apache License 2.0 3 votes vote down vote up
/**
 * Simulates a drag and issues Up-event to commit the drag.
 * @param x  Coordinate to start the Drag from in dp.
 * @param y  Coordinate to start the Drag from in dp.
 * @param dX Amount of drag in X direction in dp.
 * @param dY Amount of drag in Y direction in dp.
 */
@VisibleForTesting
public void simulateDrag(float x, float y, float dX, float dY) {
    if (getActiveLayout() instanceof StackLayout) {
        ((StackLayout) getActiveLayout()).simulateDrag(x, y, dX, dY);
    }
}