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
2016-08-16 15:36:48 -07:00
parent 61bcfba335
commit 94b510cc68
14 changed files with 224 additions and 173 deletions

View File

@@ -27,6 +27,7 @@ import android.view.animation.AccelerateInterpolator;
import android.widget.LinearLayout;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragOptions;
/*
* The top bar containing various drop targets: Delete/App Info/Uninstall.
@@ -120,17 +121,11 @@ public class DropTargetBar extends LinearLayout implements DragController.DragLi
}
}
public void enableAccessibleDrag(boolean enable) {
mDeleteDropTarget.enableAccessibleDrag(enable);
mAppInfoDropTarget.enableAccessibleDrag(enable);
mUninstallDropTarget.enableAccessibleDrag(enable);
}
/*
* DragController.DragListener implementation
*/
@Override
public void onDragStart(DragSource source, ItemInfo info, int dragAction) {
public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
animateToVisibility(true);
}