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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.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: Changes from reviews 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/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..91b53307072d4e5ceb052679374269b6d75cde1e 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,56 @@ abstract class ContextualSearchPanelBase extends ContextualSearchPanelStateHandl
}
// --------------------------------------------------------------------------------------------
+ // Search provider icon states
+ // --------------------------------------------------------------------------------------------
+
+ private static final int SEARCH_PROVIDER_ICON_LAST_SPRITE_FRAME = 22;
+
+ private boolean mShouldAnimateSearchProviderIcon;
+ private int mSearchProviderIconSpriteFrame;
+
+ /**
+ * @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) {
+ mSearchProviderIconSpriteFrame = 0;
+ } else {
+ mSearchProviderIconSpriteFrame = SEARCH_PROVIDER_ICON_LAST_SPRITE_FRAME;
+ }
+ mShouldAnimateSearchProviderIcon = shouldAnimateSearchProviderIcon;
+ }
+
+ public float getSearchProviderIconSpriteSize() {
+ return mContext.getResources().getDimension(R.dimen.contextual_search_sprite_size);
+ }
+
+ /**
+ * @return The sprite frame to display in the search provider icon sprite sheet. Sprites are
+ * numbered starting at 0.
+ */
+ public int getSearchProviderIconSpriteFrame() {
+ return mSearchProviderIconSpriteFrame;
+ }
+
+ /**
+ * Sets the sprite frame to display based on the completion percentage.
+ *
+ * @param percentage The completion percentage.
+ */
+ public void setSearchProviderIconAnimationCompletion(float percentage) {
+ mSearchProviderIconSpriteFrame =
+ (int) (percentage * SEARCH_PROVIDER_ICON_LAST_SPRITE_FRAME);
+ }
+
+ // --------------------------------------------------------------------------------------------
// Promo states
// --------------------------------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698