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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 && mNtpSearchBoxScrollPercent != 1f | 445 && mNtpSearchBoxScrollPercent != 1f |
446 && mNtpSearchBoxScrollPercent != UNINITIALIZED_PERCENT) { | 446 && mNtpSearchBoxScrollPercent != UNINITIALIZED_PERCENT) { |
447 return true; | 447 return true; |
448 } | 448 } |
449 | 449 |
450 return super.onInterceptTouchEvent(ev); | 450 return super.onInterceptTouchEvent(ev); |
451 } | 451 } |
452 | 452 |
453 @Override | 453 @Override |
454 public boolean onTouchEvent(MotionEvent ev) { | 454 public boolean onTouchEvent(MotionEvent ev) { |
455 // Forward touch events to the NTP if the toolbar is moved away. | 455 // Forward touch events to the NTP if the toolbar is moved away but the
search box hasn't |
456 if (mNtpSearchBoxTranslation.y < 0) { | 456 // reached the top of the page yet. |
| 457 if (mNtpSearchBoxTranslation.y < 0 && mLocationBar.getTranslationY() > 0
) { |
457 NewTabPage newTabPage = getToolbarDataProvider().getNewTabPageForCur
rentTab(); | 458 NewTabPage newTabPage = getToolbarDataProvider().getNewTabPageForCur
rentTab(); |
458 | 459 |
459 // No null check -- the toolbar should not be moved if we are not on
an NTP. | 460 // No null check -- the toolbar should not be moved if we are not on
an NTP. |
460 return newTabPage.getView().dispatchTouchEvent(ev); | 461 return newTabPage.getView().dispatchTouchEvent(ev); |
461 } | 462 } |
462 return super.onTouchEvent(ev); | 463 return super.onTouchEvent(ev); |
463 } | 464 } |
464 | 465 |
465 @Override | 466 @Override |
466 public void onClick(View v) { | 467 public void onClick(View v) { |
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2235 }); | 2236 }); |
2236 | 2237 |
2237 if (mFullscreenManager != null) { | 2238 if (mFullscreenManager != null) { |
2238 mFullscreenCalloutToken = | 2239 mFullscreenCalloutToken = |
2239 mFullscreenManager.showControlsPersistentAndClearOldToken( | 2240 mFullscreenManager.showControlsPersistentAndClearOldToken( |
2240 mFullscreenCalloutToken); | 2241 mFullscreenCalloutToken); |
2241 } | 2242 } |
2242 } | 2243 } |
2243 } | 2244 } |
2244 | 2245 |
OLD | NEW |