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

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: Moved PulseDrawable Created 3 years, 8 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 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1447 mToolbarShadow.setVisibility(VISIBLE); 1447 mToolbarShadow.setVisibility(VISIBLE);
1448 mPreTextureCaptureAlpha = getAlpha(); 1448 mPreTextureCaptureAlpha = getAlpha();
1449 setAlpha(1); 1449 setAlpha(1);
1450 } else { 1450 } else {
1451 setAlpha(mPreTextureCaptureAlpha); 1451 setAlpha(mPreTextureCaptureAlpha);
1452 updateShadowVisibility(); 1452 updateShadowVisibility();
1453 mPreTextureCaptureAlpha = 1f; 1453 mPreTextureCaptureAlpha = 1f;
1454 } 1454 }
1455 } 1455 }
1456 1456
1457 // TODO(dtrainor): This is always true when in the tab switcher (crbug.com/7 10750).
1457 private boolean isTabSwitcherAnimationRunning() { 1458 private boolean isTabSwitcherAnimationRunning() {
1458 return mTabSwitcherState == ENTERING_TAB_SWITCHER 1459 return mTabSwitcherState == ENTERING_TAB_SWITCHER
1459 || mTabSwitcherState == EXITING_TAB_SWITCHER; 1460 || mTabSwitcherState == EXITING_TAB_SWITCHER;
1460 } 1461 }
1461 1462
1462 private void updateViewsForTabSwitcherMode() { 1463 private void updateViewsForTabSwitcherMode() {
1463 int tabSwitcherViewsVisibility = mTabSwitcherState != STATIC_TAB ? VISI BLE : INVISIBLE; 1464 int tabSwitcherViewsVisibility = mTabSwitcherState != STATIC_TAB ? VISI BLE : INVISIBLE;
1464 int browsingViewsVisibility = mTabSwitcherState != STATIC_TAB ? INVISIBL E : VISIBLE; 1465 int browsingViewsVisibility = mTabSwitcherState != STATIC_TAB ? INVISIBL E : VISIBLE;
1465 1466
1466 for (View view : mTabSwitcherModeViews) { 1467 for (View view : mTabSwitcherModeViews) {
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 mToggleTabStackButton.setImageDrawable(mUseLightToolbarDrawables 2131 mToggleTabStackButton.setImageDrawable(mUseLightToolbarDrawables
2131 ? mTabSwitcherButtonDrawableLight : mTabSwitcherButtonDrawab le); 2132 ? mTabSwitcherButtonDrawableLight : mTabSwitcherButtonDrawab le);
2132 if (mTabSwitcherAnimationTabStackDrawable != null) { 2133 if (mTabSwitcherAnimationTabStackDrawable != null) {
2133 mTabSwitcherAnimationTabStackDrawable.setTint( 2134 mTabSwitcherAnimationTabStackDrawable.setTint(
2134 mUseLightToolbarDrawables ? mLightModeTint : mDarkModeTi nt); 2135 mUseLightToolbarDrawables ? mLightModeTint : mDarkModeTi nt);
2135 } 2136 }
2136 } 2137 }
2137 2138
2138 mMenuButton.setTint(mUseLightToolbarDrawables ? mLightModeTint : mDarkMo deTint); 2139 mMenuButton.setTint(mUseLightToolbarDrawables ? mLightModeTint : mDarkMo deTint);
2139 2140
2141 setMenuButtonHighlightDrawable(mHighlightingMenu);
2140 if (mShowMenuBadge && inOrEnteringStaticTab) { 2142 if (mShowMenuBadge && inOrEnteringStaticTab) {
2141 setAppMenuUpdateBadgeDrawable(mUseLightToolbarDrawables); 2143 setAppMenuUpdateBadgeDrawable(mUseLightToolbarDrawables);
2142 } 2144 }
2143 ColorStateList tint = mUseLightToolbarDrawables ? mLightModeTint : mDark ModeTint; 2145 ColorStateList tint = mUseLightToolbarDrawables ? mLightModeTint : mDark ModeTint;
2144 if (mIsHomeButtonEnabled) mHomeButton.setTint(tint); 2146 if (mIsHomeButtonEnabled) mHomeButton.setTint(tint);
2145 2147
2146 mLocationBar.updateVisualsForState(); 2148 mLocationBar.updateVisualsForState();
2147 // Remove the side padding for incognito to ensure the badge icon aligns correctly with the 2149 // Remove the side padding for incognito to ensure the badge icon aligns correctly with the
2148 // background of the location bar. 2150 // background of the location bar.
2149 if (isIncognito) { 2151 if (isIncognito) {
(...skipping 23 matching lines...) Expand all
2173 2175
2174 getMenuButtonWrapper().setVisibility(View.VISIBLE); 2176 getMenuButtonWrapper().setVisibility(View.VISIBLE);
2175 } 2177 }
2176 2178
2177 @Override 2179 @Override
2178 public LocationBar getLocationBar() { 2180 public LocationBar getLocationBar() {
2179 return mLocationBar; 2181 return mLocationBar;
2180 } 2182 }
2181 2183
2182 @Override 2184 @Override
2185 public boolean useLightDrawables() {
2186 return mUseLightToolbarDrawables;
2187 }
2188
2189 @Override
2190 protected void setMenuButtonHighlightDrawable(boolean highlighting) {
2191 highlighting &= !isTabSwitcherAnimationRunning();
2192 super.setMenuButtonHighlightDrawable(highlighting);
2193 }
2194
2195 @Override
2183 public void showAppMenuUpdateBadge() { 2196 public void showAppMenuUpdateBadge() {
2184 super.showAppMenuUpdateBadge(); 2197 super.showAppMenuUpdateBadge();
2185 2198
2186 // Set up variables. 2199 // Set up variables.
2187 if (!mBrowsingModeViews.contains(mMenuBadge)) { 2200 if (!mBrowsingModeViews.contains(mMenuBadge)) {
2188 mBrowsingModeViews.add(mMenuBadge); 2201 mBrowsingModeViews.add(mMenuBadge);
2189 } 2202 }
2190 2203
2191 // Finish any in-progress animations and set the TabSwitcherAnimationMen uBadgeDrawables. 2204 // Finish any in-progress animations and set the TabSwitcherAnimationMen uBadgeDrawables.
2192 finishAnimations(); 2205 finishAnimations();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 }); 2284 });
2272 2285
2273 if (mControlsVisibilityDelegate != null) { 2286 if (mControlsVisibilityDelegate != null) {
2274 mFullscreenCalloutToken = 2287 mFullscreenCalloutToken =
2275 mControlsVisibilityDelegate.showControlsPersistentAndClearOl dToken( 2288 mControlsVisibilityDelegate.showControlsPersistentAndClearOl dToken(
2276 mFullscreenCalloutToken); 2289 mFullscreenCalloutToken);
2277 } 2290 }
2278 } 2291 }
2279 } 2292 }
2280 2293
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698