Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2608)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java

Issue 2276793003: Dispatch touch events to the NewTabPageView if the toolbar is moved away. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue631976
Patch Set: x Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java
index a67ab2612805febda6e7962d0695a011bf615dda..4e47411d14e12fad5dae7730e8133f32d9d312de 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java
@@ -452,10 +452,23 @@ public class ToolbarPhone extends ToolbarLayout
&& mNtpSearchBoxScrollPercent != UNINITIALIZED_PERCENT) {
return true;
}
+
return super.onInterceptTouchEvent(ev);
}
@Override
+ public boolean onTouchEvent(MotionEvent ev) {
+ // Forward touch events to the NTP if the toolbar is moved away.
+ if (mNtpSearchBoxTranslation.y < 0) {
+ NewTabPage newTabPage = getToolbarDataProvider().getNewTabPageForCurrentTab();
+
+ // No null check -- the toolbar should not be moved if we are not on an NTP.
+ return newTabPage.getView().dispatchTouchEvent(ev);
+ }
+ return super.onTouchEvent(ev);
+ }
+
+ @Override
public void onClick(View v) {
if (mToggleTabStackButton == v) {
// The button is clickable before the native library is loaded
@@ -876,6 +889,7 @@ public class ToolbarPhone extends ToolbarLayout
*/
private void resetNtpAnimationValues() {
mLocationBarBackgroundNtpOffset.setEmpty();
+ mNtpSearchBoxTranslation.set(0, 0);
mLocationBar.setTranslationY(0);
if (!mUrlFocusChangeInProgress) {
mToolbarButtonsContainer.setTranslationY(0);
@@ -2076,6 +2090,8 @@ public class ToolbarPhone extends ToolbarLayout
if (!visualStateChanged) {
if (mVisualState == VisualState.NEW_TAB_NORMAL) {
updateNtpTransitionAnimation();
+ } else {
+ resetNtpAnimationValues();
}
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698