Commit bf930470 authored by Pedro Amaral's avatar Pedro Amaral Committed by Commit Bot

Don't show top toolbar items when bottom toolbar is enabled

The original CL for this (https://chromium-review.googlesource.com/1105569)
was reverted because of a null pointer bug. This CL does the same thing
as the reverted CL and fixes the null pointer exception by having
ToolbarManager#getMenuButton() return the bottom toolbar menu button when
the bottom toolbar is enabled.

Bug: 852117

Change-Id: Ic2668a3cac6a552bee4476d1cfb58f8e6c290bfd
Reviewed-on: https://chromium-review.googlesource.com/1135776Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Pedro Amaral <amaralp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575372}
parent e5eea8bd
...@@ -143,6 +143,10 @@ public class BottomToolbarCoordinator { ...@@ -143,6 +143,10 @@ public class BottomToolbarCoordinator {
mMediator.setToolbarSwipeLayout(layout); mMediator.setToolbarSwipeLayout(layout);
} }
public View getMenuButton() {
return mMenuButton.getMenuButton();
}
/** /**
* Clean up any state when the bottom toolbar is destroyed. * Clean up any state when the bottom toolbar is destroyed.
*/ */
......
...@@ -54,4 +54,8 @@ class MenuButton extends FrameLayout { ...@@ -54,4 +54,8 @@ class MenuButton extends FrameLayout {
boolean isShowingAppMenuUpdateBadge() { boolean isShowingAppMenuUpdateBadge() {
return mUpdateBadgeView.getVisibility() == View.VISIBLE; return mUpdateBadgeView.getVisibility() == View.VISIBLE;
} }
View getMenuButton() {
return mMenuButtonView;
}
} }
...@@ -41,6 +41,7 @@ import org.chromium.chrome.browser.omnibox.UrlBarData; ...@@ -41,6 +41,7 @@ import org.chromium.chrome.browser.omnibox.UrlBarData;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.util.FeatureUtilities;
import org.chromium.chrome.browser.util.ViewUtils; import org.chromium.chrome.browser.util.ViewUtils;
import org.chromium.chrome.browser.widget.PulseDrawable; import org.chromium.chrome.browser.widget.PulseDrawable;
import org.chromium.chrome.browser.widget.ScrimView; import org.chromium.chrome.browser.widget.ScrimView;
...@@ -155,6 +156,12 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { ...@@ -155,6 +156,12 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar {
mMenuButton = (TintedImageButton) findViewById(R.id.menu_button); mMenuButton = (TintedImageButton) findViewById(R.id.menu_button);
mMenuBadge = (ImageView) findViewById(R.id.menu_badge); mMenuBadge = (ImageView) findViewById(R.id.menu_badge);
mMenuButtonWrapper = findViewById(R.id.menu_button_wrapper); mMenuButtonWrapper = findViewById(R.id.menu_button_wrapper);
if (FeatureUtilities.isBottomToolbarEnabled()) {
UiUtils.removeViewFromParent(mMenuButtonWrapper);
mMenuButtonWrapper = null;
mMenuButton = null;
mMenuBadge = null;
}
// Initialize the provider to an empty version to avoid null checking everywhere. // Initialize the provider to an empty version to avoid null checking everywhere.
mToolbarDataProvider = new ToolbarDataProvider() { mToolbarDataProvider = new ToolbarDataProvider() {
...@@ -271,9 +278,11 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { ...@@ -271,9 +278,11 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar {
mAppMenuButtonHelper = appMenuButtonHelper; mAppMenuButtonHelper = appMenuButtonHelper;
if (mMenuButton != null) {
mMenuButton.setOnTouchListener(mAppMenuButtonHelper); mMenuButton.setOnTouchListener(mAppMenuButtonHelper);
mMenuButton.setAccessibilityDelegate(mAppMenuButtonHelper); mMenuButton.setAccessibilityDelegate(mAppMenuButtonHelper);
} }
}
/** Notified that the menu was shown. */ /** Notified that the menu was shown. */
protected void onMenuShown() {} protected void onMenuShown() {}
...@@ -818,6 +827,7 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { ...@@ -818,6 +827,7 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar {
@Override @Override
public void removeAppMenuUpdateBadge(boolean animate) { public void removeAppMenuUpdateBadge(boolean animate) {
if (mMenuBadge == null) return;
boolean wasShowingMenuBadge = mShowMenuBadge; boolean wasShowingMenuBadge = mShowMenuBadge;
mShowMenuBadge = false; mShowMenuBadge = false;
setMenuButtonContentDescription(false); setMenuButtonContentDescription(false);
...@@ -876,6 +886,7 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { ...@@ -876,6 +886,7 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar {
* bitmap. * bitmap.
*/ */
protected void setAppMenuUpdateBadgeToVisible(boolean animate) { protected void setAppMenuUpdateBadgeToVisible(boolean animate) {
if (mMenuBadge == null || mMenuButton == null) return;
setMenuButtonContentDescription(true); setMenuButtonContentDescription(true);
if (!animate || mIsMenuBadgeAnimationRunning) { if (!animate || mIsMenuBadgeAnimationRunning) {
mMenuBadge.setVisibility(View.VISIBLE); mMenuBadge.setVisibility(View.VISIBLE);
...@@ -920,6 +931,7 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { ...@@ -920,6 +931,7 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar {
* @param useLightDrawable Whether the light drawable should be used. * @param useLightDrawable Whether the light drawable should be used.
*/ */
protected void setAppMenuUpdateBadgeDrawable(boolean useLightDrawable) { protected void setAppMenuUpdateBadgeDrawable(boolean useLightDrawable) {
if (mMenuBadge == null) return;
mMenuBadge.setImageResource(useLightDrawable ? R.drawable.badge_update_light mMenuBadge.setImageResource(useLightDrawable ? R.drawable.badge_update_light
: R.drawable.badge_update_dark); : R.drawable.badge_update_dark);
} }
...@@ -931,7 +943,7 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { ...@@ -931,7 +943,7 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar {
*/ */
protected void setMenuButtonHighlightDrawable(boolean highlighting) { protected void setMenuButtonHighlightDrawable(boolean highlighting) {
// Return if onFinishInflate didn't finish // Return if onFinishInflate didn't finish
if (mMenuButtonWrapper == null) return; if (mMenuButtonWrapper == null || mMenuButton == null) return;
if (highlighting) { if (highlighting) {
if (mHighlightDrawable == null) { if (mHighlightDrawable == null) {
...@@ -953,6 +965,7 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { ...@@ -953,6 +965,7 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar {
* @param isUpdateBadgeVisible Whether the update menu badge is visible. * @param isUpdateBadgeVisible Whether the update menu badge is visible.
*/ */
protected void setMenuButtonContentDescription(boolean isUpdateBadgeVisible) { protected void setMenuButtonContentDescription(boolean isUpdateBadgeVisible) {
if (mMenuButton == null) return;
if (isUpdateBadgeVisible) { if (isUpdateBadgeVisible) {
mMenuButton.setContentDescription(getResources().getString( mMenuButton.setContentDescription(getResources().getString(
R.string.accessibility_toolbar_btn_menu_update)); R.string.accessibility_toolbar_btn_menu_update));
......
...@@ -866,6 +866,8 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe ...@@ -866,6 +866,8 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe
* @return The view containing the pop up menu button. * @return The view containing the pop up menu button.
*/ */
public View getMenuButton() { public View getMenuButton() {
if (mBottomToolbarCoordinator != null) return mBottomToolbarCoordinator.getMenuButton();
return mToolbar.getMenuButton(); return mToolbar.getMenuButton();
} }
...@@ -1313,8 +1315,10 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe ...@@ -1313,8 +1315,10 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe
updateReloadState(tabCrashed); updateReloadState(tabCrashed);
updateBookmarkButtonStatus(); updateBookmarkButtonStatus();
if (mToolbar.getMenuButtonWrapper() != null) {
mToolbar.getMenuButtonWrapper().setVisibility(View.VISIBLE); mToolbar.getMenuButtonWrapper().setVisibility(View.VISIBLE);
} }
}
private void updateBookmarkButtonStatus() { private void updateBookmarkButtonStatus() {
Tab currentTab = mToolbarModel.getTab(); Tab currentTab = mToolbarModel.getTab();
......
...@@ -83,6 +83,7 @@ import org.chromium.chrome.browser.widget.incognitotoggle.IncognitoToggleButton; ...@@ -83,6 +83,7 @@ import org.chromium.chrome.browser.widget.incognitotoggle.IncognitoToggleButton;
import org.chromium.chrome.browser.widget.newtab.NewTabButton; import org.chromium.chrome.browser.widget.newtab.NewTabButton;
import org.chromium.chrome.browser.widget.textbubble.TextBubble; import org.chromium.chrome.browser.widget.textbubble.TextBubble;
import org.chromium.components.feature_engagement.EventConstants; import org.chromium.components.feature_engagement.EventConstants;
import org.chromium.ui.UiUtils;
import org.chromium.ui.base.LocalizationUtils; import org.chromium.ui.base.LocalizationUtils;
import org.chromium.ui.interpolators.BakedBezierInterpolator; import org.chromium.ui.interpolators.BakedBezierInterpolator;
...@@ -375,6 +376,10 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -375,6 +376,10 @@ public class ToolbarPhone extends ToolbarLayout
mToolbarButtonsContainer = (ViewGroup) findViewById(R.id.toolbar_buttons); mToolbarButtonsContainer = (ViewGroup) findViewById(R.id.toolbar_buttons);
mHomeButton = (TintedImageButton) findViewById(R.id.home_button); mHomeButton = (TintedImageButton) findViewById(R.id.home_button);
if (FeatureUtilities.isBottomToolbarEnabled() && mHomeButton != null) {
UiUtils.removeViewFromParent(mHomeButton);
mHomeButton = null;
}
mUrlBar = (TextView) findViewById(R.id.url_bar); mUrlBar = (TextView) findViewById(R.id.url_bar);
...@@ -389,7 +394,7 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -389,7 +394,7 @@ public class ToolbarPhone extends ToolbarLayout
setLayoutTransition(null); setLayoutTransition(null);
getMenuButtonWrapper().setVisibility(View.VISIBLE); if (getMenuButtonWrapper() != null) getMenuButtonWrapper().setVisibility(View.VISIBLE);
inflateTabSwitchingResources(); inflateTabSwitchingResources();
setWillNotDraw(false); setWillNotDraw(false);
...@@ -464,14 +469,19 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -464,14 +469,19 @@ public class ToolbarPhone extends ToolbarLayout
private void inflateTabSwitchingResources() { private void inflateTabSwitchingResources() {
mToggleTabStackButton = (ImageView) findViewById(R.id.tab_switcher_button); mToggleTabStackButton = (ImageView) findViewById(R.id.tab_switcher_button);
mNewTabButton = (NewTabButton) findViewById(R.id.new_tab_button); if (FeatureUtilities.isBottomToolbarEnabled()) {
UiUtils.removeViewFromParent(mToggleTabStackButton);
mToggleTabStackButton = null;
} else {
mToggleTabStackButton.setClickable(false); mToggleTabStackButton.setClickable(false);
mTabSwitcherButtonDrawable = mTabSwitcherButtonDrawable =
TabSwitcherDrawable.createTabSwitcherDrawable(getContext(), false); TabSwitcherDrawable.createTabSwitcherDrawable(getContext(), false);
mTabSwitcherButtonDrawableLight = mTabSwitcherButtonDrawableLight =
TabSwitcherDrawable.createTabSwitcherDrawable(getContext(), true); TabSwitcherDrawable.createTabSwitcherDrawable(getContext(), true);
mToggleTabStackButton.setImageDrawable(mTabSwitcherButtonDrawable); mToggleTabStackButton.setImageDrawable(mTabSwitcherButtonDrawable);
}
mNewTabButton = (NewTabButton) findViewById(R.id.new_tab_button);
mTabSwitcherModeViews.add(mNewTabButton); mTabSwitcherModeViews.add(mNewTabButton);
// Ensure that the new tab button will not draw over the toolbar buttons if the // Ensure that the new tab button will not draw over the toolbar buttons if the
...@@ -491,6 +501,7 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -491,6 +501,7 @@ public class ToolbarPhone extends ToolbarLayout
} }
private void enableTabSwitchingResources() { private void enableTabSwitchingResources() {
if (mToggleTabStackButton != null) {
mToggleTabStackButton.setOnClickListener(this); mToggleTabStackButton.setOnClickListener(this);
mToggleTabStackButton.setOnLongClickListener(this); mToggleTabStackButton.setOnLongClickListener(this);
mToggleTabStackButton.setOnKeyListener(new KeyboardNavigationListener() { mToggleTabStackButton.setOnKeyListener(new KeyboardNavigationListener() {
...@@ -509,6 +520,7 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -509,6 +520,7 @@ public class ToolbarPhone extends ToolbarLayout
return findViewById(R.id.url_bar); return findViewById(R.id.url_bar);
} }
}); });
}
mNewTabButton.setOnClickListener(this); mNewTabButton.setOnClickListener(this);
mNewTabButton.setOnLongClickListener(this); mNewTabButton.setOnLongClickListener(this);
} }
...@@ -535,6 +547,7 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -535,6 +547,7 @@ public class ToolbarPhone extends ToolbarLayout
if (FeatureUtilities.isNewTabPageButtonEnabled()) changeIconToNTPIcon(mHomeButton); if (FeatureUtilities.isNewTabPageButtonEnabled()) changeIconToNTPIcon(mHomeButton);
} }
if (getMenuButton() != null)
getMenuButton().setOnKeyListener(new KeyboardNavigationListener() { getMenuButton().setOnKeyListener(new KeyboardNavigationListener() {
@Override @Override
public View getNextFocusForward() { public View getNextFocusForward() {
...@@ -1399,9 +1412,9 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -1399,9 +1412,9 @@ public class ToolbarPhone extends ToolbarLayout
} }
// Draw the menu button if necessary. // Draw the menu button if necessary.
if (!mShowMenuBadge && mTabSwitcherAnimationMenuDrawable != null
&& mUrlExpansionPercent != 1f) {
final TintedImageButton menuButton = getMenuButton(); final TintedImageButton menuButton = getMenuButton();
if (menuButton != null && !mShowMenuBadge && mTabSwitcherAnimationMenuDrawable != null
&& mUrlExpansionPercent != 1f) {
mTabSwitcherAnimationMenuDrawable.setBounds(menuButton.getPaddingLeft(), mTabSwitcherAnimationMenuDrawable.setBounds(menuButton.getPaddingLeft(),
menuButton.getPaddingTop(), menuButton.getPaddingTop(),
menuButton.getWidth() - menuButton.getPaddingRight(), menuButton.getWidth() - menuButton.getPaddingRight(),
...@@ -1419,8 +1432,10 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -1419,8 +1432,10 @@ public class ToolbarPhone extends ToolbarLayout
Drawable badgeDrawable = mUseLightDrawablesForTextureCapture Drawable badgeDrawable = mUseLightDrawablesForTextureCapture
? mTabSwitcherAnimationMenuBadgeLightDrawable ? mTabSwitcherAnimationMenuBadgeLightDrawable
: mTabSwitcherAnimationMenuBadgeDarkDrawable; : mTabSwitcherAnimationMenuBadgeDarkDrawable;
if (mShowMenuBadge && badgeDrawable != null && mUrlExpansionPercent != 1f) {
final View menuBadge = getMenuBadge(); final View menuBadge = getMenuBadge();
if (menuBadge != null && mShowMenuBadge && badgeDrawable != null
&& mUrlExpansionPercent != 1f) {
badgeDrawable.setBounds(menuBadge.getPaddingLeft(), menuBadge.getPaddingTop(), badgeDrawable.setBounds(menuBadge.getPaddingLeft(), menuBadge.getPaddingTop(),
menuBadge.getWidth() - menuBadge.getPaddingRight(), menuBadge.getWidth() - menuBadge.getPaddingRight(),
menuBadge.getHeight() - menuBadge.getPaddingBottom()); menuBadge.getHeight() - menuBadge.getPaddingBottom());
...@@ -1791,7 +1806,9 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -1791,7 +1806,9 @@ public class ToolbarPhone extends ToolbarLayout
// This is to deal with the view going invisible when resuming the activity and // This is to deal with the view going invisible when resuming the activity and
// running this animation. The view is still there and clickable but does not // running this animation. The view is still there and clickable but does not
// render and only a layout triggers a refresh. See crbug.com/306890. // render and only a layout triggers a refresh. See crbug.com/306890.
if (!mToggleTabStackButton.isEnabled()) requestLayout(); if (mToggleTabStackButton != null && !mToggleTabStackButton.isEnabled()) {
requestLayout();
}
} }
}); });
...@@ -1975,6 +1992,7 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -1975,6 +1992,7 @@ public class ToolbarPhone extends ToolbarLayout
* switcher mode. * switcher mode.
*/ */
private void updateTabSwitcherButtonRipple() { private void updateTabSwitcherButtonRipple() {
if (mToggleTabStackButton == null) return;
if (mTabSwitcherState == ENTERING_TAB_SWITCHER) { if (mTabSwitcherState == ENTERING_TAB_SWITCHER) {
mToggleTabStackButton.setBackgroundColor( mToggleTabStackButton.setBackgroundColor(
ApiCompatibilityUtils.getColor(getResources(), android.R.color.transparent)); ApiCompatibilityUtils.getColor(getResources(), android.R.color.transparent));
...@@ -2101,16 +2119,19 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -2101,16 +2119,19 @@ public class ToolbarPhone extends ToolbarLayout
float toolbarButtonTranslationX = MathUtils.flipSignIf( float toolbarButtonTranslationX = MathUtils.flipSignIf(
URL_FOCUS_TOOLBAR_BUTTONS_TRANSLATION_X_DP, isRtl) * density; URL_FOCUS_TOOLBAR_BUTTONS_TRANSLATION_X_DP, isRtl) * density;
final View menuButtonWrapper = getMenuButtonWrapper();
if (menuButtonWrapper != null) {
animator = ObjectAnimator.ofFloat( animator = ObjectAnimator.ofFloat(
getMenuButtonWrapper(), TRANSLATION_X, toolbarButtonTranslationX); menuButtonWrapper, TRANSLATION_X, toolbarButtonTranslationX);
animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS);
animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE);
animators.add(animator); animators.add(animator);
animator = ObjectAnimator.ofFloat(getMenuButtonWrapper(), ALPHA, 0); animator = ObjectAnimator.ofFloat(menuButtonWrapper, ALPHA, 0);
animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS);
animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE);
animators.add(animator); animators.add(animator);
}
if (mToggleTabStackButton != null) { if (mToggleTabStackButton != null) {
animator = ObjectAnimator.ofFloat( animator = ObjectAnimator.ofFloat(
...@@ -2139,17 +2160,20 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -2139,17 +2160,20 @@ public class ToolbarPhone extends ToolbarLayout
animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE);
animators.add(animator); animators.add(animator);
animator = ObjectAnimator.ofFloat(getMenuButtonWrapper(), TRANSLATION_X, 0); final View menuButtonWrapper = getMenuButtonWrapper();
if (menuButtonWrapper != null) {
animator = ObjectAnimator.ofFloat(menuButtonWrapper, TRANSLATION_X, 0);
animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS);
animator.setStartDelay(URL_CLEAR_FOCUS_MENU_DELAY_MS); animator.setStartDelay(URL_CLEAR_FOCUS_MENU_DELAY_MS);
animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE);
animators.add(animator); animators.add(animator);
animator = ObjectAnimator.ofFloat(getMenuButtonWrapper(), ALPHA, 1); animator = ObjectAnimator.ofFloat(menuButtonWrapper, ALPHA, 1);
animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS);
animator.setStartDelay(URL_CLEAR_FOCUS_MENU_DELAY_MS); animator.setStartDelay(URL_CLEAR_FOCUS_MENU_DELAY_MS);
animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE);
animators.add(animator); animators.add(animator);
}
if (mToggleTabStackButton != null) { if (mToggleTabStackButton != null) {
animator = ObjectAnimator.ofFloat(mToggleTabStackButton, TRANSLATION_X, 0); animator = ObjectAnimator.ofFloat(mToggleTabStackButton, TRANSLATION_X, 0);
...@@ -2644,7 +2668,10 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -2644,7 +2668,10 @@ public class ToolbarPhone extends ToolbarLayout
} }
} }
if (getMenuButton() != null) {
getMenuButton().setTint(mUseLightToolbarDrawables ? mLightModeTint : mDarkModeTint); getMenuButton().setTint(mUseLightToolbarDrawables ? mLightModeTint : mDarkModeTint);
}
if (mLocationBar.useModernDesign()) { if (mLocationBar.useModernDesign()) {
updateModernLocationBarColor(getLocationBarColorForToolbarColor(currentPrimaryColor)); updateModernLocationBarColor(getLocationBarColorForToolbarColor(currentPrimaryColor));
} }
...@@ -2687,7 +2714,9 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -2687,7 +2714,9 @@ public class ToolbarPhone extends ToolbarLayout
mNewTabButton.setContentDescription(newTabContentDescription); mNewTabButton.setContentDescription(newTabContentDescription);
} }
if (getMenuButtonWrapper() != null) {
getMenuButtonWrapper().setVisibility(View.VISIBLE); getMenuButtonWrapper().setVisibility(View.VISIBLE);
}
if (mLocationBar.useModernDesign()) { if (mLocationBar.useModernDesign()) {
DrawableCompat.setTint(mLocationBarBackground, DrawableCompat.setTint(mLocationBarBackground,
...@@ -2723,6 +2752,7 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -2723,6 +2752,7 @@ public class ToolbarPhone extends ToolbarLayout
@Override @Override
public void showAppMenuUpdateBadge() { public void showAppMenuUpdateBadge() {
if (getMenuBadge() == null) return;
super.showAppMenuUpdateBadge(); super.showAppMenuUpdateBadge();
// Set up variables. // Set up variables.
...@@ -2745,6 +2775,7 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -2745,6 +2775,7 @@ public class ToolbarPhone extends ToolbarLayout
@Override @Override
public void removeAppMenuUpdateBadge(boolean animate) { public void removeAppMenuUpdateBadge(boolean animate) {
if (getMenuBadge() == null) return;
super.removeAppMenuUpdateBadge(animate); super.removeAppMenuUpdateBadge(animate);
if (mBrowsingModeViews.contains(getMenuBadge())) { if (mBrowsingModeViews.contains(getMenuBadge())) {
......
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