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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java

Issue 2801153003: [Contextual Search] Add a handle to the bar when Chrome Home is enabled (Closed)
Patch Set: Created 3 years, 8 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/toolbar/BottomToolbarPhone.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java
index 4710a3418d8e74c2390fc95a98edc1a0ade6492e..725982127ebbb2e7924b3e80c3cd7f2e4cc5a10e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java
@@ -23,6 +23,8 @@ import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetMetrics;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetObserver;
import org.chromium.chrome.browser.widget.bottomsheet.EmptyBottomSheetObserver;
+import org.chromium.ui.resources.dynamics.BitmapDynamicResource;
+import org.chromium.ui.resources.dynamics.DynamicResourceLoader;
/**
* Phone specific toolbar that exists at the bottom of the screen.
@@ -85,6 +87,12 @@ public class BottomToolbarPhone extends ToolbarPhone {
/** The dark version of the toolbar handle; this is the default handle to use. */
private final Bitmap mHandleDark;
+ /**
+ * The resource id for the dark version of the toolbar handle; used to register a dynamic
+ * resource.
+ */
+ private int mHandleDarkResourceId;
+
/** A handle to the bottom sheet. */
private BottomSheet mBottomSheet;
@@ -355,4 +363,21 @@ public class BottomToolbarPhone extends ToolbarPhone {
otherToolbar.requestLayout();
}
+
+ /**
+ * Retrieve a resource id for the dark toolbar handle, registering it as a dynamic resource if
+ * it has not been previously registered.
+ * @param resourceLoader The {@link DynamicResourceLoader} used to register the handle bitmap.
+ * @return The resource id for the toolbar handle.
+ */
+ public int getHandleBitmapResourceId(DynamicResourceLoader resourceLoader) {
+ if (mHandleDarkResourceId == 0) {
+ mHandleDarkResourceId = ApiCompatibilityUtils.generateViewId();
+ BitmapDynamicResource handleDarkResource =
+ new BitmapDynamicResource(mHandleDarkResourceId);
+ handleDarkResource.setBitmap(mHandleDark);
+ resourceLoader.registerResource(mHandleDarkResourceId, handleDarkResource);
+ }
+ return mHandleDarkResourceId;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698