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; |
// 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; |
+ 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) { |
+ 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 |