From d3fbe683bb52c8be9a14783bb70f32a46cf6f6db Mon Sep 17 00:00:00 2001 From: Jan-Willem Maarse Date: Tue, 19 Aug 2014 15:27:48 -0700 Subject: [PATCH] Ignore generic motion events if custom content doesn't allow scrolling If the custom content screen is selected and it doesn't allow scrolling, the workspace should ignore generic motion events instead of trying to scroll to the next page. Change-Id: Iee9c7e02bf7c78648b574a01c83dcb76c0b62855 --- src/com/android/launcher3/Workspace.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 53a3f948d3..7adb46db42 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -1114,6 +1114,17 @@ public class Workspace extends SmoothPagedView return super.onInterceptTouchEvent(ev); } + @Override + public boolean onGenericMotionEvent(MotionEvent event) { + // Ignore pointer scroll events if the custom content doesn't allow scrolling. + if ((getScreenIdForPageIndex(getCurrentPage()) == CUSTOM_CONTENT_SCREEN_ID) + && (mCustomContentCallbacks != null) + && !mCustomContentCallbacks.isScrollingAllowed()) { + return false; + } + return super.onGenericMotionEvent(event); + } + protected void reinflateWidgetsIfNecessary() { final int clCount = getChildCount(); for (int i = 0; i < clCount; i++) {