Chromium Code Reviews| 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 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 871 mNtpSearchBoxScrollPercent = UNINITIALIZED_PERCENT; | 871 mNtpSearchBoxScrollPercent = UNINITIALIZED_PERCENT; |
| 872 updateUrlExpansionPercent(); | 872 updateUrlExpansionPercent(); |
| 873 } | 873 } |
| 874 | 874 |
| 875 private void updateNtpTransitionAnimation(NewTabPage ntp) { | 875 private void updateNtpTransitionAnimation(NewTabPage ntp) { |
| 876 if (mIsInTabSwitcherMode) return; | 876 if (mIsInTabSwitcherMode) return; |
| 877 | 877 |
| 878 setAncestorsShouldClipChildren(mUrlExpansionPercent == 0f); | 878 setAncestorsShouldClipChildren(mUrlExpansionPercent == 0f); |
| 879 mToolbarShadow.setAlpha(0f); | 879 mToolbarShadow.setAlpha(0f); |
| 880 | 880 |
| 881 float growthPercent = 0f; | 881 final float growthPercent = Math.min(1f, 1f - mUrlExpansionPercent); |
|
Bernhard Bauer
2016/06/28 14:00:17
|mUrlExpansionPercent| is always going to be betwe
PEConn
2016/06/28 14:32:51
Done.
| |
| 882 if (mUrlExpansionPercent == 0f || mUrlExpansionPercent == 1f) { | |
| 883 growthPercent = 1f - mUrlExpansionPercent; | |
| 884 } else { | |
| 885 // During the transition from search box to omnibox, keep the omnibo x drawing | |
| 886 // at the same size of the search box for first 40% of the scroll tr ansition. | |
| 887 growthPercent = mUrlExpansionPercent <= 0.4f | |
| 888 ? 1f : Math.min(1f, (1f - mUrlExpansionPercent) * 1.66667f); | |
| 889 } | |
| 890 | 882 |
| 891 int paddingTop = mPhoneLocationBar.getPaddingTop(); | 883 int paddingTop = mPhoneLocationBar.getPaddingTop(); |
| 892 int paddingBottom = mPhoneLocationBar.getPaddingBottom(); | 884 int paddingBottom = mPhoneLocationBar.getPaddingBottom(); |
| 893 | 885 |
| 894 ntp.getSearchBoxBounds(mNtpSearchBoxOriginalBounds, mNtpSearchBoxTransfo rmedBounds); | 886 ntp.getSearchBoxBounds(mNtpSearchBoxOriginalBounds, mNtpSearchBoxTransfo rmedBounds); |
| 895 float halfHeightDifference = (mNtpSearchBoxTransformedBounds.height() | 887 float halfHeightDifference = (mNtpSearchBoxTransformedBounds.height() |
| 896 - (mPhoneLocationBar.getMeasuredHeight() - paddingTop - paddingB ottom | 888 - (mPhoneLocationBar.getMeasuredHeight() - paddingTop - paddingB ottom |
| 897 + mLocationBarInsets)) / 2f; | 889 + mLocationBarInsets)) / 2f; |
| 898 mPhoneLocationBar.setTranslationY(growthPercent == 0f ? 0 : Math.max(0, | 890 mPhoneLocationBar.setTranslationY(growthPercent == 0f ? 0 : Math.max(0, |
| 899 (mNtpSearchBoxTransformedBounds.top - mPhoneLocationBar.getTop() | 891 (mNtpSearchBoxTransformedBounds.top - mPhoneLocationBar.getTop() |
| (...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2209 }); | 2201 }); |
| 2210 | 2202 |
| 2211 if (mFullscreenManager != null) { | 2203 if (mFullscreenManager != null) { |
| 2212 mFullscreenCalloutToken = | 2204 mFullscreenCalloutToken = |
| 2213 mFullscreenManager.showControlsPersistentAndClearOldToken( | 2205 mFullscreenManager.showControlsPersistentAndClearOldToken( |
| 2214 mFullscreenCalloutToken); | 2206 mFullscreenCalloutToken); |
| 2215 } | 2207 } |
| 2216 } | 2208 } |
| 2217 } | 2209 } |
| 2218 | 2210 |
| OLD | NEW |