org.chromium.chrome.browser.toolbar.ToolbarPhone Java Examples

The following examples show how to use org.chromium.chrome.browser.toolbar.ToolbarPhone. 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: LayoutTab.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes the {@link LayoutTab} from data extracted from a {@link Tab}.
 * As this function may be expensive and can be delayed we initialize it as a separately.
 *
 * @param backgroundColor       The color of the page background.
 * @param fallbackThumbnailId   The id of a cached thumbnail to show if the current
 *                              thumbnail is unavailable, or {@link Tab.INVALID_TAB_ID}
 *                              if none exists.
 * @param shouldStall           Whether the tab should display a desaturated thumbnail and
 *                              wait for the content layer to load.
 * @param canUseLiveTexture     Whether the tab can use a live texture when being displayed.
 * @return True if the init requires the compositor to update.
 */
public boolean initFromHost(int backgroundColor, boolean shouldStall, boolean canUseLiveTexture,
        int toolbarBackgroundColor, int textBoxBackgroundColor, float textBoxAlpha) {
    mBackgroundColor = backgroundColor;

    boolean needsUpdate = false;

    // If the toolbar color changed, animate between the old and new colors.
    if (mToolbarBackgroundColor != toolbarBackgroundColor && isVisible()
            && mInitFromHostCalled) {
        ChromeAnimation.Animation<ChromeAnimation.Animatable<?>>  themeColorAnimation =
                createAnimation(this, Property.TOOLBAR_COLOR, 0.0f, 1.0f,
                ToolbarPhone.THEME_COLOR_TRANSITION_DURATION, 0, false,
                BakedBezierInterpolator.TRANSFORM_CURVE);

        mInitialThemeColor = mToolbarBackgroundColor;
        mFinalThemeColor = toolbarBackgroundColor;

        if (mCurrentAnimations != null) {
            mCurrentAnimations.updateAndFinish();
        }

        mCurrentAnimations = new ChromeAnimation<ChromeAnimation.Animatable<?>>();
        mCurrentAnimations.add(themeColorAnimation);
        mCurrentAnimations.start();
        needsUpdate = true;
    } else {
        // If the layout tab isn't visible, just set the toolbar color without animating.
        mToolbarBackgroundColor = toolbarBackgroundColor;
    }

    mTextBoxBackgroundColor = textBoxBackgroundColor;
    mTextBoxAlpha = textBoxAlpha;
    mShouldStall = shouldStall;
    mCanUseLiveTexture = canUseLiveTexture;
    mInitFromHostCalled = true;

    return needsUpdate;
}
 
Example #2
Source File: LayoutTab.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes the {@link LayoutTab} from data extracted from a {@link Tab}.
 * As this function may be expensive and can be delayed we initialize it as a separately.
 *
 * @param backgroundColor       The color of the page background.
 * @param fallbackThumbnailId   The id of a cached thumbnail to show if the current
 *                              thumbnail is unavailable, or {@link Tab.INVALID_TAB_ID}
 *                              if none exists.
 * @param shouldStall           Whether the tab should display a desaturated thumbnail and
 *                              wait for the content layer to load.
 * @param canUseLiveTexture     Whether the tab can use a live texture when being displayed.
 * @return True if the init requires the compositor to update.
 */
public boolean initFromHost(int backgroundColor, boolean shouldStall, boolean canUseLiveTexture,
        int toolbarBackgroundColor, int textBoxBackgroundColor, float textBoxAlpha) {
    mBackgroundColor = backgroundColor;

    boolean needsUpdate = false;

    // If the toolbar color changed, animate between the old and new colors.
    if (mToolbarBackgroundColor != toolbarBackgroundColor && isVisible()
            && mInitFromHostCalled) {
        ChromeAnimation.Animation<ChromeAnimation.Animatable<?>>  themeColorAnimation =
                createAnimation(this, Property.TOOLBAR_COLOR, 0.0f, 1.0f,
                ToolbarPhone.THEME_COLOR_TRANSITION_DURATION, 0, false,
                BakedBezierInterpolator.TRANSFORM_CURVE);

        mInitialThemeColor = mToolbarBackgroundColor;
        mFinalThemeColor = toolbarBackgroundColor;

        if (mCurrentAnimations != null) {
            mCurrentAnimations.updateAndFinish();
        }

        mCurrentAnimations = new ChromeAnimation<ChromeAnimation.Animatable<?>>();
        mCurrentAnimations.add(themeColorAnimation);
        mCurrentAnimations.start();
        needsUpdate = true;
    } else {
        // If the layout tab isn't visible, just set the toolbar color without animating.
        mToolbarBackgroundColor = toolbarBackgroundColor;
    }

    mTextBoxBackgroundColor = textBoxBackgroundColor;
    mTextBoxAlpha = textBoxAlpha;
    mShouldStall = shouldStall;
    mCanUseLiveTexture = canUseLiveTexture;
    mInitFromHostCalled = true;

    return needsUpdate;
}