org.chromium.chrome.browser.compositor.overlays.strip.StripLayoutTab Java Examples

The following examples show how to use org.chromium.chrome.browser.compositor.overlays.strip.StripLayoutTab. 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: TabStripSceneLayer.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Pushes all relevant {@link StripLayoutTab}s to the CC Layer tree.
 * This also pushes any other assets required to draw the Tab Strip.  This should only be called
 * when the Compositor has disabled ScheduleComposite calls as this will change the tree and
 * could subsequently cause unnecessary follow up renders.
 *
 * @param layoutHelper A layout helper for the tab strip.
 * @param layerTitleCache A layer title cache.
 * @param resourceManager A resource manager.
 * @param stripLayoutTabsToRender Array of strip layout tabs.
 * @param yOffset Current top controls offset in dp.
 */
public void pushAndUpdateStrip(StripLayoutHelperManager layoutHelper,
        LayerTitleCache layerTitleCache, ResourceManager resourceManager,
        StripLayoutTab[] stripLayoutTabsToRender, float yOffset, int selectedTabId) {
    if (mNativePtr == 0) return;

    final boolean visible = yOffset > -layoutHelper.getHeight();
    // This will hide the tab strips if necessary.
    nativeBeginBuildingFrame(mNativePtr, visible);
    // When strip tabs are completely off screen, we don't need to update it.
    if (visible) {
        pushButtonsAndBackground(layoutHelper, resourceManager, yOffset);
        pushStripTabs(layoutHelper, layerTitleCache, resourceManager, stripLayoutTabsToRender,
                selectedTabId);
    }
    nativeFinishBuildingFrame(mNativePtr);
}
 
Example #2
Source File: TabStripSceneLayer.java    From delion with Apache License 2.0 6 votes vote down vote up
private void pushStripTabs(StripLayoutHelperManager layoutHelper,
        LayerTitleCache layerTitleCache, ResourceManager resourceManager,
        StripLayoutTab[] stripTabs, int selectedTabId) {
    final int tabsCount = stripTabs != null ? stripTabs.length : 0;

    for (int i = 0; i < tabsCount; i++) {
        final StripLayoutTab st = stripTabs[i];
        boolean isSelected = st.getId() == selectedTabId;
        nativePutStripTabLayer(mNativePtr, st.getId(), st.getCloseButton().getResourceId(),
                st.getResourceId(isSelected), isSelected, st.getClosePressed(),
                layoutHelper.getWidth() * mDpToPx, st.getDrawX() * mDpToPx,
                st.getDrawY() * mDpToPx, st.getWidth() * mDpToPx, st.getHeight() * mDpToPx,
                st.getContentOffsetX() * mDpToPx, st.getCloseButton().getOpacity(),
                st.isLoading(), st.getLoadingSpinnerRotation(), layoutHelper.getBorderOpacity(),
                layerTitleCache, resourceManager);
    }
}
 
Example #3
Source File: TabStripSceneLayer.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Pushes all relevant {@link StripLayoutTab}s to the CC Layer tree.
 * This also pushes any other assets required to draw the Tab Strip.  This should only be called
 * when the Compositor has disabled ScheduleComposite calls as this will change the tree and
 * could subsequently cause unnecessary follow up renders.
 *
 * @param layoutHelper A layout helper for the tab strip.
 * @param layerTitleCache A layer title cache.
 * @param resourceManager A resource manager.
 * @param stripLayoutTabsToRender Array of strip layout tabs.
 * @param yOffset Current browser controls offset in dp.
 */
public void pushAndUpdateStrip(StripLayoutHelperManager layoutHelper,
        LayerTitleCache layerTitleCache, ResourceManager resourceManager,
        StripLayoutTab[] stripLayoutTabsToRender, float yOffset, int selectedTabId) {
    if (mNativePtr == 0) return;

    final boolean visible = yOffset > -layoutHelper.getHeight();
    // This will hide the tab strips if necessary.
    nativeBeginBuildingFrame(mNativePtr, visible);
    // When strip tabs are completely off screen, we don't need to update it.
    if (visible) {
        pushButtonsAndBackground(layoutHelper, resourceManager, yOffset);
        pushStripTabs(layoutHelper, layerTitleCache, resourceManager, stripLayoutTabsToRender,
                selectedTabId);
    }
    nativeFinishBuildingFrame(mNativePtr);
}
 
Example #4
Source File: TabStripSceneLayer.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void pushStripTabs(StripLayoutHelperManager layoutHelper,
        LayerTitleCache layerTitleCache, ResourceManager resourceManager,
        StripLayoutTab[] stripTabs, int selectedTabId) {
    final int tabsCount = stripTabs != null ? stripTabs.length : 0;

    for (int i = 0; i < tabsCount; i++) {
        final StripLayoutTab st = stripTabs[i];
        boolean isSelected = st.getId() == selectedTabId;
        nativePutStripTabLayer(mNativePtr, st.getId(), st.getCloseButton().getResourceId(),
                st.getResourceId(isSelected), isSelected, st.getClosePressed(),
                layoutHelper.getWidth() * mDpToPx, st.getDrawX() * mDpToPx,
                st.getDrawY() * mDpToPx, st.getWidth() * mDpToPx, st.getHeight() * mDpToPx,
                st.getContentOffsetX() * mDpToPx, st.getCloseButton().getOpacity(),
                st.isLoading(), st.getLoadingSpinnerRotation(), layoutHelper.getBorderOpacity(),
                layerTitleCache, resourceManager);
    }
}
 
Example #5
Source File: TabStripSceneLayer.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Pushes all relevant {@link StripLayoutTab}s to the CC Layer tree.
 * This also pushes any other assets required to draw the Tab Strip.  This should only be called
 * when the Compositor has disabled ScheduleComposite calls as this will change the tree and
 * could subsequently cause unnecessary follow up renders.
 *
 * @param layoutHelper A layout helper for the tab strip.
 * @param layerTitleCache A layer title cache.
 * @param resourceManager A resource manager.
 * @param stripLayoutTabsToRender Array of strip layout tabs.
 * @param yOffset Current browser controls offset in dp.
 */
public void pushAndUpdateStrip(StripLayoutHelperManager layoutHelper,
        LayerTitleCache layerTitleCache, ResourceManager resourceManager,
        StripLayoutTab[] stripLayoutTabsToRender, float yOffset, int selectedTabId) {
    if (mNativePtr == 0) return;

    final boolean visible = yOffset > -layoutHelper.getHeight();
    // This will hide the tab strips if necessary.
    nativeBeginBuildingFrame(mNativePtr, visible);
    // When strip tabs are completely off screen, we don't need to update it.
    if (visible) {
        pushButtonsAndBackground(layoutHelper, resourceManager, yOffset);
        pushStripTabs(layoutHelper, layerTitleCache, resourceManager, stripLayoutTabsToRender,
                selectedTabId);
    }
    nativeFinishBuildingFrame(mNativePtr);
}
 
Example #6
Source File: TabStripSceneLayer.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void pushStripTabs(StripLayoutHelperManager layoutHelper,
        LayerTitleCache layerTitleCache, ResourceManager resourceManager,
        StripLayoutTab[] stripTabs, int selectedTabId) {
    final int tabsCount = stripTabs != null ? stripTabs.length : 0;

    for (int i = 0; i < tabsCount; i++) {
        final StripLayoutTab st = stripTabs[i];
        boolean isSelected = st.getId() == selectedTabId;
        nativePutStripTabLayer(mNativePtr, st.getId(), st.getCloseButton().getResourceId(),
                st.getResourceId(isSelected), isSelected, st.getClosePressed(),
                layoutHelper.getWidth() * mDpToPx, st.getDrawX() * mDpToPx,
                st.getDrawY() * mDpToPx, st.getWidth() * mDpToPx, st.getHeight() * mDpToPx,
                st.getContentOffsetX() * mDpToPx, st.getCloseButton().getOpacity(),
                st.isLoading(), st.getLoadingSpinnerRotation(), layoutHelper.getBorderOpacity(),
                layerTitleCache, resourceManager);
    }
}