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

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

Issue 2779543005: Add support for highlighting menu items (Closed)
Patch Set: Cleaned up some comments and code Created 3 years, 9 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 2118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2129 mToggleTabStackButton.setImageDrawable(mUseLightToolbarDrawables 2129 mToggleTabStackButton.setImageDrawable(mUseLightToolbarDrawables
2130 ? mTabSwitcherButtonDrawableLight : mTabSwitcherButtonDrawab le); 2130 ? mTabSwitcherButtonDrawableLight : mTabSwitcherButtonDrawab le);
2131 if (mTabSwitcherAnimationTabStackDrawable != null) { 2131 if (mTabSwitcherAnimationTabStackDrawable != null) {
2132 mTabSwitcherAnimationTabStackDrawable.setTint( 2132 mTabSwitcherAnimationTabStackDrawable.setTint(
2133 mUseLightToolbarDrawables ? mLightModeTint : mDarkModeTi nt); 2133 mUseLightToolbarDrawables ? mLightModeTint : mDarkModeTi nt);
2134 } 2134 }
2135 } 2135 }
2136 2136
2137 mMenuButton.setTint(mUseLightToolbarDrawables ? mLightModeTint : mDarkMo deTint); 2137 mMenuButton.setTint(mUseLightToolbarDrawables ? mLightModeTint : mDarkMo deTint);
2138 2138
2139 if (mShowMenuBadge && inOrEnteringStaticTab) { 2139 if (inOrEnteringStaticTab) {
2140 setAppMenuUpdateBadgeDrawable(mUseLightToolbarDrawables); 2140 setAppMenuButtonHighlight(mHighlightingMenu, mUseLightToolbarDrawabl es);
2141 if (mShowMenuBadge) setAppMenuUpdateBadgeDrawable(mUseLightToolbarDr awables);
2141 } 2142 }
2142 ColorStateList tint = mUseLightToolbarDrawables ? mLightModeTint : mDark ModeTint; 2143 ColorStateList tint = mUseLightToolbarDrawables ? mLightModeTint : mDark ModeTint;
2143 if (mIsHomeButtonEnabled) mHomeButton.setTint(tint); 2144 if (mIsHomeButtonEnabled) mHomeButton.setTint(tint);
2144 2145
2145 mLocationBar.updateVisualsForState(); 2146 mLocationBar.updateVisualsForState();
2146 // Remove the side padding for incognito to ensure the badge icon aligns correctly with the 2147 // Remove the side padding for incognito to ensure the badge icon aligns correctly with the
2147 // background of the location bar. 2148 // background of the location bar.
2148 if (isIncognito) { 2149 if (isIncognito) {
2149 mLocationBar.setPadding( 2150 mLocationBar.setPadding(
2150 0, mLocationBarBackgroundPadding.top, 0, mLocationBarBackgro undPadding.bottom); 2151 0, mLocationBarBackgroundPadding.top, 0, mLocationBarBackgro undPadding.bottom);
(...skipping 21 matching lines...) Expand all
2172 2173
2173 getMenuButtonWrapper().setVisibility(View.VISIBLE); 2174 getMenuButtonWrapper().setVisibility(View.VISIBLE);
2174 } 2175 }
2175 2176
2176 @Override 2177 @Override
2177 public LocationBar getLocationBar() { 2178 public LocationBar getLocationBar() {
2178 return mLocationBar; 2179 return mLocationBar;
2179 } 2180 }
2180 2181
2181 @Override 2182 @Override
2183 public void setMenuButtonHighlight(boolean highlight) {
2184 super.setMenuButtonHighlight(highlight);
Ted C 2017/03/31 19:01:47 doesn't super also call setAppMenuButtonHighlight?
2185
2186 // TODO(dtrainor): Why is the badge only shown on light?
Ted C 2017/03/31 19:01:47 I don't understand this TODO.
2187 if (mTabSwitcherState == STATIC_TAB) {
2188 setAppMenuButtonHighlight(highlight, mUseLightToolbarDrawables);
2189 }
2190 }
2191
2192 @Override
2182 public void showAppMenuUpdateBadge() { 2193 public void showAppMenuUpdateBadge() {
2183 super.showAppMenuUpdateBadge(); 2194 super.showAppMenuUpdateBadge();
2184 2195
2185 // Set up variables. 2196 // Set up variables.
2186 if (!mBrowsingModeViews.contains(mMenuBadge)) { 2197 if (!mBrowsingModeViews.contains(mMenuBadge)) {
2187 mBrowsingModeViews.add(mMenuBadge); 2198 mBrowsingModeViews.add(mMenuBadge);
2188 } 2199 }
2189 2200
2190 // Finish any in-progress animations and set the TabSwitcherAnimationMen uBadgeDrawables. 2201 // Finish any in-progress animations and set the TabSwitcherAnimationMen uBadgeDrawables.
2191 finishAnimations(); 2202 finishAnimations();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 }); 2281 });
2271 2282
2272 if (mControlsVisibilityDelegate != null) { 2283 if (mControlsVisibilityDelegate != null) {
2273 mFullscreenCalloutToken = 2284 mFullscreenCalloutToken =
2274 mControlsVisibilityDelegate.showControlsPersistentAndClearOl dToken( 2285 mControlsVisibilityDelegate.showControlsPersistentAndClearOl dToken(
2275 mFullscreenCalloutToken); 2286 mFullscreenCalloutToken);
2276 } 2287 }
2277 } 2288 }
2278 } 2289 }
2279 2290
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698