Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelAnimation.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelAnimation.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelAnimation.java |
| index c1ef52d91809d5eb5b8ea7c57dcc7348a6b33014..a1be53156e3ca9217697ef0b9d8d33dd8d17eaf4 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelAnimation.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelAnimation.java |
| @@ -29,7 +29,8 @@ public abstract class ContextualSearchPanelAnimation extends ContextualSearchPan |
| protected enum Property { |
| PANEL_HEIGHT, |
| PROMO_VISIBILITY, |
| - BOTTOM_BAR_TEXT_VISIBILITY |
| + BOTTOM_BAR_TEXT_VISIBILITY, |
| + SEARCH_PROVIDER_ICON_ANIMATION |
| } |
| /** |
| @@ -79,6 +80,11 @@ public abstract class ContextualSearchPanelAnimation extends ContextualSearchPan |
| private final LayoutUpdateHost mUpdateHost; |
| /** |
| + * Whether the panel's open animation is running. |
| + */ |
| + private boolean mIsAnimatingPanelOpen; |
| + |
| + /** |
| * Whether the panel's close animation is running. |
| */ |
| private boolean mIsAnimatingPanelClosing; |
| @@ -124,6 +130,7 @@ public abstract class ContextualSearchPanelAnimation extends ContextualSearchPan |
| * @param reason The reason for the change of panel state. |
| */ |
| protected void peekPanel(StateChangeReason reason) { |
| + mIsAnimatingPanelOpen = true; |
|
pedro (no code reviews)
2015/09/29 01:14:39
In theory, we could call peekPanel() from any stat
Theresa
2015/10/01 01:57:31
Acknowledged.
|
| // Indicate to the Compositor that for now on the Panel should be |
| // rendered, until it's closed. |
| startShowing(); |
| @@ -215,6 +222,17 @@ public abstract class ContextualSearchPanelAnimation extends ContextualSearchPan |
| } |
| /** |
| + * Animates the search provider icon. This should only be called once the panel open |
| + * animation has finished. |
| + */ |
| + private void animateSearchProviderIcon() { |
| + setIsSearchProviderIconSpriteVisible(true); |
| + float framesPerSecond = 30.f; |
| + float duration = (getSearchProviderIconSpriteFrameCount() / framesPerSecond) * 1000; |
|
pedro (no code reviews)
2015/09/29 01:14:39
Is there a spec for the duration of the G animatio
Theresa
2015/10/01 01:57:31
Per offline discussion, we're going with 350ms for
|
| + animateProperty(Property.SEARCH_PROVIDER_ICON_ANIMATION, 0.f, 1.f, (long) duration); |
| + } |
| + |
| + /** |
| * Animates the Panel to its nearest state. |
| */ |
| protected void animateToNearestState() { |
| @@ -367,6 +385,8 @@ public abstract class ContextualSearchPanelAnimation extends ContextualSearchPan |
| setPromoVisibilityForOptInAnimation(value); |
| } else if (prop == Property.BOTTOM_BAR_TEXT_VISIBILITY) { |
| updateBottomBarTextVisibility(value); |
| + } else if (prop == Property.SEARCH_PROVIDER_ICON_ANIMATION) { |
| + setSearchProviderIconAnimationCompletion(value); |
| } |
| } |
| @@ -414,6 +434,13 @@ public abstract class ContextualSearchPanelAnimation extends ContextualSearchPan |
| mIsAnimatingPanelClosing = false; |
| } |
| + if (mIsAnimatingPanelOpen) { |
|
pedro (no code reviews)
2015/09/29 01:14:39
Instead of using a boolean to determine if we're a
Theresa
2015/10/01 01:57:31
Done.
|
| + mIsAnimatingPanelOpen = false; |
| + if (shouldAnimateSearchProviderIconSprite()) { |
| + animateSearchProviderIcon(); |
| + } |
| + } |
| + |
| // If animating to a particular PanelState, and after completing |
| // resizing the Panel to its desired state, then the Panel's state |
| // should be updated. This method also is called when an animation |