Scale down drag views in spring-loaded workspace.
Bug: 24190193
Change-Id: Ic490fc3f46702c3d5360e869c4172f31700085a1
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index d391b06..c6b6752 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -415,6 +415,10 @@
mLauncher.onInteractionEnd();
}
+ public float getSpringLoadedShrinkFactor() {
+ return mSpringLoadedShrinkFactor;
+ }
+
/**
* Initializes various states for this workspace.
*/
diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java
index 5097ea1..3aed4b6 100644
--- a/src/com/android/launcher3/dragndrop/DragController.java
+++ b/src/com/android/launcher3/dragndrop/DragController.java
@@ -233,8 +233,10 @@
mDragObject = new DropTarget.DragObject();
+ float finalDragViewScale = mLauncher.getWorkspace().getSpringLoadedShrinkFactor();
final DragView dragView = mDragObject.dragView = new DragView(mLauncher, b, registrationX,
- registrationY, 0, 0, b.getWidth(), b.getHeight(), initialDragViewScale);
+ registrationY, 0, 0, b.getWidth(), b.getHeight(),
+ initialDragViewScale, finalDragViewScale);
mDragObject.dragComplete = false;
if (mIsAccessibleDrag) {
diff --git a/src/com/android/launcher3/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java
index 88e11fa..f663d00 100644
--- a/src/com/android/launcher3/dragndrop/DragView.java
+++ b/src/com/android/launcher3/dragndrop/DragView.java
@@ -77,7 +77,6 @@
* <p>
* The registration point is the point inside our view that the touch events should
* be centered upon.
- *
* @param launcher The Launcher instance
* @param bitmap The view that we're dragging around. We scale it up when we draw it.
* @param registrationX The x coordinate of the registration point.
@@ -85,14 +84,15 @@
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public DragView(Launcher launcher, Bitmap bitmap, int registrationX, int registrationY,
- int left, int top, int width, int height, final float initialScale) {
+ int left, int top, int width, int height, final float initialScale,
+ float finalDragViewScale) {
super(launcher);
mDragLayer = launcher.getDragLayer();
mDragController = launcher.getDragController();
final Resources res = getResources();
final float scaleDps = res.getDimensionPixelSize(R.dimen.dragViewScale);
- final float scale = (width + scaleDps) / width;
+ final float scale = finalDragViewScale * (width + scaleDps) / width;
// Set the initial scale to avoid any jumps
setScaleX(initialScale);