| OLD | NEW |
| 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.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.util.AttributeSet; | 9 import android.util.AttributeSet; |
| 10 import android.view.View; | 10 import android.view.View; |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 RecordUserAction.record("MobileTabClobbered"); | 262 RecordUserAction.record("MobileTabClobbered"); |
| 263 } else if (mReloadButton == v) { | 263 } else if (mReloadButton == v) { |
| 264 stopOrReloadCurrentTab(); | 264 stopOrReloadCurrentTab(); |
| 265 } else if (mBookmarkButton == v) { | 265 } else if (mBookmarkButton == v) { |
| 266 if (mBookmarkListener != null) { | 266 if (mBookmarkListener != null) { |
| 267 mBookmarkListener.onClick(mBookmarkButton); | 267 mBookmarkListener.onClick(mBookmarkButton); |
| 268 RecordUserAction.record("MobileToolbarToggleBookmark"); | 268 RecordUserAction.record("MobileToolbarToggleBookmark"); |
| 269 } | 269 } |
| 270 } else if (mAccessibilitySwitcherButton == v) { | 270 } else if (mAccessibilitySwitcherButton == v) { |
| 271 if (mTabSwitcherListener != null) { | 271 if (mTabSwitcherListener != null) { |
| 272 cancelAppMenuUpdateBadgeAnimation(); |
| 272 mTabSwitcherListener.onClick(mAccessibilitySwitcherButton); | 273 mTabSwitcherListener.onClick(mAccessibilitySwitcherButton); |
| 273 } | 274 } |
| 274 } | 275 } |
| 275 } | 276 } |
| 276 | 277 |
| 277 private void updateSwitcherButtonVisibility(boolean enabled) { | 278 private void updateSwitcherButtonVisibility(boolean enabled) { |
| 278 mAccessibilitySwitcherButton.setVisibility(mShowTabStack || enabled | 279 mAccessibilitySwitcherButton.setVisibility(mShowTabStack || enabled |
| 279 ? View.VISIBLE : View.GONE); | 280 ? View.VISIBLE : View.GONE); |
| 280 } | 281 } |
| 281 | 282 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 298 mForwardButton.setTint(incognito ? mLightModeTint : mDarkModeTint); | 299 mForwardButton.setTint(incognito ? mLightModeTint : mDarkModeTint); |
| 299 if (incognito) { | 300 if (incognito) { |
| 300 mLocationBar.getContainerView().getBackground().setAlpha( | 301 mLocationBar.getContainerView().getBackground().setAlpha( |
| 301 ToolbarPhone.LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA); | 302 ToolbarPhone.LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA); |
| 302 } else { | 303 } else { |
| 303 mLocationBar.getContainerView().getBackground().setAlpha(255); | 304 mLocationBar.getContainerView().getBackground().setAlpha(255); |
| 304 } | 305 } |
| 305 mAccessibilitySwitcherButton.setImageDrawable( | 306 mAccessibilitySwitcherButton.setImageDrawable( |
| 306 incognito ? mTabSwitcherButtonDrawableLight : mTabSwitcherBu
ttonDrawable); | 307 incognito ? mTabSwitcherButtonDrawableLight : mTabSwitcherBu
ttonDrawable); |
| 307 mLocationBar.updateVisualsForState(); | 308 mLocationBar.updateVisualsForState(); |
| 309 if (mShowMenuBadge) { |
| 310 setAppMenuUpdateBadgeDrawable(incognito); |
| 311 } |
| 308 mUseLightColorAssets = incognito; | 312 mUseLightColorAssets = incognito; |
| 309 } | 313 } |
| 310 mLocationBar.setUrlBarFocus(false); | 314 mLocationBar.setUrlBarFocus(false); |
| 311 } | 315 } |
| 312 | 316 |
| 313 @Override | 317 @Override |
| 314 protected void updateBackButtonVisibility(boolean canGoBack) { | 318 protected void updateBackButtonVisibility(boolean canGoBack) { |
| 315 boolean enableButton = canGoBack && !mIsInTabSwitcherMode; | 319 boolean enableButton = canGoBack && !mIsInTabSwitcherMode; |
| 316 mBackButton.setEnabled(enableButton); | 320 mBackButton.setEnabled(enableButton); |
| 317 mBackButton.setFocusable(enableButton); | 321 mBackButton.setFocusable(enableButton); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 361 |
| 358 @Override | 362 @Override |
| 359 protected void setTabSwitcherMode( | 363 protected void setTabSwitcherMode( |
| 360 boolean inTabSwitcherMode, boolean showToolbar, boolean delayAnimati
on) { | 364 boolean inTabSwitcherMode, boolean showToolbar, boolean delayAnimati
on) { |
| 361 if (mShowTabStack && inTabSwitcherMode) { | 365 if (mShowTabStack && inTabSwitcherMode) { |
| 362 mIsInTabSwitcherMode = true; | 366 mIsInTabSwitcherMode = true; |
| 363 mBackButton.setEnabled(false); | 367 mBackButton.setEnabled(false); |
| 364 mForwardButton.setEnabled(false); | 368 mForwardButton.setEnabled(false); |
| 365 mReloadButton.setEnabled(false); | 369 mReloadButton.setEnabled(false); |
| 366 mLocationBar.getContainerView().setVisibility(View.INVISIBLE); | 370 mLocationBar.getContainerView().setVisibility(View.INVISIBLE); |
| 367 if (mShowMenuBadge && mUnbadgedMenuButtonDrawable != null) { | 371 if (mShowMenuBadge) { |
| 368 mMenuButton.setImageDrawable(mUnbadgedMenuButtonDrawable); | |
| 369 mMenuBadge.setVisibility(View.GONE); | 372 mMenuBadge.setVisibility(View.GONE); |
| 370 } | 373 } |
| 371 } else { | 374 } else { |
| 372 mIsInTabSwitcherMode = false; | 375 mIsInTabSwitcherMode = false; |
| 373 mLocationBar.getContainerView().setVisibility(View.VISIBLE); | 376 mLocationBar.getContainerView().setVisibility(View.VISIBLE); |
| 374 if (mShowMenuBadge) { | 377 if (mShowMenuBadge) { |
| 375 setAppMenuUpdateBadgeToVisible(); | 378 setAppMenuUpdateBadgeToVisible(false); |
| 376 } | 379 } |
| 377 } | 380 } |
| 378 } | 381 } |
| 379 | 382 |
| 380 @Override | 383 @Override |
| 381 protected void updateTabCountVisuals(int numberOfTabs) { | 384 protected void updateTabCountVisuals(int numberOfTabs) { |
| 382 mAccessibilitySwitcherButton.setContentDescription( | 385 mAccessibilitySwitcherButton.setContentDescription( |
| 383 getResources().getString(R.string.accessibility_toolbar_btn_tabs
witcher_toggle, | 386 getResources().getString(R.string.accessibility_toolbar_btn_tabs
witcher_toggle, |
| 384 numberOfTabs)); | 387 numberOfTabs)); |
| 385 mTabSwitcherButtonDrawable.updateForTabCount(numberOfTabs, isIncognito()
); | 388 mTabSwitcherButtonDrawable.updateForTabCount(numberOfTabs, isIncognito()
); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 410 | 413 |
| 411 @Override | 414 @Override |
| 412 public LocationBar getLocationBar() { | 415 public LocationBar getLocationBar() { |
| 413 return mLocationBar; | 416 return mLocationBar; |
| 414 } | 417 } |
| 415 | 418 |
| 416 @Override | 419 @Override |
| 417 public void showAppMenuUpdateBadge() { | 420 public void showAppMenuUpdateBadge() { |
| 418 super.showAppMenuUpdateBadge(); | 421 super.showAppMenuUpdateBadge(); |
| 419 if (!mIsInTabSwitcherMode) { | 422 if (!mIsInTabSwitcherMode) { |
| 420 setAppMenuUpdateBadgeToVisible(); | 423 if (mUseLightColorAssets) { |
| 424 setAppMenuUpdateBadgeDrawable(mUseLightColorAssets); |
| 425 } |
| 426 setAppMenuUpdateBadgeToVisible(true); |
| 421 } | 427 } |
| 422 } | 428 } |
| 423 } | 429 } |
| OLD | NEW |