Java Code Examples for org.chromium.chrome.browser.compositor.layouts.components.LayoutTab#setBorderAlpha()

The following examples show how to use org.chromium.chrome.browser.compositor.layouts.components.LayoutTab#setBorderAlpha() . 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: SimpleAnimationLayout.java    From delion with Apache License 2.0 5 votes vote down vote up
private void ensureSourceTabCreated(int sourceTabId) {
    if (mLayoutTabs != null && mLayoutTabs.length == 1
            && mLayoutTabs[0].getId() == sourceTabId) {
        return;
    }
    // Just draw the source tab on the screen.
    TabModel sourceModel = mTabModelSelector.getModelForTabId(sourceTabId);
    if (sourceModel == null) return;
    LayoutTab sourceLayoutTab =
            createLayoutTab(sourceTabId, sourceModel.isIncognito(), NO_CLOSE_BUTTON, NO_TITLE);
    sourceLayoutTab.setBorderAlpha(0.0f);

    mLayoutTabs = new LayoutTab[] {sourceLayoutTab};
    updateCacheVisibleIds(new LinkedList<Integer>(Arrays.asList(sourceTabId)));
}
 
Example 2
Source File: SimpleAnimationLayout.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Animate opening a tab in the foreground.
 *
 * @param id             The id of the new tab to animate.
 * @param sourceId       The id of the tab that spawned this new tab.
 * @param newIsIncognito true if the new tab is an incognito tab.
 * @param originX        The X coordinate of the last touch down event that spawned this tab.
 * @param originY        The Y coordinate of the last touch down event that spawned this tab.
 */
private void tabCreatedInForeground(
        int id, int sourceId, boolean newIsIncognito, float originX, float originY) {
    LayoutTab newLayoutTab = createLayoutTab(id, newIsIncognito, NO_CLOSE_BUTTON, NO_TITLE);
    if (mLayoutTabs == null || mLayoutTabs.length == 0) {
        mLayoutTabs = new LayoutTab[] {newLayoutTab};
    } else {
        mLayoutTabs = new LayoutTab[] {mLayoutTabs[0], newLayoutTab};
    }
    updateCacheVisibleIds(new LinkedList<Integer>(Arrays.asList(id, sourceId)));

    newLayoutTab.setBorderAlpha(0.0f);
    newLayoutTab.setStaticToViewBlend(1.f);

    forceAnimationToFinish();

    Interpolator interpolator = BakedBezierInterpolator.TRANSFORM_CURVE;
    addToAnimation(newLayoutTab, LayoutTab.Property.SCALE, 0.f, 1.f,
            FOREGROUND_ANIMATION_DURATION, 0, false, interpolator);
    addToAnimation(newLayoutTab, LayoutTab.Property.ALPHA, 0.f, 1.f,
            FOREGROUND_ANIMATION_DURATION, 0, false, interpolator);
    addToAnimation(newLayoutTab, LayoutTab.Property.X, originX, 0.f,
            FOREGROUND_ANIMATION_DURATION, 0, false, interpolator);
    addToAnimation(newLayoutTab, LayoutTab.Property.Y, originY, 0.f,
            FOREGROUND_ANIMATION_DURATION, 0, false, interpolator);

    mTabModelSelector.selectModel(newIsIncognito);
    startHiding(id, false);
}
 
Example 3
Source File: SimpleAnimationLayout.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void ensureSourceTabCreated(int sourceTabId) {
    if (mLayoutTabs != null && mLayoutTabs.length == 1
            && mLayoutTabs[0].getId() == sourceTabId) {
        return;
    }
    // Just draw the source tab on the screen.
    TabModel sourceModel = mTabModelSelector.getModelForTabId(sourceTabId);
    if (sourceModel == null) return;
    LayoutTab sourceLayoutTab =
            createLayoutTab(sourceTabId, sourceModel.isIncognito(), NO_CLOSE_BUTTON, NO_TITLE);
    sourceLayoutTab.setBorderAlpha(0.0f);

    mLayoutTabs = new LayoutTab[] {sourceLayoutTab};
    updateCacheVisibleIds(new LinkedList<Integer>(Arrays.asList(sourceTabId)));
}
 
Example 4
Source File: SimpleAnimationLayout.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Animate opening a tab in the foreground.
 *
 * @param id             The id of the new tab to animate.
 * @param sourceId       The id of the tab that spawned this new tab.
 * @param newIsIncognito true if the new tab is an incognito tab.
 * @param originX        The X coordinate of the last touch down event that spawned this tab.
 * @param originY        The Y coordinate of the last touch down event that spawned this tab.
 */
private void tabCreatedInForeground(
        int id, int sourceId, boolean newIsIncognito, float originX, float originY) {
    LayoutTab newLayoutTab = createLayoutTab(id, newIsIncognito, NO_CLOSE_BUTTON, NO_TITLE);
    if (mLayoutTabs == null || mLayoutTabs.length == 0) {
        mLayoutTabs = new LayoutTab[] {newLayoutTab};
    } else {
        mLayoutTabs = new LayoutTab[] {mLayoutTabs[0], newLayoutTab};
    }
    updateCacheVisibleIds(new LinkedList<Integer>(Arrays.asList(id, sourceId)));

    newLayoutTab.setBorderAlpha(0.0f);
    newLayoutTab.setStaticToViewBlend(1.f);

    forceAnimationToFinish();

    Interpolator interpolator = BakedBezierInterpolator.TRANSFORM_CURVE;
    addToAnimation(newLayoutTab, LayoutTab.Property.SCALE, 0.f, 1.f,
            FOREGROUND_ANIMATION_DURATION, 0, false, interpolator);
    addToAnimation(newLayoutTab, LayoutTab.Property.ALPHA, 0.f, 1.f,
            FOREGROUND_ANIMATION_DURATION, 0, false, interpolator);
    addToAnimation(newLayoutTab, LayoutTab.Property.X, originX, 0.f,
            FOREGROUND_ANIMATION_DURATION, 0, false, interpolator);
    addToAnimation(newLayoutTab, LayoutTab.Property.Y, originY, 0.f,
            FOREGROUND_ANIMATION_DURATION, 0, false, interpolator);

    mTabModelSelector.selectModel(newIsIncognito);
    startHiding(id, false);
}
 
Example 5
Source File: SimpleAnimationLayout.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void ensureSourceTabCreated(int sourceTabId) {
    if (mLayoutTabs != null && mLayoutTabs.length == 1
            && mLayoutTabs[0].getId() == sourceTabId) {
        return;
    }
    // Just draw the source tab on the screen.
    TabModel sourceModel = mTabModelSelector.getModelForTabId(sourceTabId);
    if (sourceModel == null) return;
    LayoutTab sourceLayoutTab =
            createLayoutTab(sourceTabId, sourceModel.isIncognito(), NO_CLOSE_BUTTON, NO_TITLE);
    sourceLayoutTab.setBorderAlpha(0.0f);

    mLayoutTabs = new LayoutTab[] {sourceLayoutTab};
    updateCacheVisibleIds(new LinkedList<Integer>(Arrays.asList(sourceTabId)));
}
 
Example 6
Source File: SimpleAnimationLayout.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Animate opening a tab in the foreground.
 *
 * @param id             The id of the new tab to animate.
 * @param sourceId       The id of the tab that spawned this new tab.
 * @param newIsIncognito true if the new tab is an incognito tab.
 * @param originX        The X coordinate of the last touch down event that spawned this tab.
 * @param originY        The Y coordinate of the last touch down event that spawned this tab.
 */
private void tabCreatedInForeground(
        int id, int sourceId, boolean newIsIncognito, float originX, float originY) {
    LayoutTab newLayoutTab = createLayoutTab(id, newIsIncognito, NO_CLOSE_BUTTON, NO_TITLE);
    if (mLayoutTabs == null || mLayoutTabs.length == 0) {
        mLayoutTabs = new LayoutTab[] {newLayoutTab};
    } else {
        mLayoutTabs = new LayoutTab[] {mLayoutTabs[0], newLayoutTab};
    }
    updateCacheVisibleIds(new LinkedList<Integer>(Arrays.asList(id, sourceId)));

    newLayoutTab.setBorderAlpha(0.0f);
    newLayoutTab.setStaticToViewBlend(1.f);

    forceAnimationToFinish();

    Interpolator interpolator = BakedBezierInterpolator.TRANSFORM_CURVE;
    addToAnimation(newLayoutTab, LayoutTab.Property.SCALE, 0.f, 1.f,
            FOREGROUND_ANIMATION_DURATION, 0, false, interpolator);
    addToAnimation(newLayoutTab, LayoutTab.Property.ALPHA, 0.f, 1.f,
            FOREGROUND_ANIMATION_DURATION, 0, false, interpolator);
    addToAnimation(newLayoutTab, LayoutTab.Property.X, originX, 0.f,
            FOREGROUND_ANIMATION_DURATION, 0, false, interpolator);
    addToAnimation(newLayoutTab, LayoutTab.Property.Y, originY, 0.f,
            FOREGROUND_ANIMATION_DURATION, 0, false, interpolator);

    mTabModelSelector.selectModel(newIsIncognito);
    startHiding(id, false);

    if (mForegroundTabCreationAnimationDisabled) forceAnimationToFinish();
}