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 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1979 && isVisualStateValidForBrandColorTransition(mVisualState) | 1979 && isVisualStateValidForBrandColorTransition(mVisualState) |
1980 && isVisualStateValidForBrandColorTransition(newVisualState)) { | 1980 && isVisualStateValidForBrandColorTransition(newVisualState)) { |
1981 return; | 1981 return; |
1982 } else if (mBrandColorTransitionAnimation != null | 1982 } else if (mBrandColorTransitionAnimation != null |
1983 && mBrandColorTransitionAnimation.isRunning()) { | 1983 && mBrandColorTransitionAnimation.isRunning()) { |
1984 mBrandColorTransitionAnimation.cancel(); | 1984 mBrandColorTransitionAnimation.cancel(); |
1985 } | 1985 } |
1986 | 1986 |
1987 boolean visualStateChanged = mVisualState != newVisualState; | 1987 boolean visualStateChanged = mVisualState != newVisualState; |
1988 | 1988 |
1989 boolean isNativePage = false; | |
1990 if (getToolbarDataProvider() != null && getToolbarDataProvider().getTab( ) != null) { | |
1991 isNativePage = getToolbarDataProvider().getTab().isNativePage(); | |
1992 } | |
1993 | |
1989 int currentPrimaryColor = getToolbarDataProvider().getPrimaryColor(); | 1994 int currentPrimaryColor = getToolbarDataProvider().getPrimaryColor(); |
1990 if (mVisualState == VisualState.BRAND_COLOR && !visualStateChanged) { | 1995 if (mVisualState == VisualState.BRAND_COLOR && !visualStateChanged) { |
1991 boolean useLightToolbarDrawables = | 1996 boolean useLightToolbarDrawables = |
1992 ColorUtils.shouldUseLightForegroundOnBackground(currentPrima ryColor); | 1997 ColorUtils.shouldUseLightForegroundOnBackground(currentPrima ryColor); |
1993 boolean unfocusedLocationBarUsesTransparentBg = | 1998 boolean unfocusedLocationBarUsesTransparentBg = |
1994 !ColorUtils.shouldUseOpaqueTextboxBackground(currentPrimaryC olor); | 1999 !ColorUtils.shouldUseOpaqueTextboxBackground(currentPrimaryC olor); |
1995 if (useLightToolbarDrawables != mUseLightToolbarDrawables | 2000 if (useLightToolbarDrawables != mUseLightToolbarDrawables |
1996 || unfocusedLocationBarUsesTransparentBg | 2001 || unfocusedLocationBarUsesTransparentBg |
1997 != mUnfocusedLocationBarUsesTransparentBg) { | 2002 != mUnfocusedLocationBarUsesTransparentBg) { |
1998 visualStateChanged = true; | 2003 visualStateChanged = true; |
1999 } else { | 2004 } else { |
2000 updateToolbarBackground(VisualState.BRAND_COLOR); | 2005 updateToolbarBackground(VisualState.BRAND_COLOR); |
2001 getProgressBar().setThemeColor(currentPrimaryColor, isIncognito( )); | 2006 getProgressBar().setThemeColor(currentPrimaryColor, isNativePage , isIncognito()); |
Ted C
2016/06/23 00:00:12
instead of adding a new param, could we just only
mdjones
2016/06/23 19:04:27
Isolated to a single file but used a slightly diff
| |
2002 } | 2007 } |
2003 } | 2008 } |
2004 | 2009 |
2005 mVisualState = newVisualState; | 2010 mVisualState = newVisualState; |
2006 | 2011 |
2007 updateOverlayDrawables(isInTabSwitcherMode); | 2012 updateOverlayDrawables(isInTabSwitcherMode); |
2008 updateShadowVisibility(isInTabSwitcherMode); | 2013 updateShadowVisibility(isInTabSwitcherMode); |
2009 if (!visualStateChanged) { | 2014 if (!visualStateChanged) { |
2010 if (mVisualState == VisualState.NEW_TAB_NORMAL) { | 2015 if (mVisualState == VisualState.NEW_TAB_NORMAL) { |
2011 updateNtpTransitionAnimation( | 2016 updateNtpTransitionAnimation( |
2012 getToolbarDataProvider().getNewTabPageForCurrentTab()); | 2017 getToolbarDataProvider().getNewTabPageForCurrentTab()); |
2013 } | 2018 } |
2014 return; | 2019 return; |
2015 } | 2020 } |
2016 | 2021 |
2017 mUseLightToolbarDrawables = false; | 2022 mUseLightToolbarDrawables = false; |
2018 mUnfocusedLocationBarUsesTransparentBg = false; | 2023 mUnfocusedLocationBarUsesTransparentBg = false; |
2019 mUrlBackgroundAlpha = 255; | 2024 mUrlBackgroundAlpha = 255; |
2020 updateToolbarBackground(mVisualState); | 2025 updateToolbarBackground(mVisualState); |
2021 getProgressBar().setThemeColor(currentPrimaryColor, isIncognito()); | 2026 getProgressBar().setThemeColor(currentPrimaryColor, isNativePage, isInco gnito()); |
2022 | 2027 |
2023 if (isInTabSwitcherMode) { | 2028 if (isInTabSwitcherMode) { |
2024 mUseLightToolbarDrawables = true; | 2029 mUseLightToolbarDrawables = true; |
2025 mUrlBackgroundAlpha = LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA; | 2030 mUrlBackgroundAlpha = LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA; |
2026 getProgressBar().setBackgroundColor(mProgressBackBackgroundColorWhit e); | 2031 getProgressBar().setBackgroundColor(mProgressBackBackgroundColorWhit e); |
2027 getProgressBar().setForegroundColor(ApiCompatibilityUtils.getColor(g etResources(), | 2032 getProgressBar().setForegroundColor(ApiCompatibilityUtils.getColor(g etResources(), |
2028 R.color.progress_bar_foreground_white)); | 2033 R.color.progress_bar_foreground_white)); |
2029 } else if (isIncognito()) { | 2034 } else if (isIncognito()) { |
2030 mUseLightToolbarDrawables = true; | 2035 mUseLightToolbarDrawables = true; |
2031 mUrlBackgroundAlpha = LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA; | 2036 mUrlBackgroundAlpha = LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2209 }); | 2214 }); |
2210 | 2215 |
2211 if (mFullscreenManager != null) { | 2216 if (mFullscreenManager != null) { |
2212 mFullscreenCalloutToken = | 2217 mFullscreenCalloutToken = |
2213 mFullscreenManager.showControlsPersistentAndClearOldToken( | 2218 mFullscreenManager.showControlsPersistentAndClearOldToken( |
2214 mFullscreenCalloutToken); | 2219 mFullscreenCalloutToken); |
2215 } | 2220 } |
2216 } | 2221 } |
2217 } | 2222 } |
2218 | 2223 |
OLD | NEW |