Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java |
index d08874dbf6936e08edc6cdfe4a8ecb26cbb26151..4fbc5ac4e945f83cc96162af6fd08ec12d1e1510 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java |
@@ -760,6 +760,85 @@ abstract class ContextualSearchPanelBase extends ContextualSearchPanelStateHandl |
} |
// -------------------------------------------------------------------------------------------- |
+ // Search provider icon states |
+ // -------------------------------------------------------------------------------------------- |
+ |
+ // TODO(twellington): tweak these values once we have the final sprite sheets. |
+ protected static final int SEARCH_PROVIDER_ICON_FIRST_SPRITE_FRAME = 40; |
pedro (no code reviews)
2015/09/11 22:49:42
I would prefer not hardcoding the initial and fina
Theresa
2015/09/14 19:48:24
The last frame still needs to be hard coded. The s
|
+ protected static final int SEARCH_PROVIDER_ICON_LAST_SPRITE_FRAME = 67; |
+ private static final int SEARCH_PROVIDER_ICON_SPRITES_PER_ROW = 10; |
pedro (no code reviews)
2015/09/11 22:49:42
Instead of hardcoding the number of sprites per ro
Theresa
2015/09/14 19:48:24
Done.
|
+ private static final int SEARCH_PROVIDER_ICON_SPRITE_ROWS = 7; |
+ |
+ private boolean mIsSearchProviderIconVisible; |
+ private boolean mShouldAnimateSearchProviderIcon; |
+ private int mSearchProviderIconSpriteFrame; |
+ |
+ /** |
+ * @return Whether the search provider icon is visible. |
+ */ |
+ public boolean isSearchProviderIconVisible() { |
+ return mIsSearchProviderIconVisible; |
+ } |
+ |
+ /** |
+ * @param isSearchProviderIconVisible Whether the search provider icon should be visible. |
+ */ |
+ public void setIsSearchProviderIconVisible(boolean isSearchProviderIconVisible) { |
+ mIsSearchProviderIconVisible = isSearchProviderIconVisible; |
+ } |
+ |
+ /** |
+ * @return Whether the search provider icon should be animated. |
+ */ |
+ public boolean shouldAnimateSearchProviderIcon() { |
+ return mShouldAnimateSearchProviderIcon; |
+ } |
+ |
+ /** |
+ * @param shouldAnimateSearchProviderIcon Whether the search provider icon should be animated. |
+ */ |
+ public void setShouldAnimateSearchProviderIcon(boolean shouldAnimateSearchProviderIcon) { |
+ if (shouldAnimateSearchProviderIcon) { |
+ // The search provider icon should be hidden until the animation starts. |
+ setIsSearchProviderIconVisible(false); |
+ } else { |
+ setSearchProviderIconSpriteFrame(SEARCH_PROVIDER_ICON_LAST_SPRITE_FRAME); |
+ setIsSearchProviderIconVisible(true); |
+ } |
+ mShouldAnimateSearchProviderIcon = shouldAnimateSearchProviderIcon; |
+ } |
+ |
+ /** |
+ * @return The number of sprites in each row of the search provider icon sprite sheet. |
+ */ |
+ public int getSearchProviderIconSpritesPerRow() { |
+ return SEARCH_PROVIDER_ICON_SPRITES_PER_ROW; |
+ } |
+ |
+ /** |
+ * @return The number of rows in the search provider icon sprite sheet. |
+ */ |
+ public int getSearchProviderIconSpriteRows() { |
+ return SEARCH_PROVIDER_ICON_SPRITE_ROWS; |
+ } |
+ |
+ /** |
+ * @return The sprite frame to display in the search provider icon sprite sheet. Sprites are |
+ * numbered starting at 0. |
+ */ |
+ public int getSearchProviderIconSpriteFrame() { |
+ return mSearchProviderIconSpriteFrame; |
+ } |
+ |
+ /** |
+ * @param spriteFrame The sprite frame to display in the search provider icon sprite sheet. |
+ * Sprites are numbered starting at 0. |
+ */ |
+ public void setSearchProviderIconSpriteFrame(int spriteFrame) { |
pedro (no code reviews)
2015/09/11 22:49:42
As stated in the comment on the ContextualSearchPa
Theresa
2015/09/14 19:48:24
I changed this to a percentage and am passing the
|
+ mSearchProviderIconSpriteFrame = spriteFrame; |
+ } |
+ |
+ // -------------------------------------------------------------------------------------------- |
// Promo states |
// -------------------------------------------------------------------------------------------- |