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

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

Issue 1305253006: [Custom Tabs]Add API for updating action button as ContentProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 cbf639e3c542072cd6bdd422e4932b9e7e6770aa..240f872d6eeeec558e51bc1b18a141817d408874 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
@@ -133,7 +133,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();
@@ -154,6 +154,7 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
mCustomActionButton.setContentDescription(description);
mCustomActionButton.setOnClickListener(listener);
mCustomActionButton.setVisibility(VISIBLE);
+ updateButtonsTint();
}
/**
@@ -270,15 +271,7 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
public void updateVisualsForState() {
Resources resources = getResources();
updateSecurityIcon(getSecurityLevel());
- ColorStateList colorStateList = resources.getColorStateList(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 ? resources.getColor(R.color.url_emphasis_default_text)
@@ -293,6 +286,19 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
}
}
+ private void updateButtonsTint() {
+ Resources resources = getResources();
+ ColorStateList colorStateList = resources.getColorStateList(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