summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/dragndrop/DragLayer.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2017-11-06 13:00:42 -0800
committerSunny Goyal <sunnygoyal@google.com>2017-11-06 14:57:50 -0800
commit85525173ce063305cc2b787fcfcb5f58a14410d4 (patch)
tree6b751863cb67e33811ee89aecd42d9748836fa4f /src/com/android/launcher3/dragndrop/DragLayer.java
parent4dcc2617f5242a80e2e90a4d18c0c911020ddab9 (diff)
downloadandroid_packages_apps_Trebuchet-85525173ce063305cc2b787fcfcb5f58a14410d4.tar.gz
android_packages_apps_Trebuchet-85525173ce063305cc2b787fcfcb5f58a14410d4.tar.bz2
android_packages_apps_Trebuchet-85525173ce063305cc2b787fcfcb5f58a14410d4.zip
Rearranging the code structure to allow replacing state logic.
Change-Id: I6f83d0f77045ba189f02dd465bf70ffc2a239aa1
Diffstat (limited to 'src/com/android/launcher3/dragndrop/DragLayer.java')
-rw-r--r--src/com/android/launcher3/dragndrop/DragLayer.java34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index 0f0b20d2b..8189b236e 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -42,17 +42,15 @@ import com.android.launcher3.CellLayout;
import com.android.launcher3.DropTargetBar;
import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.Launcher;
-import com.android.launcher3.PinchToOverviewListener;
import com.android.launcher3.R;
import com.android.launcher3.ShortcutAndWidgetContainer;
import com.android.launcher3.Utilities;
-import com.android.launcher3.VerticalSwipeController;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.anim.Interpolators;
-import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
+import com.android.launcher3.uioverrides.UiFactory;
import com.android.launcher3.util.Themes;
import com.android.launcher3.util.Thunk;
import com.android.launcher3.util.TouchController;
@@ -92,13 +90,10 @@ public class DragLayer extends InsettableFrameLayout {
private final ViewGroupFocusHelper mFocusIndicatorHelper;
private final PageCutOutScrimDrawable mPageCutOutScrim;
- // Related to pinch-to-go-to-overview gesture.
- private PinchToOverviewListener mPinchListener = null;
-
// Handles all apps pull up interaction
private AllAppsTransitionController mAllAppsController;
- private VerticalSwipeController mVerticalSwipeController;
+ protected TouchController[] mControllers;
private TouchController mActiveController;
/**
* Used to create a new DragLayer from XML.
@@ -123,11 +118,7 @@ public class DragLayer extends InsettableFrameLayout {
mLauncher = launcher;
mDragController = dragController;
mAllAppsController = allAppsTransitionController;
- mVerticalSwipeController = new VerticalSwipeController(mLauncher);
-
- boolean isAccessibilityEnabled = ((AccessibilityManager) mLauncher.getSystemService(
- Context.ACCESSIBILITY_SERVICE)).isEnabled();
- onAccessibilityStateChanged(isAccessibilityEnabled);
+ mControllers = UiFactory.createTouchControllers(mLauncher);
}
public ViewGroupFocusHelper getFocusIndicatorHelper() {
@@ -144,11 +135,6 @@ public class DragLayer extends InsettableFrameLayout {
return super.verifyDrawable(who) || who == mPageCutOutScrim;
}
- public void onAccessibilityStateChanged(boolean isAccessibilityEnabled) {
- mPinchListener = FeatureFlags.LAUNCHER3_DISABLE_PINCH_TO_OVERVIEW || isAccessibilityEnabled
- ? null : new PinchToOverviewListener(mLauncher);
- }
-
public boolean isEventOverHotseat(MotionEvent ev) {
return isEventOverView(mLauncher.getHotseat(), ev);
}
@@ -194,15 +180,11 @@ public class DragLayer extends InsettableFrameLayout {
return true;
}
- if (mVerticalSwipeController.onControllerInterceptTouchEvent(ev)) {
- mActiveController = mVerticalSwipeController;
- return true;
- }
-
- if (mPinchListener != null && mPinchListener.onControllerInterceptTouchEvent(ev)) {
- // Stop listening for scrolling etc. (onTouchEvent() handles the rest of the pinch.)
- mActiveController = mPinchListener;
- return true;
+ for (TouchController controller : mControllers) {
+ if (controller.onControllerInterceptTouchEvent(ev)) {
+ mActiveController = controller;
+ return true;
+ }
}
return false;
}