use of com.android.launcher3.dragndrop.DragOptions in project android_packages_apps_Launcher3 by crdroidandroid.
the class ItemLongClickListener method beginDrag.
public static void beginDrag(View v, Launcher launcher, ItemInfo info, DragOptions dragOptions) {
if (info.container >= 0) {
Folder folder = Folder.getOpen(launcher);
if (folder != null) {
if (!folder.getIconsInReadingOrder().contains(v)) {
folder.close(true);
} else {
folder.startDrag(v, dragOptions);
return;
}
}
}
CellLayout.CellInfo longClickCellInfo = new CellLayout.CellInfo(v, info);
launcher.getWorkspace().startDrag(longClickCellInfo, dragOptions);
}
use of com.android.launcher3.dragndrop.DragOptions in project android_packages_apps_Launcher3 by crdroidandroid.
the class BaseWidgetSheet method beginDraggingWidget.
private boolean beginDraggingWidget(WidgetCell v) {
// Get the widget preview as the drag representation
WidgetImageView image = v.getWidgetView();
// we abort the drag.
if (image.getDrawable() == null && v.getAppWidgetHostViewPreview() == null) {
return false;
}
PendingItemDragHelper dragHelper = new PendingItemDragHelper(v);
dragHelper.setRemoteViewsPreview(v.getRemoteViewsPreview());
dragHelper.setAppWidgetHostViewPreview(v.getAppWidgetHostViewPreview());
if (image.getDrawable() != null) {
int[] loc = new int[2];
getPopupContainer().getLocationInDragLayer(image, loc);
dragHelper.startDrag(image.getBitmapBounds(), image.getDrawable().getIntrinsicWidth(), image.getWidth(), new Point(loc[0], loc[1]), this, new DragOptions());
} else {
View preview = v.getAppWidgetHostViewPreview();
int[] loc = new int[2];
getPopupContainer().getLocationInDragLayer(preview, loc);
Rect r = new Rect(0, 0, preview.getWidth(), preview.getHeight());
dragHelper.startDrag(r, preview.getMeasuredWidth(), preview.getMeasuredWidth(), new Point(loc[0], loc[1]), this, new DragOptions());
}
close(true);
return true;
}
Aggregations