summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/widget/WidgetsContainerView.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-08-11 16:02:02 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-08-15 10:08:16 -0700
commit06e21a25877db7207b5393ab163028bb4116df4f (patch)
tree561c8fa4afcbeb024082f2c6947a538cd54eff9e /src/com/android/launcher3/widget/WidgetsContainerView.java
parent8769b44ae073ea7ec5ba5b7687105df6d35c3282 (diff)
downloadandroid_packages_apps_Trebuchet-06e21a25877db7207b5393ab163028bb4116df4f.tar.gz
android_packages_apps_Trebuchet-06e21a25877db7207b5393ab163028bb4116df4f.tar.bz2
android_packages_apps_Trebuchet-06e21a25877db7207b5393ab163028bb4116df4f.zip
Moving the state changes during drag-n-drop from startDrag to onDragStart
This will allow drag controller to optinally defer drag, based on some threshold, by simply deferring the callback onDragStart Change-Id: I17c06a15e2092b9797c7e57529b12a53d2acae6e
Diffstat (limited to 'src/com/android/launcher3/widget/WidgetsContainerView.java')
-rw-r--r--src/com/android/launcher3/widget/WidgetsContainerView.java15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/com/android/launcher3/widget/WidgetsContainerView.java b/src/com/android/launcher3/widget/WidgetsContainerView.java
index 34bee1b47..352cea479 100644
--- a/src/com/android/launcher3/widget/WidgetsContainerView.java
+++ b/src/com/android/launcher3/widget/WidgetsContainerView.java
@@ -205,7 +205,7 @@ public class WidgetsContainerView extends BaseContainerView
// Compose the drag image
Bitmap preview;
- float scale = 1f;
+ final float scale;
final Rect bounds = image.getBitmapBounds();
if (createItemInfo instanceof PendingAddWidgetInfo) {
@@ -242,19 +242,14 @@ public class WidgetsContainerView extends BaseContainerView
scale = ((float) mLauncher.getDeviceProfile().iconSizePx) / preview.getWidth();
}
- // Don't clip alpha values for the drag outline if we're using the default widget preview
- boolean clipAlpha = !(createItemInfo instanceof PendingAddWidgetInfo &&
- (((PendingAddWidgetInfo) createItemInfo).previewImage == 0));
+ // Since we are not going through the workspace for starting the drag, set drag related
+ // information on the workspace before starting the drag.
+ mLauncher.getWorkspace().prepareDragWithProvider(
+ new PendingItemPreviewProvider(v, createItemInfo, preview));
// Start the drag
- mLauncher.lockScreenOrientation();
mDragController.startDrag(image, preview, this, createItemInfo,
bounds, DragController.DRAG_ACTION_COPY, scale);
- // This call expects the extra empty screen to already be created, which is why we call it
- // after mDragController.startDrag().
- mLauncher.getWorkspace().onDragStartedWithItem(createItemInfo, preview, clipAlpha);
-
- preview.recycle();
return true;
}