From 514e4c750ffe8e9049f64fe86c61a7e5d6872f15 Mon Sep 17 00:00:00 2001 From: Joey Date: Sun, 4 Feb 2018 11:36:32 +0100 Subject: Trebuchet: allow disabling workspace edit Change-Id: I503e19cbc512eac0e4a8c8bccc16a6ccc0e805da Signed-off-by: Joey --- src/com/android/launcher3/dragndrop/DragController.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/com/android/launcher3/dragndrop/DragController.java') diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java index 8a216fc17..97c0fa916 100644 --- a/src/com/android/launcher3/dragndrop/DragController.java +++ b/src/com/android/launcher3/dragndrop/DragController.java @@ -37,6 +37,7 @@ import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.ShortcutInfo; +import com.android.launcher3.Utilities; import com.android.launcher3.accessibility.DragViewStateAnnouncer; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.Thunk; @@ -407,10 +408,18 @@ public class DragController implements DragDriver.EventListener, TouchController * Call this from a drag source view. */ public boolean onControllerInterceptTouchEvent(MotionEvent ev) { + boolean isEditDisabled = !Utilities.isWorkspaceEditAllowed( + mLauncher.getApplicationContext()); + if (mOptions != null && mOptions.isAccessibleDrag) { return false; } + if (isEditDisabled) { + cancelDrag(); + return false; + } + // Update the velocity tracker mFlingToDeleteHelper.recordMotionEvent(ev); -- cgit v1.2.3