diff options
author | Hyunyoung Song <hyunyoungs@google.com> | 2016-09-16 19:34:39 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-09-16 19:34:40 +0000 |
commit | 80e6aa4b014a669a8e371181174166d6d118a8fc (patch) | |
tree | 4b7606091445b91998be12669416dce9a7f58c41 /src/com | |
parent | f595f3de0fb166f5b4d43f885b63dccaaa9efd5b (diff) | |
parent | f99370c2a9cbe340f340a15a5f065166de9f809a (diff) | |
download | android_packages_apps_Trebuchet-80e6aa4b014a669a8e371181174166d6d118a8fc.tar.gz android_packages_apps_Trebuchet-80e6aa4b014a669a8e371181174166d6d118a8fc.tar.bz2 android_packages_apps_Trebuchet-80e6aa4b014a669a8e371181174166d6d118a8fc.zip |
Merge "Fixing issue where overview->normal workspace mode cannot be done by tapping b/31458165" into ub-launcher3-calgary-polish
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 35 | ||||
-rw-r--r-- | src/com/android/launcher3/util/VerticalFlingDetector.java | 3 |
2 files changed, 27 insertions, 11 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 0bb8cbfb9..c499beeb3 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -594,18 +594,31 @@ public class Workspace extends PagedView } // Add the first page CellLayout firstPage = insertNewWorkspaceScreen(Workspace.FIRST_SCREEN_ID, 0); - final VerticalFlingDetector detector = new VerticalFlingDetector(mLauncher){ - @Override - public boolean onTouch(View v, MotionEvent ev) { - if (shouldConsumeTouch(v)) return true; - if (super.onTouch(v, ev)) { - mLauncher.startSearch("", false, null, false); + if (FeatureFlags.PULLDOWN_SEARCH) { + firstPage.setOnTouchListener(new VerticalFlingDetector(mLauncher) { + // detect fling when touch started from empty space + @Override + public boolean onTouch(View v, MotionEvent ev) { + if (workspaceInModalState()) return false; + if (shouldConsumeTouch(v)) return true; + if (super.onTouch(v, ev)) { + mLauncher.startSearch("", false, null, false); + } + return false; } - return false; - } - }; - firstPage.setOnTouchListener(detector); - firstPage.setOnInterceptTouchListener(detector); + }); + firstPage.setOnInterceptTouchListener(new VerticalFlingDetector(mLauncher) { + // detect fling when touch started from on top of the icons + @Override + public boolean onTouch(View v, MotionEvent ev) { + if (shouldConsumeTouch(v)) return true; + if (super.onTouch(v, ev)) { + mLauncher.startSearch("", false, null, false); + } + return false; + } + }); + } // Always add a QSB on the first screen. if (qsb == null) { // In transposed layout, we add the QSB in the Grid. As workspace does not touch the diff --git a/src/com/android/launcher3/util/VerticalFlingDetector.java b/src/com/android/launcher3/util/VerticalFlingDetector.java index 5f2b3f3ac..7236c2d1b 100644 --- a/src/com/android/launcher3/util/VerticalFlingDetector.java +++ b/src/com/android/launcher3/util/VerticalFlingDetector.java @@ -79,6 +79,9 @@ public class VerticalFlingDetector implements View.OnTouchListener { } private void cleanUp() { + if (mVelocityTracker == null) { + return; + } mVelocityTracker.recycle(); mVelocityTracker = null; } |