use of com.android.launcher3.widget.WidgetImageView in project android_packages_apps_Launcher3 by AOSPA.
the class BaseWidgetSheet method beginDraggingWidget.
private boolean beginDraggingWidget(WidgetCell v) {
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.NO_DROP_TARGET, "2");
}
// 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);
// RemoteViews are being rendered in AppWidgetHostView in WidgetCell. And thus, the scale of
// RemoteViews is equivalent to the AppWidgetHostView scale.
dragHelper.setRemoteViewsPreview(v.getRemoteViewsPreview(), v.getAppWidgetHostViewScale());
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 {
NavigableAppWidgetHostView preview = v.getAppWidgetHostViewPreview();
int[] loc = new int[2];
getPopupContainer().getLocationInDragLayer(preview, loc);
Rect r = new Rect();
preview.getWorkspaceVisualDragBounds(r);
dragHelper.startDrag(r, preview.getMeasuredWidth(), preview.getMeasuredWidth(), new Point(loc[0], loc[1]), this, new DragOptions());
}
close(true);
return true;
}
Aggregations