Commit 8438c4f9 authored by Peter E Conn's avatar Peter E Conn Committed by Commit Bot

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

This reverts commit e83d1f12.

Reason for revert: https://crbug.com/857437

Essentially, as well as adding if statements to all usages of mMenuButton within the class, you need to add if statements to all other classes calling 'getMenuButton()' (and ToolbarManager.getMenuButton() transitively).

Unfortunately this isn't so trivial for all the cases (eg, I'm guessing we still want to show the data saver when this feature is enabled, or the download text bubble?), so I'm reverting instead of attempting and TBRing a fix myself. Sorry!

Original change's description:
> Don't show top toolbar items when bottom toolbar is enabled
> 
> Remove the top toolbar buttons (home, tab switcher, and menu buttons)
> from their parent view and set them to null. Also add a bunch of
> null checks since now things can be null.
> 
> Bug: 852117
> Change-Id: I620f35f81388d1f4ac8791a9eb45576566474604
> Reviewed-on: https://chromium-review.googlesource.com/1105569
> Commit-Queue: Pedro Amaral <amaralp@chromium.org>
> Reviewed-by: Ted Choc <tedchoc@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#570578}

TBR=tedchoc@chromium.org,amaralp@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 852117
Change-Id: I2c16533f8dec11c5d11b920693157735e7438e89
Reviewed-on: https://chromium-review.googlesource.com/1124579
Commit-Queue: Peter Conn <peconn@chromium.org>
Reviewed-by: default avatarPeter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572193}
parent 4daf08d0
...@@ -23,7 +23,6 @@ import android.util.AttributeSet; ...@@ -23,7 +23,6 @@ import android.util.AttributeSet;
import android.view.InputDevice; import android.view.InputDevice;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -42,7 +41,6 @@ import org.chromium.chrome.browser.omnibox.UrlBarData; ...@@ -42,7 +41,6 @@ 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;
...@@ -157,12 +155,6 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { ...@@ -157,12 +155,6 @@ 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()) {
if (mMenuButtonWrapper != null) 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() {
...@@ -279,10 +271,8 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { ...@@ -279,10 +271,8 @@ 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. */
...@@ -828,7 +818,6 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { ...@@ -828,7 +818,6 @@ 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);
...@@ -887,7 +876,6 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { ...@@ -887,7 +876,6 @@ 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);
...@@ -932,7 +920,6 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { ...@@ -932,7 +920,6 @@ 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);
} }
...@@ -944,7 +931,7 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { ...@@ -944,7 +931,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 || mMenuButton == null) return; if (mMenuButtonWrapper == null) return;
if (highlighting) { if (highlighting) {
if (mHighlightDrawable == null) { if (mHighlightDrawable == null) {
...@@ -966,7 +953,6 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { ...@@ -966,7 +953,6 @@ 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));
......
...@@ -1261,9 +1261,7 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe ...@@ -1261,9 +1261,7 @@ 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() {
......
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