Commit 227a972f authored by Matthew Jones's avatar Matthew Jones Committed by Commit Bot

Remove some obsolete code from ToolbarPhone

mTabSwitcherAnimationBgOverlay isn't actually drawn in ToolbarPhone
but we have a handfull of logic updating it. This patch removes this
logic.

Change-Id: I76dde8d6c187c82558908cd1b60fbe8fa70133c6
Reviewed-on: https://chromium-review.googlesource.com/1096394Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566437}
parent eed11942
......@@ -303,7 +303,6 @@ public class ToolbarPhone extends ToolbarLayout
}
protected VisualState mVisualState = VisualState.NORMAL;
private VisualState mOverlayDrawablesVisualState;
protected boolean mUseLightToolbarDrawables;
private NewTabPage mVisibleNewTabPage;
......@@ -377,8 +376,6 @@ public class ToolbarPhone extends ToolbarLayout
mToolbarBackground =
new ColorDrawable(getToolbarColorForVisualState(VisualState.NORMAL));
mTabSwitcherAnimationBgOverlay =
new ColorDrawable(getToolbarColorForVisualState(VisualState.NORMAL));
initLocationBarBackground();
......@@ -549,6 +546,7 @@ public class ToolbarPhone extends ToolbarLayout
if (mLocationBar.useModernDesign()) mNewTabButton.setIsModern();
setTabSwitcherAnimationMenuDrawable();
updateVisualsForToolbarState();
}
......@@ -694,14 +692,6 @@ public class ToolbarPhone extends ToolbarLayout
mUnfocusedLocationBarLayoutRight = rightViewBounds;
}
/**
* @return The background drawable for the fullscreen overlay.
*/
@VisibleForTesting
ColorDrawable getOverlayDrawable() {
return mTabSwitcherAnimationBgOverlay;
}
/**
* @return The background drawable for the toolbar view.
*/
......@@ -2009,35 +1999,6 @@ public class ToolbarPhone extends ToolbarLayout
}
}
private void updateOverlayDrawables() {
if (!isNativeLibraryReady()) return;
VisualState overlayState = computeVisualState(false);
boolean visualStateChanged = mOverlayDrawablesVisualState != overlayState;
if (!visualStateChanged && mVisualState == VisualState.BRAND_COLOR
&& getToolbarDataProvider().getPrimaryColor()
!= mTabSwitcherAnimationBgOverlay.getColor()) {
visualStateChanged = true;
}
if (!visualStateChanged) return;
mOverlayDrawablesVisualState = overlayState;
mTabSwitcherAnimationBgOverlay.setColor(getToolbarColorForVisualState(
mOverlayDrawablesVisualState));
setTabSwitcherAnimationMenuDrawable();
setUseLightDrawablesForTextureCapture();
if (mTabSwitcherState == STATIC_TAB && !mTextureCaptureMode && mLayoutUpdateHost != null) {
// Request a layout update to trigger a texture capture if the tint color is changing
// and we're not already in texture capture mode. This is necessary if the tab switcher
// is entered immediately after a change to the tint color without any user interactions
// that would normally trigger a texture capture.
mLayoutUpdateHost.requestUpdate();
}
}
@Override
public void destroy() {
dismissTabSwitcherCallout();
......@@ -2596,7 +2557,11 @@ public class ToolbarPhone extends ToolbarLayout
mVisualState = newVisualState;
updateOverlayDrawables();
// Refresh the toolbar texture.
if ((mVisualState == VisualState.BRAND_COLOR || visualStateChanged)
&& mLayoutUpdateHost != null) {
mLayoutUpdateHost.requestUpdate();
}
updateShadowVisibility();
updateUrlExpansionAnimation();
......@@ -2763,10 +2728,6 @@ public class ToolbarPhone extends ToolbarLayout
private void setTabSwitcherAnimationMenuDrawable() {
mTabSwitcherAnimationMenuDrawable = ApiCompatibilityUtils.getDrawable(
getResources(), R.drawable.ic_more_vert_black_24dp);
mTabSwitcherAnimationMenuDrawable.mutate();
mTabSwitcherAnimationMenuDrawable.setColorFilter(
isIncognito() ? mLightModeDefaultColor : mDarkModeDefaultColor,
PorterDuff.Mode.SRC_IN);
((BitmapDrawable) mTabSwitcherAnimationMenuDrawable).setGravity(Gravity.CENTER);
}
......
......@@ -85,13 +85,6 @@ public class BrandColorTest {
== mToolbar.getBackgroundDrawable().getColor();
}
});
CriteriaHelper.pollUiThread(
Criteria.equals(brandColor, new Callable<Integer>() {
@Override
public Integer call() {
return mToolbar.getOverlayDrawable().getColor();
}
}));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
&& !SysUtils.isLowEndDevice()) {
final int expectedStatusBarColor = brandColor == mDefaultColor
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment