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.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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 /** | 215 /** |
216 * Offsets applied to the <i>contents</i> of the omnibox if we are showing a
New Tab Page. | 216 * Offsets applied to the <i>contents</i> of the omnibox if we are showing a
New Tab Page. |
217 * This can be different from {@link #mLocationBarBackgroundNtpOffset} due t
o the fact that we | 217 * This can be different from {@link #mLocationBarBackgroundNtpOffset} due t
o the fact that we |
218 * extend the omnibox horizontally beyond the screen boundaries when focused
, to hide its | 218 * extend the omnibox horizontally beyond the screen boundaries when focused
, to hide its |
219 * rounded corners. | 219 * rounded corners. |
220 */ | 220 */ |
221 private float mLocationBarNtpOffsetLeft; | 221 private float mLocationBarNtpOffsetLeft; |
222 private float mLocationBarNtpOffsetRight; | 222 private float mLocationBarNtpOffsetRight; |
223 | 223 |
224 private final Rect mNtpSearchBoxBounds = new Rect(); | 224 private final Rect mNtpSearchBoxBounds = new Rect(); |
225 private final Point mNtpSearchBoxTranslation = new Point(); | 225 protected final Point mNtpSearchBoxTranslation = new Point(); |
226 | 226 |
227 private final int mToolbarSidePadding; | 227 private final int mToolbarSidePadding; |
228 private final int mLocationBarBackgroundCornerRadius; | 228 private final int mLocationBarBackgroundCornerRadius; |
229 protected int mLocationBarVerticalMargin; | 229 protected int mLocationBarVerticalMargin; |
230 | 230 |
231 private ValueAnimator mBrandColorTransitionAnimation; | 231 private ValueAnimator mBrandColorTransitionAnimation; |
232 private boolean mBrandColorTransitionActive; | 232 private boolean mBrandColorTransitionActive; |
233 | 233 |
234 private boolean mIsHomeButtonEnabled; | 234 private boolean mIsHomeButtonEnabled; |
235 | 235 |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 return 0; | 629 return 0; |
630 } else if (ApiCompatibilityUtils.isLayoutRtl(this)) { | 630 } else if (ApiCompatibilityUtils.isLayoutRtl(this)) { |
631 return Math.max(mToolbarSidePadding, | 631 return Math.max(mToolbarSidePadding, |
632 shouldHideEndToolbarButtons() ? 0 | 632 shouldHideEndToolbarButtons() ? 0 |
633 : mToolbarButtonsContainer.get
MeasuredWidth()); | 633 : mToolbarButtonsContainer.get
MeasuredWidth()); |
634 } else { | 634 } else { |
635 return getBoundsAfterAccountingForLeftButton(); | 635 return getBoundsAfterAccountingForLeftButton(); |
636 } | 636 } |
637 } | 637 } |
638 | 638 |
639 private int getBoundsAfterAccountingForLeftButton() { | 639 protected int getBoundsAfterAccountingForLeftButton() { |
640 int padding = mToolbarSidePadding; | 640 int padding = mToolbarSidePadding; |
641 if (mHomeButton.getVisibility() != GONE) padding = mHomeButton.getMeasur
edWidth(); | 641 if (mHomeButton.getVisibility() != GONE) padding = mHomeButton.getMeasur
edWidth(); |
642 return padding; | 642 return padding; |
643 } | 643 } |
644 | 644 |
645 private int getViewBoundsRightOfLocationBar(VisualState visualState) { | 645 private int getViewBoundsRightOfLocationBar(VisualState visualState) { |
646 // Uses getMeasuredWidth()s instead of getRight() because this is called
in onMeasure | 646 // Uses getMeasuredWidth()s instead of getRight() because this is called
in onMeasure |
647 // and the layout values have not yet been set. | 647 // and the layout values have not yet been set. |
648 if (visualState == VisualState.NEW_TAB_NORMAL) { | 648 if (visualState == VisualState.NEW_TAB_NORMAL) { |
649 return getMeasuredWidth(); | 649 return getMeasuredWidth(); |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // TODO(dtrainor): This is always true when in the tab switcher (crbug.com/7
10750). |
1458 private boolean isTabSwitcherAnimationRunning() { | 1458 protected boolean isTabSwitcherAnimationRunning() { |
1459 return mTabSwitcherState == ENTERING_TAB_SWITCHER | 1459 return mTabSwitcherState == ENTERING_TAB_SWITCHER |
1460 || mTabSwitcherState == EXITING_TAB_SWITCHER; | 1460 || mTabSwitcherState == EXITING_TAB_SWITCHER; |
1461 } | 1461 } |
1462 | 1462 |
1463 private void updateViewsForTabSwitcherMode() { | 1463 private void updateViewsForTabSwitcherMode() { |
1464 int tabSwitcherViewsVisibility = mTabSwitcherState != STATIC_TAB ? VISI
BLE : INVISIBLE; | 1464 int tabSwitcherViewsVisibility = mTabSwitcherState != STATIC_TAB ? VISI
BLE : INVISIBLE; |
1465 int browsingViewsVisibility = mTabSwitcherState != STATIC_TAB ? INVISIBL
E : VISIBLE; | 1465 int browsingViewsVisibility = mTabSwitcherState != STATIC_TAB ? INVISIBL
E : VISIBLE; |
1466 | 1466 |
1467 for (View view : mTabSwitcherModeViews) { | 1467 for (View view : mTabSwitcherModeViews) { |
1468 view.setVisibility(tabSwitcherViewsVisibility); | 1468 view.setVisibility(tabSwitcherViewsVisibility); |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2284 }); | 2284 }); |
2285 | 2285 |
2286 if (mControlsVisibilityDelegate != null) { | 2286 if (mControlsVisibilityDelegate != null) { |
2287 mFullscreenCalloutToken = | 2287 mFullscreenCalloutToken = |
2288 mControlsVisibilityDelegate.showControlsPersistentAndClearOl
dToken( | 2288 mControlsVisibilityDelegate.showControlsPersistentAndClearOl
dToken( |
2289 mFullscreenCalloutToken); | 2289 mFullscreenCalloutToken); |
2290 } | 2290 } |
2291 } | 2291 } |
2292 } | 2292 } |
2293 | 2293 |
OLD | NEW |