summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-08-16 15:36:48 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-09-01 15:55:13 -0700
commit94b510cc683a6436ae82c6d323cbd8b429561b06 (patch)
tree7f5c31eed6030bea083d1b77396478bbe5f35e7c /src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
parent61bcfba33598ddd0bc59910ab758fcd51d770502 (diff)
downloadandroid_packages_apps_Trebuchet-94b510cc683a6436ae82c6d323cbd8b429561b06.tar.gz
android_packages_apps_Trebuchet-94b510cc683a6436ae82c6d323cbd8b429561b06.tar.bz2
android_packages_apps_Trebuchet-94b510cc683a6436ae82c6d323cbd8b429561b06.zip
Some drag and drop code refactor:
1) Adding DragOptions to easily extend drap functionality 2) Changing onDragStarted signature to send more information 3) Updating states for dropTargetButton based on drag event directly 4) Removing folder item based on onDragStarted and not startDrag Change-Id: I65b684e092ddc081d086bfe2c8c1973ed170eaeb
Diffstat (limited to 'src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java')
-rw-r--r--src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java36
1 files changed, 13 insertions, 23 deletions
diff --git a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
index 0562cf54b..173aad044 100644
--- a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
+++ b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
@@ -22,6 +22,8 @@ import com.android.launcher3.BubbleTextView;
import com.android.launcher3.CellLayout;
import com.android.launcher3.DeleteDropTarget;
import com.android.launcher3.DragSource;
+import com.android.launcher3.DropTarget.DragObject;
+import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.FolderInfo;
import com.android.launcher3.InfoDropTarget;
@@ -73,7 +75,6 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate impleme
@Thunk final Launcher mLauncher;
private DragInfo mDragInfo = null;
- private AccessibilityDragSource mDragSource = null;
public LauncherAccessibilityDelegate(Launcher launcher) {
mLauncher = launcher;
@@ -372,26 +373,25 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate impleme
Folder folder = workspace.getOpenFolder();
if (folder != null) {
- if (folder.getItemsInReadingOrder().contains(item)) {
- mDragSource = folder;
- } else {
+ if (!folder.getItemsInReadingOrder().contains(item)) {
mLauncher.closeFolder();
+ folder = null;
}
}
- if (mDragSource == null) {
- mDragSource = workspace;
- }
- mDragSource.enableAccessibleDrag(true);
- mDragSource.startDrag(cellInfo, true);
- if (mLauncher.getDragController().isDragging()) {
- mLauncher.getDragController().addDragListener(this);
+ mLauncher.getDragController().addDragListener(this);
+
+ DragOptions options = new DragOptions();
+ options.isAccessibleDrag = true;
+ if (folder != null) {
+ folder.startDrag(cellInfo.cell, options);
+ } else {
+ workspace.startDrag(cellInfo, options);
}
}
-
@Override
- public void onDragStart(DragSource source, ItemInfo info, int dragAction) {
+ public void onDragStart(DragObject dragObject, DragOptions options) {
// No-op
}
@@ -399,16 +399,6 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate impleme
public void onDragEnd() {
mLauncher.getDragController().removeDragListener(this);
mDragInfo = null;
- if (mDragSource != null) {
- mDragSource.enableAccessibleDrag(false);
- mDragSource = null;
- }
- }
-
- public static interface AccessibilityDragSource {
- void startDrag(CellLayout.CellInfo cellInfo, boolean accessible);
-
- void enableAccessibleDrag(boolean enable);
}
/**