org.chromium.chrome.browser.compositor.layouts.ChromeAnimation.Animatable Java Examples

The following examples show how to use org.chromium.chrome.browser.compositor.layouts.ChromeAnimation.Animatable. 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: StackAnimationLandscape.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
protected ChromeAnimation<?> createViewMoreAnimatorSet(StackTab[] tabs, int selectedIndex) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    if (selectedIndex + 1 >= tabs.length) return set;

    float offset = tabs[selectedIndex].getScrollOffset()
            - tabs[selectedIndex + 1].getScrollOffset()
            + (tabs[selectedIndex].getLayoutTab().getScaledContentWidth()
                           * VIEW_MORE_SIZE_RATIO);
    offset = Math.max(VIEW_MORE_MIN_SIZE, offset);
    for (int i = selectedIndex + 1; i < tabs.length; ++i) {
        addAnimation(set, tabs[i], SCROLL_OFFSET, tabs[i].getScrollOffset(),
                tabs[i].getScrollOffset() + offset, VIEW_MORE_ANIMATION_DURATION, 0);
    }

    return set;
}
 
Example #2
Source File: StackAnimationLandscape.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
protected ChromeAnimation<?> createViewMoreAnimatorSet(StackTab[] tabs, int selectedIndex) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    if (selectedIndex + 1 >= tabs.length) return set;

    float offset = tabs[selectedIndex].getScrollOffset()
            - tabs[selectedIndex + 1].getScrollOffset()
            + (tabs[selectedIndex].getLayoutTab().getScaledContentWidth()
                           * VIEW_MORE_SIZE_RATIO);
    offset = Math.max(VIEW_MORE_MIN_SIZE, offset);
    for (int i = selectedIndex + 1; i < tabs.length; ++i) {
        addAnimation(set, tabs[i], SCROLL_OFFSET, tabs[i].getScrollOffset(),
                tabs[i].getScrollOffset() + offset, VIEW_MORE_ANIMATION_DURATION, 0);
    }

    return set;
}
 
Example #3
Source File: StackAnimationLandscape.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
protected ChromeAnimation<?> createReachTopAnimatorSet(StackTab[] tabs, float warpSize) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    float screenTarget = 0.0f;
    for (int i = 0; i < tabs.length; ++i) {
        if (screenTarget >= tabs[i].getLayoutTab().getX()) {
            break;
        }
        addAnimation(set, tabs[i], SCROLL_OFFSET, tabs[i].getScrollOffset(),
                StackTab.screenToScroll(screenTarget, warpSize), REACH_TOP_ANIMATION_DURATION,
                0);
        screenTarget += tabs[i].getLayoutTab().getScaledContentWidth();
    }

    return set;
}
 
Example #4
Source File: StackAnimationLandscape.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
protected ChromeAnimation<?> createReachTopAnimatorSet(StackTab[] tabs, float warpSize) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    float screenTarget = 0.0f;
    for (int i = 0; i < tabs.length; ++i) {
        if (screenTarget >= tabs[i].getLayoutTab().getX()) {
            break;
        }
        addAnimation(set, tabs[i], SCROLL_OFFSET, tabs[i].getScrollOffset(),
                StackTab.screenToScroll(screenTarget, warpSize), REACH_TOP_ANIMATION_DURATION,
                0);
        screenTarget += tabs[i].getLayoutTab().getScaledContentWidth();
    }

    return set;
}
 
Example #5
Source File: StackAnimationPortrait.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
protected ChromeAnimation<?> createViewMoreAnimatorSet(StackTab[] tabs, int selectedIndex) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    if (selectedIndex + 1 >= tabs.length) return set;

    float offset = tabs[selectedIndex].getScrollOffset()
            - tabs[selectedIndex + 1].getScrollOffset()
            + (tabs[selectedIndex].getLayoutTab().getScaledContentHeight()
                           * VIEW_MORE_SIZE_RATIO);
    offset = Math.max(VIEW_MORE_MIN_SIZE, offset);
    for (int i = selectedIndex + 1; i < tabs.length; ++i) {
        addAnimation(set, tabs[i], SCROLL_OFFSET, tabs[i].getScrollOffset(),
                tabs[i].getScrollOffset() + offset, VIEW_MORE_ANIMATION_DURATION, 0);
    }

    return set;
}
 
Example #6
Source File: StackAnimationLandscape.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
protected ChromeAnimation<?> createReachTopAnimatorSet(StackTab[] tabs, float warpSize) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    float screenTarget = 0.0f;
    for (int i = 0; i < tabs.length; ++i) {
        if (screenTarget >= tabs[i].getLayoutTab().getX()) {
            break;
        }
        addAnimation(set, tabs[i], SCROLL_OFFSET, tabs[i].getScrollOffset(),
                StackTab.screenToScroll(screenTarget, warpSize), REACH_TOP_ANIMATION_DURATION,
                0);
        screenTarget += tabs[i].getLayoutTab().getScaledContentWidth();
    }

    return set;
}
 
Example #7
Source File: StackAnimationLandscape.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
protected ChromeAnimation<?> createViewMoreAnimatorSet(StackTab[] tabs, int selectedIndex) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    if (selectedIndex + 1 >= tabs.length) return set;

    float offset = tabs[selectedIndex].getScrollOffset()
            - tabs[selectedIndex + 1].getScrollOffset()
            + (tabs[selectedIndex].getLayoutTab().getScaledContentWidth()
                           * VIEW_MORE_SIZE_RATIO);
    offset = Math.max(VIEW_MORE_MIN_SIZE, offset);
    for (int i = selectedIndex + 1; i < tabs.length; ++i) {
        addAnimation(set, tabs[i], SCROLL_OFFSET, tabs[i].getScrollOffset(),
                tabs[i].getScrollOffset() + offset, VIEW_MORE_ANIMATION_DURATION, 0);
    }

    return set;
}
 
Example #8
Source File: StackAnimation.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Responsible for generating the animations that shows a new tab being opened.
 *
 * @param tabs          The tabs that make up the stack.  These are the
 *                      tabs that will be affected by the TabSwitcherAnimation.
 * @param focusIndex    The focused index.  In this case, this is the index of
 *                      the tab that was just created.
 * @param discardRange  The maximum value the discard amount.
 * @return              The TabSwitcherAnimation instance that will tween the
 *                      tabs to create the appropriate animation.
 */
// TODO(dtrainor): Remove this after confirming nothing uses this.
protected ChromeAnimation<?> createNewTabOpenedAnimatorSet(
        StackTab[] tabs, int focusIndex, float discardRange) {
    if (focusIndex < 0 || focusIndex >= tabs.length) return null;
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    StackTab tab = tabs[focusIndex];
    tab.getLayoutTab().setVisible(false);
    tab.setXInStackInfluence(0.0f);
    tab.setYInStackInfluence(0.0f);
    tab.setDiscardFromClick(true);
    tab.setDiscardOriginX(tab.getLayoutTab().getOriginalContentWidth());
    tab.setDiscardOriginY(tab.getLayoutTab().getOriginalContentHeight() / 2.f);
    tab.getLayoutTab().setAlpha(0.0f);
    tab.getLayoutTab().setBorderAlpha(0.0f);
    addAnimation(set, tab, DISCARD_AMOUNT, getTabCreationDirection() * discardRange, 0.0f,
            TAB_OPENED_ANIMATION_DURATION, 0, false,
            ChromeAnimation.getAccelerateInterpolator());
    return set;
}
 
Example #9
Source File: StackAnimationPortrait.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
protected ChromeAnimation<?> createViewMoreAnimatorSet(StackTab[] tabs, int selectedIndex) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    if (selectedIndex + 1 >= tabs.length) return set;

    float offset = tabs[selectedIndex].getScrollOffset()
            - tabs[selectedIndex + 1].getScrollOffset()
            + (tabs[selectedIndex].getLayoutTab().getScaledContentHeight()
                           * VIEW_MORE_SIZE_RATIO);
    offset = Math.max(VIEW_MORE_MIN_SIZE, offset);
    for (int i = selectedIndex + 1; i < tabs.length; ++i) {
        addAnimation(set, tabs[i], SCROLL_OFFSET, tabs[i].getScrollOffset(),
                tabs[i].getScrollOffset() + offset, VIEW_MORE_ANIMATION_DURATION, 0);
    }

    return set;
}
 
Example #10
Source File: StackAnimation.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Responsible for generating the animations that shows a new tab being opened.
 *
 * @param tabs          The tabs that make up the stack.  These are the
 *                      tabs that will be affected by the TabSwitcherAnimation.
 * @param focusIndex    The focused index.  In this case, this is the index of
 *                      the tab that was just created.
 * @param discardRange  The maximum value the discard amount.
 * @return              The TabSwitcherAnimation instance that will tween the
 *                      tabs to create the appropriate animation.
 */
// TODO(dtrainor): Remove this after confirming nothing uses this.
protected ChromeAnimation<?> createNewTabOpenedAnimatorSet(
        StackTab[] tabs, int focusIndex, float discardRange) {
    if (focusIndex < 0 || focusIndex >= tabs.length) return null;
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    StackTab tab = tabs[focusIndex];
    tab.getLayoutTab().setVisible(false);
    tab.setXInStackInfluence(0.0f);
    tab.setYInStackInfluence(0.0f);
    tab.setDiscardFromClick(true);
    tab.setDiscardOriginX(tab.getLayoutTab().getOriginalContentWidth());
    tab.setDiscardOriginY(tab.getLayoutTab().getOriginalContentHeight() / 2.f);
    tab.getLayoutTab().setAlpha(0.0f);
    tab.getLayoutTab().setBorderAlpha(0.0f);
    addAnimation(set, tab, DISCARD_AMOUNT, getTabCreationDirection() * discardRange, 0.0f,
            TAB_OPENED_ANIMATION_DURATION, 0, false,
            ChromeAnimation.getAccelerateInterpolator());
    return set;
}
 
Example #11
Source File: StackAnimationPortrait.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
protected ChromeAnimation<?> createReachTopAnimatorSet(StackTab[] tabs, float warpSize) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    float screenTarget = 0.0f;
    for (int i = 0; i < tabs.length; ++i) {
        if (screenTarget >= tabs[i].getLayoutTab().getY()) {
            break;
        }
        addAnimation(set, tabs[i], SCROLL_OFFSET, tabs[i].getScrollOffset(),
                StackTab.screenToScroll(screenTarget, warpSize), REACH_TOP_ANIMATION_DURATION,
                0);
        screenTarget += tabs[i].getLayoutTab().getScaledContentHeight();
    }

    return set;
}
 
Example #12
Source File: StackAnimationPortrait.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
protected ChromeAnimation<?> createReachTopAnimatorSet(StackTab[] tabs, float warpSize) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    float screenTarget = 0.0f;
    for (int i = 0; i < tabs.length; ++i) {
        if (screenTarget >= tabs[i].getLayoutTab().getY()) {
            break;
        }
        addAnimation(set, tabs[i], SCROLL_OFFSET, tabs[i].getScrollOffset(),
                StackTab.screenToScroll(screenTarget, warpSize), REACH_TOP_ANIMATION_DURATION,
                0);
        screenTarget += tabs[i].getLayoutTab().getScaledContentHeight();
    }

    return set;
}
 
Example #13
Source File: StackAnimationPortrait.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
protected ChromeAnimation<?> createViewMoreAnimatorSet(StackTab[] tabs, int selectedIndex) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    if (selectedIndex + 1 >= tabs.length) return set;

    float offset = tabs[selectedIndex].getScrollOffset()
            - tabs[selectedIndex + 1].getScrollOffset()
            + (tabs[selectedIndex].getLayoutTab().getScaledContentHeight()
                           * VIEW_MORE_SIZE_RATIO);
    offset = Math.max(VIEW_MORE_MIN_SIZE, offset);
    for (int i = selectedIndex + 1; i < tabs.length; ++i) {
        addAnimation(set, tabs[i], SCROLL_OFFSET, tabs[i].getScrollOffset(),
                tabs[i].getScrollOffset() + offset, VIEW_MORE_ANIMATION_DURATION, 0);
    }

    return set;
}
 
Example #14
Source File: StackAnimation.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Responsible for generating the animations that flattens tabs when a pinch begins.
 *
 * @param tabs The tabs that make up the stack. These are the tabs that will
 *             be affected by the animations.
 * @return     The TabSwitcherAnimation instance that will tween the tabs to
 *             create the appropriate animation.
 */
protected ChromeAnimation<?> createStartPinchAnimatorSet(StackTab[] tabs) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    for (int i = 0; i < tabs.length; ++i) {
        addTiltScrollAnimation(
                set, tabs[i].getLayoutTab(), 0, START_PINCH_ANIMATION_DURATION, 0);
    }

    return set;
}
 
Example #15
Source File: StackAnimation.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Responsible for generating the animations that make all the tabs do a full roll.
 *
 * @param tabs The tabs that make up the stack. These are the tabs that will be affected by the
 *             animations.
 * @return     The TabSwitcherAnimation instance that will tween the tabs to create the
 *             appropriate animation.
 */
protected ChromeAnimation<?> createFullRollAnimatorSet(StackTab[] tabs) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    for (int i = 0; i < tabs.length; ++i) {
        LayoutTab layoutTab = tabs[i].getLayoutTab();
        // Set the pivot
        layoutTab.setTiltX(layoutTab.getTiltX(), layoutTab.getScaledContentHeight() / 2.0f);
        layoutTab.setTiltY(layoutTab.getTiltY(), layoutTab.getScaledContentWidth() / 2.0f);
        // Create the angle animation
        addTiltScrollAnimation(set, layoutTab, -360.0f, FULL_ROLL_ANIMATION_DURATION, 0);
    }

    return set;
}
 
Example #16
Source File: StackAnimation.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Responsible for generating the animations that make all the tabs do a full roll.
 *
 * @param tabs The tabs that make up the stack. These are the tabs that will be affected by the
 *             animations.
 * @return     The TabSwitcherAnimation instance that will tween the tabs to create the
 *             appropriate animation.
 */
protected ChromeAnimation<?> createFullRollAnimatorSet(StackTab[] tabs) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    for (int i = 0; i < tabs.length; ++i) {
        LayoutTab layoutTab = tabs[i].getLayoutTab();
        // Set the pivot
        layoutTab.setTiltX(layoutTab.getTiltX(), layoutTab.getScaledContentHeight() / 2.0f);
        layoutTab.setTiltY(layoutTab.getTiltY(), layoutTab.getScaledContentWidth() / 2.0f);
        // Create the angle animation
        addTiltScrollAnimation(set, layoutTab, -360.0f, FULL_ROLL_ANIMATION_DURATION, 0);
    }

    return set;
}
 
Example #17
Source File: StripLayoutTab.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void startAnimation(Animation<Animatable<?>> animation, boolean finishPrevious) {
    if (finishPrevious) finishAnimation();

    if (mContentAnimations == null) {
        mContentAnimations = new ChromeAnimation<Animatable<?>>();
    }

    mContentAnimations.add(animation);
}
 
Example #18
Source File: StripLayoutTab.java    From delion with Apache License 2.0 5 votes vote down vote up
private void startAnimation(Animation<Animatable<?>> animation, boolean finishPrevious) {
    if (finishPrevious) finishAnimation();

    if (mContentAnimations == null) {
        mContentAnimations = new ChromeAnimation<Animatable<?>>();
    }

    mContentAnimations.add(animation);
}
 
Example #19
Source File: Layout.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 #20
Source File: Layout.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 #21
Source File: StripLayoutHelper.java    From delion with Apache License 2.0 5 votes vote down vote up
private void startAnimation(Animation<Animatable<?>> animation, boolean finishPrevious) {
    if (finishPrevious) finishAnimation();

    if (mLayoutAnimations == null) {
        mLayoutAnimations = new ChromeAnimation<ChromeAnimation.Animatable<?>>();
    }

    mLayoutAnimations.add(animation);

    mUpdateHost.requestUpdate();
}
 
Example #22
Source File: StackAnimation.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Responsible for generating the animations that flattens tabs when a pinch begins.
 *
 * @param tabs The tabs that make up the stack. These are the tabs that will
 *             be affected by the animations.
 * @return     The TabSwitcherAnimation instance that will tween the tabs to
 *             create the appropriate animation.
 */
protected ChromeAnimation<?> createStartPinchAnimatorSet(StackTab[] tabs) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    for (int i = 0; i < tabs.length; ++i) {
        addTiltScrollAnimation(
                set, tabs[i].getLayoutTab(), 0, START_PINCH_ANIMATION_DURATION, 0);
    }

    return set;
}
 
Example #23
Source File: StripLayoutHelper.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void startAnimation(Animation<Animatable<?>> animation, boolean finishPrevious) {
    if (finishPrevious) finishAnimation();

    if (mLayoutAnimations == null) {
        mLayoutAnimations = new ChromeAnimation<ChromeAnimation.Animatable<?>>();
    }

    mLayoutAnimations.add(animation);

    mUpdateHost.requestUpdate();
}
 
Example #24
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 #25
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 #26
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 #27
Source File: StripLayoutHelper.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void startAnimation(Animation<Animatable<?>> animation, boolean finishPrevious) {
    if (finishPrevious) finishAnimation();

    if (mLayoutAnimations == null) {
        mLayoutAnimations = new ChromeAnimation<ChromeAnimation.Animatable<?>>();
    }

    mLayoutAnimations.add(animation);

    mUpdateHost.requestUpdate();
}
 
Example #28
Source File: StackAnimation.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Responsible for generating the animations that make all the tabs do a full roll.
 *
 * @param tabs The tabs that make up the stack. These are the tabs that will be affected by the
 *             animations.
 * @return     The TabSwitcherAnimation instance that will tween the tabs to create the
 *             appropriate animation.
 */
protected ChromeAnimation<?> createFullRollAnimatorSet(StackTab[] tabs) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    for (int i = 0; i < tabs.length; ++i) {
        LayoutTab layoutTab = tabs[i].getLayoutTab();
        // Set the pivot
        layoutTab.setTiltX(layoutTab.getTiltX(), layoutTab.getScaledContentHeight() / 2.0f);
        layoutTab.setTiltY(layoutTab.getTiltY(), layoutTab.getScaledContentWidth() / 2.0f);
        // Create the angle animation
        addTiltScrollAnimation(set, layoutTab, -360.0f, FULL_ROLL_ANIMATION_DURATION, 0);
    }

    return set;
}
 
Example #29
Source File: StackAnimation.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Responsible for generating the animations that flattens tabs when a pinch begins.
 *
 * @param tabs The tabs that make up the stack. These are the tabs that will
 *             be affected by the animations.
 * @return     The TabSwitcherAnimation instance that will tween the tabs to
 *             create the appropriate animation.
 */
protected ChromeAnimation<?> createStartPinchAnimatorSet(StackTab[] tabs) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();

    for (int i = 0; i < tabs.length; ++i) {
        addTiltScrollAnimation(
                set, tabs[i].getLayoutTab(), 0, START_PINCH_ANIMATION_DURATION, 0);
    }

    return set;
}
 
Example #30
Source File: Layout.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();
}