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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomButtonParams.java

Issue 1568813002: Let clients update icons for buttons on bottombar through service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bottom_bar
Patch Set: tag->id Created 4 years, 11 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomButtonParams.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomButtonParams.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomButtonParams.java
index 7258e57a0040a2c9dbf6236cffed3bc78ac28629..aa28292dca9e3f77557dda742043b40e68bd6bc6 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomButtonParams.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomButtonParams.java
@@ -106,7 +106,7 @@ class CustomButtonParams {
/**
* Builds an {@link ImageButton} from the data in this params. Generated buttons should be
- * placed on the bottom bar.
+ * placed on the bottom bar. The button's tag will be its id.
* @param parent The parent that the inflated {@link ImageButton}.
* @return Parsed list of {@link CustomButtonParams}, which is empty if the input is invalid.
*/
@@ -115,6 +115,7 @@ class CustomButtonParams {
ImageButton button = (ImageButton) LayoutInflater.from(context)
.inflate(R.layout.custom_tabs_bottombar_item, parent, false);
+ button.setId(mId);
button.setImageBitmap(mIcon);
button.setContentDescription(mDescription);
if (mPendingIntent == null) {
@@ -239,11 +240,14 @@ class CustomButtonParams {
return description;
}
- private static boolean doesIconFitToolbar(Context context, Bitmap bitmap) {
+ /**
+ * @return Whether the given icon's size is suitable to put on toolbar.
+ */
+ static boolean doesIconFitToolbar(Context context, Bitmap bitmap) {
int height = context.getResources().getDimensionPixelSize(R.dimen.toolbar_icon_height);
if (bitmap.getHeight() < height) return false;
int scaledWidth = bitmap.getWidth() / bitmap.getHeight() * height;
if (scaledWidth > 2 * height) return false;
return true;
}
-}
+}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698