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..e0df5be491e69f16a3ab4bcc2eadb85bd27dff9e 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 |
@@ -60,9 +60,11 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar, |
private ImageButton mCustomActionButton; |
private int mSecurityIconType; |
private boolean mShouldShowTitle; |
- private boolean mUseDarkColors; |
private ImageButton mCloseButton; |
+ // Whether dark tint should be applied to icons and text. |
+ private boolean mUseDarkColors; |
+ |
private CustomTabToolbarAnimationDelegate mAnimDelegate; |
private boolean mBackgroundColorSet; |
@@ -293,10 +295,17 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar, |
mTitleBar.setTextColor(titleTextColor); |
if (getProgressBar() != null) { |
- int progressBarBackgroundColorResource = mUseDarkColors |
- ? R.color.progress_bar_background : R.color.progress_bar_background_white; |
- getProgressBar().setBackgroundColor( |
- ApiCompatibilityUtils.getColor(resources, progressBarBackgroundColorResource)); |
+ if (mBackgroundColorSet && !mUseDarkColors) { |
+ getProgressBar().setBackgroundColor(ColorUtils |
+ .getLightProgressbarBackground(getToolbarDataProvider().getPrimaryColor())); |
+ getProgressBar().setForegroundColor(ApiCompatibilityUtils.getColor(resources, |
+ R.color.progress_bar_foreground_white)); |
+ } else { |
+ int progressBarBackgroundColorResource = mUseDarkColors |
+ ? R.color.progress_bar_background : R.color.progress_bar_background_white; |
+ getProgressBar().setBackgroundColor(ApiCompatibilityUtils.getColor(resources, |
+ progressBarBackgroundColorResource)); |
Ted C
2015/09/21 20:00:39
ah...the visuals can never change for a custom tab
Ian Wen
2015/09/21 20:44:47
Yes, the background color of the toolbar won't cha
|
+ } |
} |
} |
@@ -371,11 +380,11 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar, |
@Override |
protected void onPrimaryColorChanged() { |
if (mBackgroundColorSet) return; |
+ mBackgroundColorSet = true; |
int primaryColor = getToolbarDataProvider().getPrimaryColor(); |
getBackground().setColor(primaryColor); |
mUseDarkColors = !ColorUtils.shoudUseLightForegroundOnBackground(primaryColor); |
updateVisualsForState(); |
- mBackgroundColorSet = true; |
} |
@Override |