Java Code Examples for org.chromium.chrome.browser.compositor.layouts.ChromeAnimation#Animation

The following examples show how to use org.chromium.chrome.browser.compositor.layouts.ChromeAnimation#Animation . 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: OverlayPanelAnimation.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Appends an Animation to the current animation set and starts it immediately.  If the set is
 * already finished or doesn't exist, the animation set is also started.
 */
protected void addToAnimation(ChromeAnimation.Animation<Animatable<?>> component) {
    if (mLayoutAnimations == null || mLayoutAnimations.finished()) {
        onAnimationStarted();
        mLayoutAnimations = new ChromeAnimation<Animatable<?>>();
        mLayoutAnimations.start();
    }
    component.start();
    mLayoutAnimations.add(component);
    requestUpdate();
}
 
Example 2
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 3
Source File: OverlayPanelAnimation.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Appends an Animation to the current animation set and starts it immediately.  If the set is
 * already finished or doesn't exist, the animation set is also started.
 */
protected void addToAnimation(ChromeAnimation.Animation<Animatable<?>> component) {
    if (mLayoutAnimations == null || mLayoutAnimations.finished()) {
        onAnimationStarted();
        mLayoutAnimations = new ChromeAnimation<Animatable<?>>();
        mLayoutAnimations.start();
    }
    component.start();
    mLayoutAnimations.add(component);
    requestUpdate();
}
 
Example 4
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;
}
 
Example 5
Source File: OverlayPanelAnimation.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Appends an Animation to the current animation set and starts it immediately.  If the set is
 * already finished or doesn't exist, the animation set is also started.
 */
protected void addToAnimation(ChromeAnimation.Animation<Animatable<?>> component) {
    if (mLayoutAnimations == null || mLayoutAnimations.finished()) {
        onAnimationStarted();
        mLayoutAnimations = new ChromeAnimation<Animatable<?>>();
        mLayoutAnimations.start();
    }
    component.start();
    mLayoutAnimations.add(component);
    requestUpdate();
}
 
Example 6
Source File: OverlayPanelAnimation.java    From delion with Apache License 2.0 3 votes vote down vote up
/**
 * Creates an {@link org.chromium.chrome.browser.compositor.layouts.ChromeAnimation.Animatable}
 * and adds it to the animation.
 *
 * @param <T>                     The Enum type of the Property being used
 * @param object                  The object being animated
 * @param prop                    The property being animated
 * @param start                   The starting value of the animation
 * @param end                     The ending value of the animation
 * @param duration                The duration of the animation in ms
 * @param startTime               The start time in ms
 * @param setStartValueAfterDelay See {@link Animation#setStartValueAfterStartDelay(boolean)}
 * @param interpolator            The interpolator to use for the animation
 */
protected <T extends Enum<?>> void addToAnimation(Animatable<T> object, T prop, float start,
        float end, long duration, long startTime, boolean setStartValueAfterDelay,
        Interpolator interpolator) {
    ChromeAnimation.Animation<Animatable<?>> component = createAnimation(object, prop, start,
            end, duration, startTime, setStartValueAfterDelay, interpolator);
    addToAnimation(component);
}
 
Example 7
Source File: OverlayPanelAnimation.java    From AndroidChromium with Apache License 2.0 3 votes vote down vote up
/**
 * Creates an {@link org.chromium.chrome.browser.compositor.layouts.ChromeAnimation.Animatable}
 * and adds it to the animation.
 *
 * @param <T>                     The Enum type of the Property being used
 * @param object                  The object being animated
 * @param prop                    The property being animated
 * @param start                   The starting value of the animation
 * @param end                     The ending value of the animation
 * @param duration                The duration of the animation in ms
 * @param startTime               The start time in ms
 * @param setStartValueAfterDelay See {@link Animation#setStartValueAfterStartDelay(boolean)}
 * @param interpolator            The interpolator to use for the animation
 */
public <T extends Enum<?>> void addToAnimation(Animatable<T> object, T prop, float start,
        float end, long duration, long startTime, boolean setStartValueAfterDelay,
        Interpolator interpolator) {
    ChromeAnimation.Animation<Animatable<?>> component = createAnimation(object, prop, start,
            end, duration, startTime, setStartValueAfterDelay, interpolator);
    addToAnimation(component);
}
 
Example 8
Source File: OverlayPanelAnimation.java    From 365browser with Apache License 2.0 3 votes vote down vote up
/**
 * Creates an {@link org.chromium.chrome.browser.compositor.layouts.ChromeAnimation.Animatable}
 * and adds it to the animation.
 *
 * @param <T>                     The Enum type of the Property being used
 * @param object                  The object being animated
 * @param prop                    The property being animated
 * @param start                   The starting value of the animation
 * @param end                     The ending value of the animation
 * @param duration                The duration of the animation in ms
 * @param startTime               The start time in ms
 * @param setStartValueAfterDelay See {@link Animation#setStartValueAfterStartDelay(boolean)}
 * @param interpolator            The interpolator to use for the animation
 */
public <T extends Enum<?>> void addToAnimation(Animatable<T> object, T prop, float start,
        float end, long duration, long startTime, boolean setStartValueAfterDelay,
        Interpolator interpolator) {
    ChromeAnimation.Animation<Animatable<?>> component = createAnimation(object, prop, start,
            end, duration, startTime, setStartValueAfterDelay, interpolator);
    addToAnimation(component);
}