| 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 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1674 if (childView == mPhoneLocationBar.getFirstViewVisibleWhenFocused())
break; | 1674 if (childView == mPhoneLocationBar.getFirstViewVisibleWhenFocused())
break; |
| 1675 animator = ObjectAnimator.ofFloat(childView, ALPHA, 1); | 1675 animator = ObjectAnimator.ofFloat(childView, ALPHA, 1); |
| 1676 animator.setStartDelay(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); | 1676 animator.setStartDelay(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); |
| 1677 animator.setDuration(URL_CLEAR_FOCUS_MENU_DELAY_MS); | 1677 animator.setDuration(URL_CLEAR_FOCUS_MENU_DELAY_MS); |
| 1678 animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); | 1678 animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); |
| 1679 animators.add(animator); | 1679 animators.add(animator); |
| 1680 } | 1680 } |
| 1681 | 1681 |
| 1682 if (isLocationBarShownInNTP() && mNtpSearchBoxScrollPercent == 0f) retur
n; | 1682 if (isLocationBarShownInNTP() && mNtpSearchBoxScrollPercent == 0f) retur
n; |
| 1683 | 1683 |
| 1684 if (!FeatureUtilities.isDocumentMode(getContext()) | 1684 // The call to getLayout() can return null briefly during text changes,
but as it |
| 1685 || mPhoneLocationBar.showingQueryInTheOmnibox()) { | 1685 // is only needed for RTL calculations, we proceed if the location bar i
s showing |
| 1686 // The call to getLayout() can return null briefly during text chang
es, but as it | 1686 // LTR content. |
| 1687 // is only needed for RTL calculations, we proceed if the location b
ar is showing | 1687 boolean isLocationBarRtl = ApiCompatibilityUtils.isLayoutRtl(mPhoneLocat
ionBar); |
| 1688 // LTR content. | 1688 if (!isLocationBarRtl || mUrlBar.getLayout() != null) { |
| 1689 boolean isLocationBarRtl = ApiCompatibilityUtils.isLayoutRtl(mPhoneL
ocationBar); | 1689 int urlBarStartScrollX = 0; |
| 1690 if (!isLocationBarRtl || mUrlBar.getLayout() != null) { | 1690 if (isLocationBarRtl) { |
| 1691 int urlBarStartScrollX = 0; | 1691 urlBarStartScrollX = (int) mUrlBar.getLayout().getPrimaryHorizon
tal(0); |
| 1692 if (isLocationBarRtl) { | 1692 urlBarStartScrollX -= mUrlBar.getWidth(); |
| 1693 urlBarStartScrollX = (int) mUrlBar.getLayout().getPrimaryHor
izontal(0); | 1693 } |
| 1694 urlBarStartScrollX -= mUrlBar.getWidth(); | |
| 1695 } | |
| 1696 | 1694 |
| 1697 // If the scroll position matches the current scroll position, d
o not trigger | 1695 // If the scroll position matches the current scroll position, do no
t trigger |
| 1698 // this animation as it will cause visible jumps when going from
cleared text | 1696 // this animation as it will cause visible jumps when going from cle
ared text |
| 1699 // back to page URLs (despite it continually calling setScrollX
with the same | 1697 // back to page URLs (despite it continually calling setScrollX with
the same |
| 1700 // number). | 1698 // number). |
| 1701 if (mUrlBar.getScrollX() != urlBarStartScrollX) { | 1699 if (mUrlBar.getScrollX() != urlBarStartScrollX) { |
| 1702 animator = ObjectAnimator.ofInt( | 1700 animator = ObjectAnimator.ofInt( |
| 1703 mUrlBar, | 1701 mUrlBar, |
| 1704 buildUrlScrollProperty(mPhoneLocationBar, isLocation
BarRtl), | 1702 buildUrlScrollProperty(mPhoneLocationBar, isLocationBarR
tl), |
| 1705 urlBarStartScrollX); | 1703 urlBarStartScrollX); |
| 1706 animator.setDuration(URL_FOCUS_CHANGE_ANIMATION_DURATION_MS)
; | 1704 animator.setDuration(URL_FOCUS_CHANGE_ANIMATION_DURATION_MS); |
| 1707 animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_C
URVE); | 1705 animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE
); |
| 1708 animators.add(animator); | 1706 animators.add(animator); |
| 1709 } | |
| 1710 } | 1707 } |
| 1711 } | 1708 } |
| 1712 } | 1709 } |
| 1713 | 1710 |
| 1714 @Override | 1711 @Override |
| 1715 public void onUrlFocusChange(final boolean hasFocus) { | 1712 public void onUrlFocusChange(final boolean hasFocus) { |
| 1716 super.onUrlFocusChange(hasFocus); | 1713 super.onUrlFocusChange(hasFocus); |
| 1717 | 1714 |
| 1718 triggerUrlFocusAnimation(hasFocus); | 1715 triggerUrlFocusAnimation(hasFocus); |
| 1719 | 1716 |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2211 }); | 2208 }); |
| 2212 | 2209 |
| 2213 if (mFullscreenManager != null) { | 2210 if (mFullscreenManager != null) { |
| 2214 mFullscreenCalloutToken = | 2211 mFullscreenCalloutToken = |
| 2215 mFullscreenManager.showControlsPersistentAndClearOldToken( | 2212 mFullscreenManager.showControlsPersistentAndClearOldToken( |
| 2216 mFullscreenCalloutToken); | 2213 mFullscreenCalloutToken); |
| 2217 } | 2214 } |
| 2218 } | 2215 } |
| 2219 } | 2216 } |
| 2220 | 2217 |
| OLD | NEW |