From 61d50706148026af7aeec857f5791b04000f9f1a Mon Sep 17 00:00:00 2001 From: Chris Banes Date: Wed, 23 Mar 2016 13:11:45 +0000 Subject: [PATCH] Re-dispatch nested scrolls if not implemented Currently the default implementations just swallow the calls. This CL fixes this by re-dispatching them up the tree by default. BUG: 27611756 Change-Id: Ib31938dca34cd956e78d746321716a51cbd9dcd6 --- core/java/android/view/ViewGroup.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 816d9c48539ec..f6958738353b0 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -6749,7 +6749,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager @Override public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { - // Do nothing + // Re-dispatch up the tree by default + dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, null); } /** @@ -6757,7 +6758,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager */ @Override public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) { - // Do nothing + // Re-dispatch up the tree by default + dispatchNestedPreScroll(dx, dy, consumed, null); } /** @@ -6765,7 +6767,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager */ @Override public boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed) { - return false; + // Re-dispatch up the tree by default + return dispatchNestedFling(velocityX, velocityY, consumed); } /** @@ -6773,7 +6776,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager */ @Override public boolean onNestedPreFling(View target, float velocityX, float velocityY) { - return false; + // Re-dispatch up the tree by default + return dispatchNestedPreFling(velocityX, velocityY); } /**