summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2015-10-01 11:06:02 -0700
committerTony Wickham <twickham@google.com>2015-10-01 11:08:36 -0700
commit778c0b020daef6ee4bf5944ca887de546caf08c6 (patch)
treeff01a101e1ebe4d7ae204f74f7e29cc6df7b8854
parentdec4ee0c330fbbcd423c23465040032a1095ab0d (diff)
downloadandroid_packages_apps_Trebuchet-778c0b020daef6ee4bf5944ca887de546caf08c6.tar.gz
android_packages_apps_Trebuchet-778c0b020daef6ee4bf5944ca887de546caf08c6.tar.bz2
android_packages_apps_Trebuchet-778c0b020daef6ee4bf5944ca887de546caf08c6.zip
Scale down drag views in spring-loaded workspace.
Bug: 24190193 Change-Id: Ic490fc3f46702c3d5360e869c4172f31700085a1
-rw-r--r--src/com/android/launcher3/Workspace.java4
-rw-r--r--src/com/android/launcher3/dragndrop/DragController.java4
-rw-r--r--src/com/android/launcher3/dragndrop/DragView.java6
3 files changed, 10 insertions, 4 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index d391b06b0..c6b67524d 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -415,6 +415,10 @@ public class Workspace extends PagedView
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 5097ea179..3aed4b65d 100644
--- a/src/com/android/launcher3/dragndrop/DragController.java
+++ b/src/com/android/launcher3/dragndrop/DragController.java
@@ -233,8 +233,10 @@ public class DragController implements DragDriver.EventListener {
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 88e11fa61..f663d00d1 100644
--- a/src/com/android/launcher3/dragndrop/DragView.java
+++ b/src/com/android/launcher3/dragndrop/DragView.java
@@ -77,7 +77,6 @@ public class DragView extends View {
* <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 @@ public class DragView extends View {
*/
@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);