summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/dragndrop
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2016-06-06 14:19:02 -0700
committerHyunyoung Song <hyunyoungs@google.com>2016-06-06 14:19:02 -0700
commit645764e3e5fa34d9adcddfc722d726b76f048306 (patch)
tree33f518f8c6c48fb1b497153fc3c547ab56a0c41b /src/com/android/launcher3/dragndrop
parent85fc55a976a1f1605ad22deff74f5ceb080913e6 (diff)
downloadandroid_packages_apps_Trebuchet-645764e3e5fa34d9adcddfc722d726b76f048306.tar.gz
android_packages_apps_Trebuchet-645764e3e5fa34d9adcddfc722d726b76f048306.tar.bz2
android_packages_apps_Trebuchet-645764e3e5fa34d9adcddfc722d726b76f048306.zip
Pull up all apps interaction
First phase implementation: dragging and animation interaction is implemented namely in two classes. ScrollGestureDetector and AllAppsTransitionController. FeatureFlag.LAUNCHER#_ALL_APPS_PULL_UP will be true for only AOSP and not in the extending builds. This way, we can safely iterate without turning it on the shipped ready version. b/28917826 Change-Id: I0501309c0121880ffe0555f82d6ac5a145581bb1
Diffstat (limited to 'src/com/android/launcher3/dragndrop')
-rw-r--r--src/com/android/launcher3/dragndrop/DragController.java3
-rw-r--r--src/com/android/launcher3/dragndrop/DragLayer.java38
2 files changed, 31 insertions, 10 deletions
diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java
index f4470f320..af5ff587a 100644
--- a/src/com/android/launcher3/dragndrop/DragController.java
+++ b/src/com/android/launcher3/dragndrop/DragController.java
@@ -46,6 +46,7 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.accessibility.DragViewStateAnnouncer;
import com.android.launcher3.util.Thunk;
+import com.android.launcher3.util.TouchController;
import java.util.ArrayList;
import java.util.HashSet;
@@ -53,7 +54,7 @@ import java.util.HashSet;
/**
* Class for initiating a drag within a view or across multiple views.
*/
-public class DragController implements DragDriver.EventListener {
+public class DragController implements DragDriver.EventListener, TouchController {
private static final String TAG = "Launcher.DragController";
/** Indicates the drag is a move. */
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index 33ce68313..e4c84360c 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -43,6 +43,7 @@ import android.widget.FrameLayout;
import android.widget.TextView;
import com.android.launcher3.AppWidgetResizeFrame;
+import com.android.launcher3.BaseContainerView;
import com.android.launcher3.CellLayout;
import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.ItemInfo;
@@ -56,10 +57,13 @@ import com.android.launcher3.ShortcutAndWidgetContainer;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
+import com.android.launcher3.allapps.AllAppsContainerView;
+import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.util.Thunk;
+import com.android.launcher3.util.TouchController;
import java.util.ArrayList;
@@ -117,6 +121,11 @@ public class DragLayer extends InsettableFrameLayout {
// Related to pinch-to-go-to-overview gesture.
private PinchToOverviewListener mPinchListener = null;
+
+ // Handles all apps pull up interaction
+ private AllAppsTransitionController mAllAppsController;
+
+ private TouchController mActiveController;
/**
* Used to create a new DragLayer from XML.
*
@@ -138,9 +147,11 @@ public class DragLayer extends InsettableFrameLayout {
mIsRtl = Utilities.isRtl(res);
}
- public void setup(Launcher launcher, DragController controller) {
+ public void setup(Launcher launcher, DragController dragController,
+ AllAppsTransitionController allAppsTransitionController) {
mLauncher = launcher;
- mDragController = controller;
+ mDragController = dragController;
+ mAllAppsController = allAppsTransitionController;
boolean isAccessibilityEnabled = ((AccessibilityManager) mLauncher.getSystemService(
Context.ACCESSIBILITY_SERVICE)).isEnabled();
@@ -246,6 +257,7 @@ public class DragLayer extends InsettableFrameLayout {
public boolean onInterceptTouchEvent(MotionEvent ev) {
int action = ev.getAction();
+
if (action == MotionEvent.ACTION_DOWN) {
if (handleTouchDown(ev, true)) {
return true;
@@ -258,11 +270,21 @@ public class DragLayer extends InsettableFrameLayout {
}
clearAllResizeFrames();
+ if (mDragController.onInterceptTouchEvent(ev)) {
+ mActiveController = mDragController;
+ return true;
+ }
+ if (mAllAppsController.onInterceptTouchEvent(ev)) {
+ mActiveController = mAllAppsController;
+ return true;
+ }
+
if (mPinchListener != null && mPinchListener.onInterceptTouchEvent(ev)) {
// Stop listening for scrolling etc. (onTouchEvent() handles the rest of the pinch.)
+ mActiveController = mPinchListener;
return true;
}
- return mDragController.onInterceptTouchEvent(ev);
+ return false;
}
@Override
@@ -375,11 +397,6 @@ public class DragLayer extends InsettableFrameLayout {
int x = (int) ev.getX();
int y = (int) ev.getY();
- // This is only reached if a pinch was started from onInterceptTouchEvent();
- // this continues sending events for it.
- if (mPinchListener != null) {
- mPinchListener.onTouchEvent(ev);
- }
if (action == MotionEvent.ACTION_DOWN) {
if (handleTouchDown(ev, false)) {
@@ -406,7 +423,10 @@ public class DragLayer extends InsettableFrameLayout {
}
}
if (handled) return true;
- return mDragController.onTouchEvent(ev);
+ if (mActiveController != null) {
+ return mActiveController.onTouchEvent(ev);
+ }
+ return false;
}
@Override