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
This commit is contained in:
Sunny Goyal committed 2016-09-01 15:55:13 -07:00
1 parent 61bcfba335
commit 94b510cc68
14 files changed
+224 -173

No files matched your search

@@ -25,6 +25,7 @@ import android.view.View;
import android.view.animation.AnimationUtils;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.util.FlingAnimation;
import com.android.launcher3.util.Thunk;
@@ -49,9 +50,9 @@ public class DeleteDropTarget extends ButtonDropTarget {
}
@Override
public void onDragStart(DragSource source, ItemInfo info, int dragAction) {
super.onDragStart(source, info, dragAction);
setTextBasedOnDragSource(source);
public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
super.onDragStart(dragObject, options);
setTextBasedOnDragSource(dragObject.dragSource);
}
/** @return true for items that should have a "Remove" action in accessibility. */