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

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

Issue 1291083004: [Custom Tabs]Add API for updating action button in service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cr.->cr_ 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/toolbar/CustomTabToolbar.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java
index 13394f0a741e18645378e8fb714d884644918ad4..e5783f51b4315bd0a4868c1f28a26f06a20a7c53 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java
@@ -134,7 +134,7 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
}
@Override
- public void addCustomActionButton(Drawable drawable, String description,
+ public void setCustomActionButton(Drawable drawable, String description,
OnClickListener listener) {
Resources resources = getResources();
@@ -155,6 +155,7 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
mCustomActionButton.setContentDescription(description);
mCustomActionButton.setOnClickListener(listener);
mCustomActionButton.setVisibility(VISIBLE);
+ updateButtonsTint();
}
/**
@@ -275,15 +276,7 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
public void updateVisualsForState() {
Resources resources = getResources();
updateSecurityIcon(getSecurityLevel());
- ColorStateList colorStateList = ApiCompatibilityUtils.getColorStateList(resources,
- mUseDarkColors ? R.color.dark_mode_tint : R.color.light_mode_tint);
- mMenuButton.setTint(colorStateList);
- if (mCloseButton.getDrawable() instanceof TintedDrawable) {
- ((TintedDrawable) mCloseButton.getDrawable()).setTint(colorStateList);
- }
- if (mCustomActionButton.getDrawable() instanceof TintedDrawable) {
- ((TintedDrawable) mCustomActionButton.getDrawable()).setTint(colorStateList);
- }
+ updateButtonsTint();
mUrlBar.setUseDarkTextColors(mUseDarkColors);
int titleTextColor = mUseDarkColors
@@ -300,6 +293,19 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
}
}
+ private void updateButtonsTint() {
+ Resources resources = getResources();
+ ColorStateList colorStateList = ApiCompatibilityUtils.getColorStateList(resources,
+ mUseDarkColors ? R.color.dark_mode_tint : R.color.light_mode_tint);
+ mMenuButton.setTint(colorStateList);
+ if (mCloseButton.getDrawable() instanceof TintedDrawable) {
+ ((TintedDrawable) mCloseButton.getDrawable()).setTint(colorStateList);
+ }
+ if (mCustomActionButton.getDrawable() instanceof TintedDrawable) {
+ ((TintedDrawable) mCustomActionButton.getDrawable()).setTint(colorStateList);
+ }
+ }
+
@Override
public void setMenuButtonHelper(final AppMenuButtonHelper helper) {
mMenuButton.setOnTouchListener(new OnTouchListener() {

Powered by Google App Engine
This is Rietveld 408576698