diff options
author | Tony Wickham <twickham@google.com> | 2016-09-28 12:49:25 -0700 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2016-10-04 12:26:35 -0700 |
commit | 10236d6ac7f5f787ca21736494ccb5eaf2bd7c27 (patch) | |
tree | 5caed1278efbd05aa9a99f5be8afd38e025569b3 /src/com/android/launcher3/folder | |
parent | 59769e3331f36fd63134825b5155035e32413469 (diff) | |
download | android_packages_apps_Trebuchet-10236d6ac7f5f787ca21736494ccb5eaf2bd7c27.tar.gz android_packages_apps_Trebuchet-10236d6ac7f5f787ca21736494ccb5eaf2bd7c27.tar.bz2 android_packages_apps_Trebuchet-10236d6ac7f5f787ca21736494ccb5eaf2bd7c27.zip |
Update pre-drag lifecycle for apps with shortcuts.
- First of all, deferred drag has been renamed to pre-drag
to avoid confusion with the existing deferred end drag.
- For normal drags, the cycle is still startDrag -->
onDragStart --> onDrop --> onDropComplete --> onDragEnd.
- Pre-drags have two additional callbacks: onPreDragStart
and onPreDragEnd. onPreDragStart is called between
startDrag and onDragStart, and onPreDragEnd is called
at the same time as onDragStart or onDragEnd.
- If the pre-drag has not transitioned to a full drag before
onDragEnd, onDragStart and onDropComplete are skipped
(onDrop is still called to allow the DragView to animate).
Change-Id: Icd7a8f75d5fcc159f9a52758c22ab6eae3edb9e2
Diffstat (limited to 'src/com/android/launcher3/folder')
-rw-r--r-- | src/com/android/launcher3/folder/Folder.java | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index ebbe64127..4fe351368 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -281,17 +281,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList public boolean onLongClick(View v) { // Return if global dragging is not enabled if (!mLauncher.isDraggingEnabled()) return true; - DragOptions dragOptions = new DragOptions(); - if (v instanceof BubbleTextView) { - BubbleTextView icon = (BubbleTextView) v; - if (icon.hasDeepShortcuts()) { - DeepShortcutsContainer dsc = DeepShortcutsContainer.showForIcon(icon); - if (dsc != null) { - dragOptions.deferDragCondition = dsc.createDeferDragCondition(null); - } - } - } - return startDrag(v, dragOptions); + return startDrag(v, new DragOptions()); } public boolean startDrag(View v, DragOptions options) { @@ -916,7 +906,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelfViaIcon && target != this) { replaceFolderWithFinalItem(); } - } else if (!mDragController.isDeferringDrag()) { + } else { // The drag failed, we need to return the item to the folder ShortcutInfo info = (ShortcutInfo) d.dragInfo; View icon = (mCurrentDragView != null && mCurrentDragView.getTag() == info) @@ -1309,7 +1299,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList mIsExternalDrag = false; } else { currentDragView = mCurrentDragView; - if (!mDragController.isDeferringDrag()) { + // The view was never removed from this folder if we are still in the pre-drag. + if (!mDragController.isInPreDrag()) { mContent.addViewForRank(currentDragView, si, mEmptyCellRank); } } @@ -1332,7 +1323,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList mItemsInvalidated = true; rearrangeChildren(); - if (!mDragController.isDeferringDrag()) { + // The ShortcutInfo was never removed if we are still in the pre-drag. + if (!mDragController.isInPreDrag()) { // Temporarily suppress the listener, as we did all the work already here. try (SuppressInfoChanges s = new SuppressInfoChanges()) { mInfo.add(si, false); |