Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java

Issue 2229353003: Clean up document-mode specific UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 private TintedImageButton mHomeButton; 108 private TintedImageButton mHomeButton;
109 private TextView mUrlBar; 109 private TextView mUrlBar;
110 private View mUrlActionContainer; 110 private View mUrlActionContainer;
111 private ImageView mToolbarShadow; 111 private ImageView mToolbarShadow;
112 112
113 private final int mProgressBackBackgroundColorWhite; 113 private final int mProgressBackBackgroundColorWhite;
114 114
115 private ObjectAnimator mTabSwitcherModeAnimation; 115 private ObjectAnimator mTabSwitcherModeAnimation;
116 private ObjectAnimator mDelayedTabSwitcherModeAnimation; 116 private ObjectAnimator mDelayedTabSwitcherModeAnimation;
117 117
118 private final List<View> mTabSwitcherModeViews = new ArrayList<View>(); 118 private final List<View> mTabSwitcherModeViews = new ArrayList<>();
119 private final Set<View> mBrowsingModeViews = new HashSet<View>(); 119 private final Set<View> mBrowsingModeViews = new HashSet<>();
120 @ViewDebug.ExportedProperty(category = "chrome") 120 @ViewDebug.ExportedProperty(category = "chrome")
121 private boolean mIsInTabSwitcherMode; 121 private boolean mIsInTabSwitcherMode;
122 122
123 // This determines whether or not the toolbar draws as expected (false) or w hether it always 123 // This determines whether or not the toolbar draws as expected (false) or w hether it always
124 // draws as if it's showing the non-tabswitcher, non-animating toolbar. This is used in grabbing 124 // draws as if it's showing the non-tabswitcher, non-animating toolbar. This is used in grabbing
125 // a bitmap to use as a texture representation of this view. 125 // a bitmap to use as a texture representation of this view.
126 @ViewDebug.ExportedProperty(category = "chrome") 126 @ViewDebug.ExportedProperty(category = "chrome")
127 private boolean mTextureCaptureMode; 127 private boolean mTextureCaptureMode;
128 private boolean mForceTextureCapture; 128 private boolean mForceTextureCapture;
129 private boolean mUseLightDrawablesForTextureCapture; 129 private boolean mUseLightDrawablesForTextureCapture;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 329
330 mLocationBarBackground = 330 mLocationBarBackground =
331 ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.tex tbox); 331 ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.tex tbox);
332 mLocationBarBackground.getPadding(mLocationBarBackgroundPadding); 332 mLocationBarBackground.getPadding(mLocationBarBackgroundPadding);
333 mLocationBar.setPadding( 333 mLocationBar.setPadding(
334 mLocationBarBackgroundPadding.left, mLocationBarBackgroundPaddin g.top, 334 mLocationBarBackgroundPadding.left, mLocationBarBackgroundPaddin g.top,
335 mLocationBarBackgroundPadding.right, mLocationBarBackgroundPaddi ng.bottom); 335 mLocationBarBackgroundPadding.right, mLocationBarBackgroundPaddi ng.bottom);
336 336
337 setLayoutTransition(null); 337 setLayoutTransition(null);
338 338
339 mMenuButtonWrapper.setVisibility(shouldShowMenuButton() ? View.VISIBLE : View.GONE); 339 mMenuButtonWrapper.setVisibility(View.VISIBLE);
340 if (FeatureUtilities.isDocumentMode(getContext())) { 340 inflateTabSwitchingResources();
341 ApiCompatibilityUtils.setMarginEnd(
342 (MarginLayoutParams) mMenuButtonWrapper.getLayoutParams(),
343 getResources().getDimensionPixelSize(R.dimen.document_toolba r_menu_offset));
344 hideTabSwitchingResources();
345 } else {
346 inflateTabSwitchingResources();
347 }
348 341
349 setWillNotDraw(false); 342 setWillNotDraw(false);
350 } 343 }
351 344
352 private void inflateTabSwitchingResources() { 345 private void inflateTabSwitchingResources() {
353 mToggleTabStackButton = (ImageView) findViewById(R.id.tab_switcher_butto n); 346 mToggleTabStackButton = (ImageView) findViewById(R.id.tab_switcher_butto n);
354 mNewTabButton = (NewTabButton) findViewById(R.id.new_tab_button); 347 mNewTabButton = (NewTabButton) findViewById(R.id.new_tab_button);
355 348
356 mToggleTabStackButton.setClickable(false); 349 mToggleTabStackButton.setClickable(false);
357 Resources resources = getResources(); 350 Resources resources = getResources();
(...skipping 13 matching lines...) Expand all
371 wm.getDefaultDisplay().getSize(screenSize); 364 wm.getDefaultDisplay().getSize(screenSize);
372 365
373 mToolbarButtonsContainer.measure( 366 mToolbarButtonsContainer.measure(
374 MeasureSpec.makeMeasureSpec(screenSize.x, MeasureSpec.AT_MOST), 367 MeasureSpec.makeMeasureSpec(screenSize.x, MeasureSpec.AT_MOST),
375 MeasureSpec.makeMeasureSpec(screenSize.y, MeasureSpec.AT_MOST)); 368 MeasureSpec.makeMeasureSpec(screenSize.y, MeasureSpec.AT_MOST));
376 369
377 ApiCompatibilityUtils.setMarginEnd(getFrameLayoutParams(mNewTabButton), 370 ApiCompatibilityUtils.setMarginEnd(getFrameLayoutParams(mNewTabButton),
378 mToolbarButtonsContainer.getMeasuredWidth()); 371 mToolbarButtonsContainer.getMeasuredWidth());
379 } 372 }
380 373
381 private void hideTabSwitchingResources() {
382 ImageView toggleTabStackButton = (ImageView) findViewById(R.id.tab_switc her_button);
383 toggleTabStackButton.setVisibility(View.GONE);
384 // We don't need to hide new tab button since it's invisible by default.
385 }
386
387 private void unhideTabSwitchingResources() {
388 ImageView toggleTabStackButton = (ImageView) findViewById(R.id.tab_switc her_button);
389 toggleTabStackButton.setVisibility(View.VISIBLE);
390 }
391
392 private void enableTabSwitchingResources() { 374 private void enableTabSwitchingResources() {
393 mToggleTabStackButton.setOnClickListener(this); 375 mToggleTabStackButton.setOnClickListener(this);
394 mToggleTabStackButton.setOnLongClickListener(this); 376 mToggleTabStackButton.setOnLongClickListener(this);
395 mToggleTabStackButton.setOnKeyListener(new KeyboardNavigationListener() { 377 mToggleTabStackButton.setOnKeyListener(new KeyboardNavigationListener() {
396 @Override 378 @Override
397 public View getNextFocusForward() { 379 public View getNextFocusForward() {
398 if (mMenuButton != null && mMenuButton.isShown()) { 380 if (mMenuButton != null && mMenuButton.isShown()) {
399 return mMenuButton; 381 return mMenuButton;
400 } else { 382 } else {
401 return getCurrentTabView(); 383 return getCurrentTabView();
402 } 384 }
403 } 385 }
404 386
405 @Override 387 @Override
406 public View getNextFocusBackward() { 388 public View getNextFocusBackward() {
407 return findViewById(R.id.url_bar); 389 return findViewById(R.id.url_bar);
408 } 390 }
409 }); 391 });
410 mNewTabButton.setOnClickListener(this); 392 mNewTabButton.setOnClickListener(this);
411 } 393 }
412 394
413 private void removeTabSwitchingResources() {
414 ImageView toggleTabStackButton = (ImageView) findViewById(R.id.tab_switc her_button);
415 NewTabButton newTabButton = (NewTabButton) findViewById(R.id.new_tab_but ton);
416 assert mToolbarButtonsContainer.indexOfChild(toggleTabStackButton) >= 0;
417 mToolbarButtonsContainer.removeView(toggleTabStackButton);
418 assert indexOfChild(newTabButton) >= 0;
419 removeView(newTabButton);
420 }
421
422 @Override 395 @Override
423 protected boolean onMenuButtonTouchEvent(View v, MotionEvent event) { 396 protected boolean onMenuButtonTouchEvent(View v, MotionEvent event) {
424 dismissTabSwitcherCallout(); 397 dismissTabSwitcherCallout();
425 return super.onMenuButtonTouchEvent(v, event); 398 return super.onMenuButtonTouchEvent(v, event);
426 } 399 }
427 400
428 /** 401 /**
429 * Sets up click and key listeners once we have native library available to handle clicks. 402 * Sets up click and key listeners once we have native library available to handle clicks.
430 */ 403 */
431 @Override 404 @Override
432 public void onNativeLibraryReady() { 405 public void onNativeLibraryReady() {
433 super.onNativeLibraryReady(); 406 super.onNativeLibraryReady();
434 getLocationBar().onNativeLibraryReady(); 407 getLocationBar().onNativeLibraryReady();
435 408
436 if (FeatureUtilities.isDocumentMode(getContext())) { 409 enableTabSwitchingResources();
437 removeTabSwitchingResources();
438 } else { // non-document mode
439 enableTabSwitchingResources();
440 }
441 410
442 mHomeButton.setOnClickListener(this); 411 mHomeButton.setOnClickListener(this);
443 412
444 mMenuButton.setOnKeyListener(new KeyboardNavigationListener() { 413 mMenuButton.setOnKeyListener(new KeyboardNavigationListener() {
445 @Override 414 @Override
446 public View getNextFocusForward() { 415 public View getNextFocusForward() {
447 return getCurrentTabView(); 416 return getCurrentTabView();
448 } 417 }
449 418
450 @Override 419 @Override
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 int rightViewBounds = getViewBoundsRightOfLocationBar(mVisualState); 511 int rightViewBounds = getViewBoundsRightOfLocationBar(mVisualState);
543 512
544 if (!hasVisibleViewPriorToUrlBar) { 513 if (!hasVisibleViewPriorToUrlBar) {
545 if (ApiCompatibilityUtils.isLayoutRtl(mLocationBar)) { 514 if (ApiCompatibilityUtils.isLayoutRtl(mLocationBar)) {
546 rightViewBounds -= mToolbarSidePadding; 515 rightViewBounds -= mToolbarSidePadding;
547 } else { 516 } else {
548 leftViewBounds += mToolbarSidePadding; 517 leftViewBounds += mToolbarSidePadding;
549 } 518 }
550 } 519 }
551 520
552 if (!mLocationBar.hasVisibleViewsAfterUrlBarWhenUnfocused()) { 521 // Add spacing between the end of the URL and the edge of the omnibox dr awable.
553 // Add spacing between the end of the URL and the edge of the omnibo x drawable. 522 // This only applies if there is no end aligned view that should be visi ble
554 // This only applies if there is no end aligned view that should be visible 523 // while the omnibox is unfocused.
555 // while the omnibox is unfocused. 524 if (ApiCompatibilityUtils.isLayoutRtl(mLocationBar)) {
556 if (ApiCompatibilityUtils.isLayoutRtl(mLocationBar)) { 525 leftViewBounds += mToolbarSidePadding;
557 leftViewBounds += mToolbarSidePadding; 526 } else {
558 } else { 527 rightViewBounds -= mToolbarSidePadding;
559 rightViewBounds -= mToolbarSidePadding;
560 }
561 } 528 }
562 529
563 mUnfocusedLocationBarLayoutWidth = rightViewBounds - leftViewBounds; 530 mUnfocusedLocationBarLayoutWidth = rightViewBounds - leftViewBounds;
564 mUnfocusedLocationBarLayoutLeft = leftViewBounds; 531 mUnfocusedLocationBarLayoutLeft = leftViewBounds;
565 } 532 }
566 533
567 /** 534 /**
568 * @return The background drawable for the fullscreen overlay. 535 * @return The background drawable for the fullscreen overlay.
569 */ 536 */
570 @VisibleForTesting 537 @VisibleForTesting
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 - NTP_SEARCH_BOX_EXPANSION_INTERPOLATOR.getInterpolation(mUr lExpansionPercent); 913 - NTP_SEARCH_BOX_EXPANSION_INTERPOLATOR.getInterpolation(mUr lExpansionPercent);
947 } else { 914 } else {
948 // During the transition from middle of the NTP to the top, keep the omnibox drawing 915 // During the transition from middle of the NTP to the top, keep the omnibox drawing
949 // at the same size of the search box for first 40% of the scroll tr ansition. 916 // at the same size of the search box for first 40% of the scroll tr ansition.
950 shrinkage = Math.min(1f, (1f - mUrlExpansionPercent) * 1.66667f); 917 shrinkage = Math.min(1f, (1f - mUrlExpansionPercent) * 1.66667f);
951 } 918 }
952 919
953 int leftBoundDifference = mNtpSearchBoxBounds.left - mLocationBarBackgro undBounds.left; 920 int leftBoundDifference = mNtpSearchBoxBounds.left - mLocationBarBackgro undBounds.left;
954 int rightBoundDifference = mNtpSearchBoxBounds.right - mLocationBarBackg roundBounds.right; 921 int rightBoundDifference = mNtpSearchBoxBounds.right - mLocationBarBackg roundBounds.right;
955 mLocationBarBackgroundNtpOffset.set( 922 mLocationBarBackgroundNtpOffset.set(
956 (int) Math.round(leftBoundDifference * shrinkage), 923 Math.round(leftBoundDifference * shrinkage),
957 locationBarTranslationY, 924 locationBarTranslationY,
958 (int) Math.round(rightBoundDifference * shrinkage), 925 Math.round(rightBoundDifference * shrinkage),
959 locationBarTranslationY); 926 locationBarTranslationY);
960 927
961 // The omnibox background bounds are outset by |mLocationBarBackgroundCo rnerRadius| in the 928 // The omnibox background bounds are outset by |mLocationBarBackgroundCo rnerRadius| in the
962 // fully expanded state (and only there!) to hide the rounded corners, s o undo that before 929 // fully expanded state (and only there!) to hide the rounded corners, s o undo that before
963 // applying the shrinkage factor. 930 // applying the shrinkage factor.
964 mLocationBarNtpOffsetLeft = 931 mLocationBarNtpOffsetLeft =
965 (leftBoundDifference - mLocationBarBackgroundCornerRadius) * shr inkage; 932 (leftBoundDifference - mLocationBarBackgroundCornerRadius) * shr inkage;
966 mLocationBarNtpOffsetRight = 933 mLocationBarNtpOffsetRight =
967 (rightBoundDifference + mLocationBarBackgroundCornerRadius) * sh rinkage; 934 (rightBoundDifference + mLocationBarBackgroundCornerRadius) * sh rinkage;
968 935
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 shadowDrawable.reverseTransition(URL_FOCUS_CHANGE_ANIMATION_DURATION _MS); 1744 shadowDrawable.reverseTransition(URL_FOCUS_CHANGE_ANIMATION_DURATION _MS);
1778 } 1745 }
1779 } 1746 }
1780 1747
1781 private void triggerUrlFocusAnimation(final boolean hasFocus) { 1748 private void triggerUrlFocusAnimation(final boolean hasFocus) {
1782 if (mUrlFocusLayoutAnimator != null && mUrlFocusLayoutAnimator.isRunning ()) { 1749 if (mUrlFocusLayoutAnimator != null && mUrlFocusLayoutAnimator.isRunning ()) {
1783 mUrlFocusLayoutAnimator.cancel(); 1750 mUrlFocusLayoutAnimator.cancel();
1784 mUrlFocusLayoutAnimator = null; 1751 mUrlFocusLayoutAnimator = null;
1785 } 1752 }
1786 1753
1787 List<Animator> animators = new ArrayList<Animator>(); 1754 List<Animator> animators = new ArrayList<>();
1788 if (hasFocus) { 1755 if (hasFocus) {
1789 populateUrlFocusingAnimatorSet(animators); 1756 populateUrlFocusingAnimatorSet(animators);
1790 } else { 1757 } else {
1791 populateUrlClearFocusingAnimatorSet(animators); 1758 populateUrlClearFocusingAnimatorSet(animators);
1792 } 1759 }
1793 mUrlFocusLayoutAnimator = new AnimatorSet(); 1760 mUrlFocusLayoutAnimator = new AnimatorSet();
1794 mUrlFocusLayoutAnimator.playTogether(animators); 1761 mUrlFocusLayoutAnimator.playTogether(animators);
1795 1762
1796 mUrlFocusChangeInProgress = true; 1763 mUrlFocusChangeInProgress = true;
1797 mUrlFocusLayoutAnimator.addListener(new AnimatorListenerAdapter() { 1764 mUrlFocusLayoutAnimator.addListener(new AnimatorListenerAdapter() {
(...skipping 24 matching lines...) Expand all
1822 requestLayout(); 1789 requestLayout();
1823 } 1790 }
1824 mLocationBar.finishUrlFocusChange(hasFocus); 1791 mLocationBar.finishUrlFocusChange(hasFocus);
1825 mUrlFocusChangeInProgress = false; 1792 mUrlFocusChangeInProgress = false;
1826 } 1793 }
1827 }); 1794 });
1828 mUrlFocusLayoutAnimator.start(); 1795 mUrlFocusLayoutAnimator.start();
1829 } 1796 }
1830 1797
1831 @Override 1798 @Override
1832 protected boolean shouldShowMenuButton() {
1833 // Even in Document mode, the toolbar menu button will be shown while on the NTP. This
1834 // allows the menu to translate off the screen on scroll to match the ta bbed behavior.
1835 if (mVisualState == VisualState.NEW_TAB_NORMAL) return true;
1836
1837 return !mLocationBar.showMenuButtonInOmnibox() && super.shouldShowMenuBu tton();
1838 }
1839
1840 @Override
1841 protected void updateTabCountVisuals(int numberOfTabs) { 1799 protected void updateTabCountVisuals(int numberOfTabs) {
1842 if (mReturnButton != null) mReturnButton.setEnabled(true); 1800 if (mReturnButton != null) mReturnButton.setEnabled(true);
1843 if (mHomeButton != null) mHomeButton.setEnabled(true); 1801 if (mHomeButton != null) mHomeButton.setEnabled(true);
1844 1802
1845 if (mToggleTabStackButton == null) return; 1803 if (mToggleTabStackButton == null) return;
1846 1804
1847 mToggleTabStackButton.setEnabled(numberOfTabs >= 1); 1805 mToggleTabStackButton.setEnabled(numberOfTabs >= 1);
1848 mToggleTabStackButton.setContentDescription( 1806 mToggleTabStackButton.setContentDescription(
1849 getResources().getString(R.string.accessibility_toolbar_btn_tabs witcher_toggle, 1807 getResources().getString(R.string.accessibility_toolbar_btn_tabs witcher_toggle,
1850 numberOfTabs)); 1808 numberOfTabs));
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2110 2068
2111 if (mToggleTabStackButton != null) { 2069 if (mToggleTabStackButton != null) {
2112 mToggleTabStackButton.setImageDrawable(mUseLightToolbarDrawables 2070 mToggleTabStackButton.setImageDrawable(mUseLightToolbarDrawables
2113 ? mTabSwitcherButtonDrawableLight : mTabSwitcherButtonDrawab le); 2071 ? mTabSwitcherButtonDrawableLight : mTabSwitcherButtonDrawab le);
2114 if (mTabSwitcherAnimationTabStackDrawable != null) { 2072 if (mTabSwitcherAnimationTabStackDrawable != null) {
2115 mTabSwitcherAnimationTabStackDrawable.setTint( 2073 mTabSwitcherAnimationTabStackDrawable.setTint(
2116 mUseLightToolbarDrawables ? mLightModeTint : mDarkModeTi nt); 2074 mUseLightToolbarDrawables ? mLightModeTint : mDarkModeTi nt);
2117 } 2075 }
2118 } 2076 }
2119 2077
2120 if (shouldShowMenuButton()) { 2078 mMenuButton.setTint(mUseLightToolbarDrawables ? mLightModeTint : mDarkMo deTint);
2121 mMenuButton.setTint(mUseLightToolbarDrawables ? mLightModeTint : mDa rkModeTint);
2122 2079
2123 if (mShowMenuBadge && !mIsInTabSwitcherMode) { 2080 if (mShowMenuBadge && !mIsInTabSwitcherMode) {
2124 setAppMenuUpdateBadgeDrawable(mUseLightToolbarDrawables); 2081 setAppMenuUpdateBadgeDrawable(mUseLightToolbarDrawables);
2125 }
2126 } 2082 }
2127 ColorStateList tint = mUseLightToolbarDrawables ? mLightModeTint : mDark ModeTint; 2083 ColorStateList tint = mUseLightToolbarDrawables ? mLightModeTint : mDark ModeTint;
2128 if (isReturnButtonVisible()) mReturnButton.setTint(tint); 2084 if (isReturnButtonVisible()) mReturnButton.setTint(tint);
2129 if (mIsHomeButtonEnabled) mHomeButton.setTint(tint); 2085 if (mIsHomeButtonEnabled) mHomeButton.setTint(tint);
2130 2086
2131 mLocationBar.updateVisualsForState(); 2087 mLocationBar.updateVisualsForState();
2132 // Remove the side padding for incognito to ensure the badge icon aligns correctly with the 2088 // Remove the side padding for incognito to ensure the badge icon aligns correctly with the
2133 // background of the location bar. 2089 // background of the location bar.
2134 if (isIncognito) { 2090 if (isIncognito) {
2135 mLocationBar.setPadding( 2091 mLocationBar.setPadding(
(...skipping 13 matching lines...) Expand all
2149 if (mIsInTabSwitcherMode) mNewTabButton.setIsIncognito(isIncognito); 2105 if (mIsInTabSwitcherMode) mNewTabButton.setIsIncognito(isIncognito);
2150 2106
2151 CharSequence newTabContentDescription = getResources().getText( 2107 CharSequence newTabContentDescription = getResources().getText(
2152 isIncognito ? R.string.accessibility_toolbar_btn_new_incognito_t ab : 2108 isIncognito ? R.string.accessibility_toolbar_btn_new_incognito_t ab :
2153 R.string.accessibility_toolbar_btn_new_tab); 2109 R.string.accessibility_toolbar_btn_new_tab);
2154 if (mNewTabButton != null 2110 if (mNewTabButton != null
2155 && !newTabContentDescription.equals(mNewTabButton.getContentDesc ription())) { 2111 && !newTabContentDescription.equals(mNewTabButton.getContentDesc ription())) {
2156 mNewTabButton.setContentDescription(newTabContentDescription); 2112 mNewTabButton.setContentDescription(newTabContentDescription);
2157 } 2113 }
2158 2114
2159 getMenuButtonWrapper().setVisibility(shouldShowMenuButton() ? View.VISIB LE : View.GONE); 2115 getMenuButtonWrapper().setVisibility(View.VISIBLE);
2160 } 2116 }
2161 2117
2162 @Override 2118 @Override
2163 public LocationBar getLocationBar() { 2119 public LocationBar getLocationBar() {
2164 return mLocationBar; 2120 return mLocationBar;
2165 } 2121 }
2166 2122
2167 @Override 2123 @Override
2168 public void showAppMenuUpdateBadge() { 2124 public void showAppMenuUpdateBadge() {
2169 super.showAppMenuUpdateBadge(); 2125 super.showAppMenuUpdateBadge();
2170 2126
2171 // Set up variables. 2127 // Set up variables.
2172 if (!mBrowsingModeViews.contains(mMenuBadge)) { 2128 if (!mBrowsingModeViews.contains(mMenuBadge)) {
2173 mBrowsingModeViews.add(mMenuBadge); 2129 mBrowsingModeViews.add(mMenuBadge);
2174 } 2130 }
2175 2131
2176 // Finish any in-progress animations and set the TabSwitcherAnimationMen uBadgeDrawables. 2132 // Finish any in-progress animations and set the TabSwitcherAnimationMen uBadgeDrawables.
2177 finishAnimations(); 2133 finishAnimations();
2178 setTabSwitcherAnimationMenuBadgeDrawable(); 2134 setTabSwitcherAnimationMenuBadgeDrawable();
2179 2135
2180 // Show the badge. 2136 // Show the badge.
2181 if (!mIsInTabSwitcherMode && shouldShowMenuButton()) { 2137 if (!mIsInTabSwitcherMode) {
2182 if (mUseLightToolbarDrawables) { 2138 if (mUseLightToolbarDrawables) {
2183 setAppMenuUpdateBadgeDrawable(mUseLightToolbarDrawables); 2139 setAppMenuUpdateBadgeDrawable(mUseLightToolbarDrawables);
2184 } 2140 }
2185 setAppMenuUpdateBadgeToVisible(true); 2141 setAppMenuUpdateBadgeToVisible(true);
2186 } 2142 }
2187
2188 mLocationBar.showAppMenuUpdateBadge(true);
2189 } 2143 }
2190 2144
2191 @Override 2145 @Override
2192 public void removeAppMenuUpdateBadge(boolean animate) { 2146 public void removeAppMenuUpdateBadge(boolean animate) {
2193 super.removeAppMenuUpdateBadge(animate); 2147 super.removeAppMenuUpdateBadge(animate);
2194 2148
2195 if (mBrowsingModeViews.contains(mMenuBadge)) { 2149 if (mBrowsingModeViews.contains(mMenuBadge)) {
2196 mBrowsingModeViews.remove(mMenuBadge); 2150 mBrowsingModeViews.remove(mMenuBadge);
2197 mTabSwitcherAnimationMenuBadgeDarkDrawable = null; 2151 mTabSwitcherAnimationMenuBadgeDarkDrawable = null;
2198 mTabSwitcherAnimationMenuBadgeLightDrawable = null; 2152 mTabSwitcherAnimationMenuBadgeLightDrawable = null;
2199 } 2153 }
2200 2154
2201 mLocationBar.removeAppMenuUpdateBadge(animate); 2155 mLocationBar.removeAppMenuUpdateBadge(animate);
2202 } 2156 }
2203 2157
2204 private void setTabSwitcherAnimationMenuDrawable() { 2158 private void setTabSwitcherAnimationMenuDrawable() {
2205 if (!shouldShowMenuButton()) return;
2206 mTabSwitcherAnimationMenuDrawable = ApiCompatibilityUtils.getDrawable(ge tResources(), 2159 mTabSwitcherAnimationMenuDrawable = ApiCompatibilityUtils.getDrawable(ge tResources(),
2207 R.drawable.btn_menu); 2160 R.drawable.btn_menu);
2208 mTabSwitcherAnimationMenuDrawable.mutate(); 2161 mTabSwitcherAnimationMenuDrawable.mutate();
2209 mTabSwitcherAnimationMenuDrawable.setColorFilter( 2162 mTabSwitcherAnimationMenuDrawable.setColorFilter(
2210 isIncognito() ? mLightModeDefaultColor : mDarkModeDefaultColor, 2163 isIncognito() ? mLightModeDefaultColor : mDarkModeDefaultColor,
2211 PorterDuff.Mode.SRC_IN); 2164 PorterDuff.Mode.SRC_IN);
2212 ((BitmapDrawable) mTabSwitcherAnimationMenuDrawable).setGravity(Gravity. CENTER); 2165 ((BitmapDrawable) mTabSwitcherAnimationMenuDrawable).setGravity(Gravity. CENTER);
2213 } 2166 }
2214 2167
2215 private void setTabSwitcherAnimationMenuBadgeDrawable() { 2168 private void setTabSwitcherAnimationMenuBadgeDrawable() {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 }); 2231 });
2279 2232
2280 if (mFullscreenManager != null) { 2233 if (mFullscreenManager != null) {
2281 mFullscreenCalloutToken = 2234 mFullscreenCalloutToken =
2282 mFullscreenManager.showControlsPersistentAndClearOldToken( 2235 mFullscreenManager.showControlsPersistentAndClearOldToken(
2283 mFullscreenCalloutToken); 2236 mFullscreenCalloutToken);
2284 } 2237 }
2285 } 2238 }
2286 } 2239 }
2287 2240
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698