OSDN Git Service

Don't attempt to add item back to folder when deferring drag.
authorTony <twickham@google.com>
Sat, 24 Sep 2016 01:58:37 +0000 (18:58 -0700)
committerTony <twickham@google.com>
Sat, 24 Sep 2016 01:58:37 +0000 (18:58 -0700)
Since the item hasn't yet been removed until the deferred drag
starts, adding it again will throw an exception (the view
already has a parent).

Bug: 30769920
Change-Id: Icb95aaa64e6e3c5dc105bbf3e54460b529d02033

src/com/android/launcher3/folder/Folder.java

index a666b56..ebbe641 100644 (file)
@@ -916,7 +916,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
             if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelfViaIcon && target != this) {
                 replaceFolderWithFinalItem();
             }
-        } else {
+        } else if (!mDragController.isDeferringDrag()) {
             // The drag failed, we need to return the item to the folder
             ShortcutInfo info = (ShortcutInfo) d.dragInfo;
             View icon = (mCurrentDragView != null && mCurrentDragView.getTag() == info)