Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1275)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelAnimation.java

Issue 1337703002: [Contextual Search] Add support for crushed sprites and animate the search provider icon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..07eb5e209b5f952aa1d9e81071af154cbff601bf 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_SPRITE_FRAME
pedro (no code reviews) 2015/09/11 22:49:42 SPRITE and FRAME and technical details we should c
Theresa 2015/09/14 19:48:24 Done.
}
/**
@@ -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,18 @@ 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() {
+ setIsSearchProviderIconVisible(true);
+ // TODO(twellington): tweak the duration once we have the final sprite sheets.
+ animateProperty(Property.SEARCH_PROVIDER_ICON_SPRITE_FRAME,
+ SEARCH_PROVIDER_ICON_FIRST_SPRITE_FRAME,
pedro (no code reviews) 2015/09/11 22:49:42 Similarly to the comment about the property name,
Theresa 2015/09/14 19:48:24 Done.
+ SEARCH_PROVIDER_ICON_LAST_SPRITE_FRAME, 500);
pedro (no code reviews) 2015/09/11 22:49:42 Let's confirm the exact duration for the animation
Theresa 2015/09/14 19:48:24 Acknowledged. I'll bring it up at the meeting toda
+ }
+
+ /**
* Animates the Panel to its nearest state.
*/
protected void animateToNearestState() {
@@ -367,6 +386,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_SPRITE_FRAME) {
+ setSearchProviderIconSpriteFrame((int) value);
pedro (no code reviews) 2015/09/11 22:49:42 For the reasons explained above, I think we should
Theresa 2015/09/14 19:48:24 Done.
}
}
@@ -414,6 +435,13 @@ public abstract class ContextualSearchPanelAnimation extends ContextualSearchPan
mIsAnimatingPanelClosing = false;
}
+ if (mIsAnimatingPanelOpen) {
+ mIsAnimatingPanelOpen = false;
+ if (shouldAnimateSearchProviderIcon()) {
+ 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

Powered by Google App Engine
This is Rietveld 408576698