| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.toolbar; | 5 package org.chromium.chrome.browser.toolbar; |
| 6 | 6 |
| 7 import android.animation.Animator; | 7 import android.animation.Animator; |
| 8 import android.animation.AnimatorListenerAdapter; | 8 import android.animation.AnimatorListenerAdapter; |
| 9 import android.animation.AnimatorSet; | 9 import android.animation.AnimatorSet; |
| 10 import android.animation.ObjectAnimator; | 10 import android.animation.ObjectAnimator; |
| (...skipping 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1983 boolean useLightToolbarDrawables = | 1983 boolean useLightToolbarDrawables = |
| 1984 ColorUtils.shoudUseLightForegroundOnBackground(currentPrimar
yColor); | 1984 ColorUtils.shoudUseLightForegroundOnBackground(currentPrimar
yColor); |
| 1985 boolean unfocusedLocationBarUsesTransparentBg = | 1985 boolean unfocusedLocationBarUsesTransparentBg = |
| 1986 !ColorUtils.shouldUseOpaqueTextboxBackground(currentPrimaryC
olor); | 1986 !ColorUtils.shouldUseOpaqueTextboxBackground(currentPrimaryC
olor); |
| 1987 if (useLightToolbarDrawables != mUseLightToolbarDrawables | 1987 if (useLightToolbarDrawables != mUseLightToolbarDrawables |
| 1988 || unfocusedLocationBarUsesTransparentBg | 1988 || unfocusedLocationBarUsesTransparentBg |
| 1989 != mUnfocusedLocationBarUsesTransparentBg) { | 1989 != mUnfocusedLocationBarUsesTransparentBg) { |
| 1990 visualStateChanged = true; | 1990 visualStateChanged = true; |
| 1991 } else { | 1991 } else { |
| 1992 updateToolbarBackground(VisualState.BRAND_COLOR); | 1992 updateToolbarBackground(VisualState.BRAND_COLOR); |
| 1993 getProgressBar().setBackgroundColor( | 1993 getProgressBar().setThemeColor(currentPrimaryColor, isIncognito(
)); |
| 1994 ColorUtils.getLightProgressbarBackground(currentPrimaryC
olor)); | |
| 1995 } | 1994 } |
| 1996 } | 1995 } |
| 1997 | 1996 |
| 1998 mVisualState = newVisualState; | 1997 mVisualState = newVisualState; |
| 1999 | 1998 |
| 2000 updateOverlayDrawables(isInTabSwitcherMode); | 1999 updateOverlayDrawables(isInTabSwitcherMode); |
| 2001 updateShadowVisibility(isInTabSwitcherMode); | 2000 updateShadowVisibility(isInTabSwitcherMode); |
| 2002 if (!visualStateChanged) { | 2001 if (!visualStateChanged) { |
| 2003 if (mVisualState == VisualState.NEW_TAB_NORMAL) { | 2002 if (mVisualState == VisualState.NEW_TAB_NORMAL) { |
| 2004 updateNtpTransitionAnimation( | 2003 updateNtpTransitionAnimation( |
| 2005 getToolbarDataProvider().getNewTabPageForCurrentTab()); | 2004 getToolbarDataProvider().getNewTabPageForCurrentTab()); |
| 2006 } | 2005 } |
| 2007 return; | 2006 return; |
| 2008 } | 2007 } |
| 2009 | 2008 |
| 2010 mUseLightToolbarDrawables = false; | 2009 mUseLightToolbarDrawables = false; |
| 2011 mUnfocusedLocationBarUsesTransparentBg = false; | 2010 mUnfocusedLocationBarUsesTransparentBg = false; |
| 2012 mUrlBackgroundAlpha = 255; | 2011 mUrlBackgroundAlpha = 255; |
| 2013 int progressBarBackgroundColor = mProgressBackBackgroundColor; | |
| 2014 updateToolbarBackground(mVisualState); | 2012 updateToolbarBackground(mVisualState); |
| 2015 if (isInTabSwitcherMode) { | 2013 if (isInTabSwitcherMode) { |
| 2016 mUseLightToolbarDrawables = true; | 2014 mUseLightToolbarDrawables = true; |
| 2017 mUrlBackgroundAlpha = LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA; | 2015 mUrlBackgroundAlpha = LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA; |
| 2018 progressBarBackgroundColor = mProgressBackBackgroundColorWhite; | 2016 getProgressBar().setBackgroundColor(mProgressBackBackgroundColorWhit
e); |
| 2017 getProgressBar().setForegroundColor(ApiCompatibilityUtils.getColor(g
etResources(), |
| 2018 R.color.progress_bar_foreground_white)); |
| 2019 } else if (isIncognito()) { | 2019 } else if (isIncognito()) { |
| 2020 mUseLightToolbarDrawables = true; | 2020 mUseLightToolbarDrawables = true; |
| 2021 mUrlBackgroundAlpha = LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA; | 2021 mUrlBackgroundAlpha = LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA; |
| 2022 progressBarBackgroundColor = mProgressBackBackgroundColorWhite; | 2022 getProgressBar().setThemeColor(currentPrimaryColor, true); |
| 2023 } else if (mVisualState == VisualState.BRAND_COLOR) { | 2023 } else if (mVisualState == VisualState.BRAND_COLOR) { |
| 2024 mUseLightToolbarDrawables = | 2024 mUseLightToolbarDrawables = |
| 2025 ColorUtils.shoudUseLightForegroundOnBackground(currentPrimar
yColor); | 2025 ColorUtils.shoudUseLightForegroundOnBackground(currentPrimar
yColor); |
| 2026 mUnfocusedLocationBarUsesTransparentBg = | 2026 mUnfocusedLocationBarUsesTransparentBg = |
| 2027 !ColorUtils.shouldUseOpaqueTextboxBackground(currentPrimaryC
olor); | 2027 !ColorUtils.shouldUseOpaqueTextboxBackground(currentPrimaryC
olor); |
| 2028 mUrlBackgroundAlpha = mUnfocusedLocationBarUsesTransparentBg | 2028 mUrlBackgroundAlpha = mUnfocusedLocationBarUsesTransparentBg |
| 2029 ? LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA : 255; | 2029 ? LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA : 255; |
| 2030 progressBarBackgroundColor = | 2030 getProgressBar().setThemeColor(currentPrimaryColor, false); |
| 2031 ColorUtils.getLightProgressbarBackground(currentPrimaryColor
); | 2031 } else { |
| 2032 getProgressBar().setBackgroundColor(mProgressBackBackgroundColor); |
| 2033 getProgressBar().setForegroundColor(ApiCompatibilityUtils.getColor(g
etResources(), |
| 2034 R.color.progress_bar_foreground)); |
| 2032 } | 2035 } |
| 2033 | 2036 |
| 2034 getProgressBar().setBackgroundColor(progressBarBackgroundColor); | |
| 2035 int progressBarForegroundColor = ApiCompatibilityUtils.getColor(getResou
rces(), | |
| 2036 mUseLightToolbarDrawables | |
| 2037 ? R.color.progress_bar_foreground_white | |
| 2038 : R.color.progress_bar_foreground); | |
| 2039 getProgressBar().setForegroundColor(progressBarForegroundColor); | |
| 2040 | |
| 2041 if (mToggleTabStackButton != null) { | 2037 if (mToggleTabStackButton != null) { |
| 2042 mToggleTabStackButton.setImageDrawable(mUseLightToolbarDrawables | 2038 mToggleTabStackButton.setImageDrawable(mUseLightToolbarDrawables |
| 2043 ? mTabSwitcherButtonDrawableLight : mTabSwitcherButtonDrawab
le); | 2039 ? mTabSwitcherButtonDrawableLight : mTabSwitcherButtonDrawab
le); |
| 2044 if (mTabSwitcherAnimationTabStackDrawable != null) { | 2040 if (mTabSwitcherAnimationTabStackDrawable != null) { |
| 2045 mTabSwitcherAnimationTabStackDrawable.setTint( | 2041 mTabSwitcherAnimationTabStackDrawable.setTint( |
| 2046 mUseLightToolbarDrawables ? mLightModeTint : mDarkModeTi
nt); | 2042 mUseLightToolbarDrawables ? mLightModeTint : mDarkModeTi
nt); |
| 2047 } | 2043 } |
| 2048 } | 2044 } |
| 2049 | 2045 |
| 2050 if (shouldShowMenuButton()) { | 2046 if (shouldShowMenuButton()) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2208 }); | 2204 }); |
| 2209 | 2205 |
| 2210 if (mFullscreenManager != null) { | 2206 if (mFullscreenManager != null) { |
| 2211 mFullscreenCalloutToken = | 2207 mFullscreenCalloutToken = |
| 2212 mFullscreenManager.showControlsPersistentAndClearOldToken( | 2208 mFullscreenManager.showControlsPersistentAndClearOldToken( |
| 2213 mFullscreenCalloutToken); | 2209 mFullscreenCalloutToken); |
| 2214 } | 2210 } |
| 2215 } | 2211 } |
| 2216 } | 2212 } |
| 2217 | 2213 |
| OLD | NEW |