org.chromium.chrome.browser.compositor.bottombar.OverlayPanelAnimation Java Examples

The following examples show how to use org.chromium.chrome.browser.compositor.bottombar.OverlayPanelAnimation. 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: ContextualSearchImageControl.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void animateCustomImageVisibility(boolean visible) {
    // If the panel is expanded then #onUpdateFromPeekToExpand() is responsible for setting
    // mCustomImageVisibility and the custom image appearance should not be animated.
    if (visible && mExpandedPercentage > 0.f) return;

    if (mCustomImageVisibilityInterpolator == null) {
        mCustomImageVisibilityInterpolator =
                PathInterpolatorCompat.create(0.4f, 0.f, 0.6f, 1.f);
    }

    mOverlayPanelAnimation.cancelAnimation(this, AnimationType.CUSTOM_IMAGE_VISIBILITY);

    float endValue = visible ? 1.f : 0.f;
    mOverlayPanelAnimation.addToAnimation(this, AnimationType.CUSTOM_IMAGE_VISIBILITY,
            mCustomImageVisibilityPercentage, endValue,
            OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0, false,
            mCustomImageVisibilityInterpolator);
}
 
Example #2
Source File: ContextualSearchBarControl.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Shows the touch highlight if it is not already visible.
 * @param x The x-position of the touch in px.
 */
private void showTouchHighlight(float x) {
    if (mTouchHighlightVisible) return;

    mWasTouchOnEndButton = isTouchOnEndButton(x);

    // If the panel is expanded or maximized and the panel content cannot be promoted to a new
    // tab, then tapping anywhere besides the end button does nothing. In this case, the touch
    // highlight should not be shown.
    if (!mWasTouchOnEndButton && !mOverlayPanel.isPeeking() && !mCanPromoteToNewTab) return;

    mWasDividerVisibleOnTouch = getDividerLineVisibilityPercentage() > 0.f;
    mTouchHighlightVisible = true;

    // The touch highlight animation is used to ensure the touch highlight is visible for at
    // least OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS.
    // TODO(twellington): Add a material ripple to this animation.
    mOverlayPanel.addToAnimation(this, AnimationType.TOUCH_HIGHLIGHT_VISIBILITY, 0.f, 1.f,
            OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0);
}
 
Example #3
Source File: ContextualSearchBarControl.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Shows the touch highlight if it is not already visible.
 * @param x The x-position of the touch in px.
 */
private void showTouchHighlight(float x) {
    if (mTouchHighlightVisible) return;

    mWasTouchOnEndButton = isTouchOnEndButton(x);

    // If the panel is expanded or maximized and the panel content cannot be promoted to a new
    // tab, then tapping anywhere besides the end button does nothing. In this case, the touch
    // highlight should not be shown.
    if (!mWasTouchOnEndButton && !mOverlayPanel.isPeeking() && !mCanPromoteToNewTab) return;

    mWasDividerVisibleOnTouch = getDividerLineVisibilityPercentage() > 0.f;
    mTouchHighlightVisible = true;

    // The touch highlight animation is used to ensure the touch highlight is visible for at
    // least OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS.
    // TODO(twellington): Add a material ripple to this animation.
    mOverlayPanel.addToAnimation(this, AnimationType.TOUCH_HIGHLIGHT_VISIBILITY, 0.f, 1.f,
            OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0);
}
 
Example #4
Source File: ContextualSearchImageControl.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void animateStaticImageVisibility(boolean visible) {
    // If the panel is expanded then #onUpdateFromPeekToExpand() is responsible for setting
    // mStaticImageVisibility and the static image appearance should not be animated.
    if (visible && mExpandedPercentage > 0.f) return;

    if (mStaticImageVisibilityInterpolator == null) {
        mStaticImageVisibilityInterpolator =
                PathInterpolatorCompat.create(0.4f, 0.f, 0.6f, 1.f);
    }

    mOverlayPanelAnimation.cancelAnimation(this, AnimationType.STATIC_IMAGE_VISIBILITY);

    float endValue = visible ? 1.f : 0.f;
    mOverlayPanelAnimation.addToAnimation(this, AnimationType.STATIC_IMAGE_VISIBILITY,
            mStaticImageVisibilityPercentage, endValue,
            OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0, false,
            mStaticImageVisibilityInterpolator);
}
 
Example #5
Source File: ContextualSearchIconSpriteControl.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Animates the appearance of the search provider icon sprite. This should be called after the
 * panel open animation has finished.
 */
public void animateApperance() {
    // The search provider icon sprite should be visible once the animation starts.
    mIsVisible = true;
    if (!mIsAnimationDisabledByTrial) {
        mPanel.addToAnimation(this, AnimationType.APPEARANCE, 0.f, 1.f,
                OverlayPanelAnimation.MAXIMUM_ANIMATION_DURATION_MS, 0);
    } else {
        mCompletionPercentage = 1.f;
    }
}
 
Example #6
Source File: ContextualSearchPromoControl.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Collapses the Promo in an animated fashion.
 */
public void collapse() {
    hidePromoView();

    mOverlayPanel.addToAnimation(this, AnimationType.COLLAPSE, 1.f, 0.f,
            OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0);
}
 
Example #7
Source File: ContextualSearchIconSpriteControl.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Animates the appearance of the search provider icon sprite. This should be called after the
 * panel open animation has finished.
 */
public void animateApperance() {
    // The search provider icon sprite should be visible once the animation starts.
    mIsVisible = true;
    mOverlayPanelAnimation.addToAnimation(this, AnimationType.APPEARANCE, 0.f, 1.f,
            OverlayPanelAnimation.MAXIMUM_ANIMATION_DURATION_MS, 0);
}
 
Example #8
Source File: ContextualSearchBarControl.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Animates the appearance or disappearance of the divider line.
 * @param visible Whether the divider line should be made visible.
 */
private void animateDividerLine(boolean visible) {
    float endValue = visible ? 1.f : 0.f;
    if (mDividerLineVisibilityPercentage == endValue) return;
    mOverlayPanel.addToAnimation(this, AnimationType.DIVIDER_LINE_VISIBILITY,
            mDividerLineVisibilityPercentage, endValue,
            OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0);
}
 
Example #9
Source File: ContextualSearchPromoControl.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Collapses the Promo in an animated fashion.
 */
public void collapse() {
    hidePromoView();

    mOverlayPanel.addToAnimation(this, AnimationType.COLLAPSE, 1.f, 0.f,
            OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0);
}
 
Example #10
Source File: ContextualSearchBarControl.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Animates the appearance or disappearance of the divider line.
 * @param visible Whether the divider line should be made visible.
 */
private void animateDividerLine(boolean visible) {
    float endValue = visible ? 1.f : 0.f;
    if (mDividerLineVisibilityPercentage == endValue) return;
    mOverlayPanel.addToAnimation(this, AnimationType.DIVIDER_LINE_VISIBILITY,
            mDividerLineVisibilityPercentage, endValue,
            OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0);
}
 
Example #11
Source File: ContextualSearchPromoControl.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Collapses the Promo in an animated fashion.
 */
public void collapse() {
    hidePromoView();

    mOverlayPanel.addToAnimation(this, AnimationType.COLLAPSE, 1.f, 0.f,
            OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0);
}
 
Example #12
Source File: ContextualSearchImageControl.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
public ContextualSearchImageControl(OverlayPanelAnimation overlayPanelAnimation,
        Context context) {
    mContext = context;
    mOverlayPanelAnimation = overlayPanelAnimation;
}
 
Example #13
Source File: ContextualSearchCaptionControl.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private void animateTransitionIn() {
    mOverlayPanel.addToAnimation(this, AnimationType.APPEARANCE, ANIMATION_PERCENTAGE_ZERO,
            ANIMATION_PERCENTAGE_COMPLETE, OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS,
            0, false, ANIMATION_INTERPOLATOR);
}
 
Example #14
Source File: ContextualSearchImageControl.java    From 365browser with Apache License 2.0 4 votes vote down vote up
public ContextualSearchImageControl(OverlayPanelAnimation overlayPanelAnimation,
        Context context) {
    mContext = context;
    mOverlayPanelAnimation = overlayPanelAnimation;
}
 
Example #15
Source File: ContextualSearchBarControl.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Animates the search term resolution.
 */
public void animateSearchTermResolution() {
    mOverlayPanel.addToAnimation(this, AnimationType.TEXT_OPACITY, 0.f, 1.f,
            OverlayPanelAnimation.MAXIMUM_ANIMATION_DURATION_MS, 0);
}
 
Example #16
Source File: ContextualSearchPeekPromoControl.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Animates the Peek Promo appearance.
 */
public void animateAppearance() {
    // TODO(pedrosimonetti): Find a generic way to tell when a specific animation finishes.
    mOverlayPanel.addToAnimation(this, AnimationType.APPEARANCE, 0.f, 1.f,
            OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0);
}
 
Example #17
Source File: ContextualSearchCaptionControl.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
private void animateTransitionIn() {
    mOverlayPanel.addToAnimation(this, AnimationType.APPEARANCE, ANIMATION_PERCENTAGE_ZERO,
            ANIMATION_PERCENTAGE_COMPLETE, OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS,
            0, false, ANIMATION_INTERPOLATOR);
}
 
Example #18
Source File: ContextualSearchBarControl.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Animates the search term resolution.
 */
public void animateSearchTermResolution() {
    mOverlayPanel.addToAnimation(this, AnimationType.TEXT_OPACITY, 0.f, 1.f,
            OverlayPanelAnimation.MAXIMUM_ANIMATION_DURATION_MS, 0);
}
 
Example #19
Source File: ContextualSearchIconSpriteControl.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * @param overlayPanelAnimation The OverlayPanelAnimation used to add animations.
 * @param context The Android Context used to retrieve resources.
 */
public ContextualSearchIconSpriteControl(OverlayPanelAnimation overlayPanelAnimation,
        Context context) {
    mOverlayPanelAnimation = overlayPanelAnimation;
}
 
Example #20
Source File: ContextualSearchPeekPromoControl.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Animates the Peek Promo appearance.
 */
public void animateAppearance() {
    // TODO(pedrosimonetti): Find a generic way to tell when a specific animation finishes.
    mOverlayPanel.addToAnimation(this, AnimationType.APPEARANCE, 0.f, 1.f,
            OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0);
}
 
Example #21
Source File: ContextualSearchBarControl.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Animates the search term resolution.
 */
public void animateSearchTermResolution() {
    mOverlayPanel.addToAnimation(this, AnimationType.TEXT_OPACITY, 0.f, 1.f,
            OverlayPanelAnimation.MAXIMUM_ANIMATION_DURATION_MS, 0);
}
 
Example #22
Source File: ContextualSearchPeekPromoControl.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Animates the Peek Promo appearance.
 */
public void animateAppearance() {
    // TODO(pedrosimonetti): Find a generic way to tell when a specific animation finishes.
    mOverlayPanel.addToAnimation(this, AnimationType.APPEARANCE, 0.f, 1.f,
            OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0);
}