diff options
author | Adam Cohen <adamcohen@google.com> | 2012-05-23 14:00:37 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2012-05-23 14:00:37 -0700 |
commit | fe41ac641bdef7ea96dcbac59b4f3abdbdff6cfe (patch) | |
tree | 56f62a3f56a625cf1784518b1dd60f2ceccfdd07 /src/com/android/launcher2/CellLayout.java | |
parent | 4712529da82263eb5c104beb66779d233f637ff5 (diff) | |
download | packages_apps_trebuchet-fe41ac641bdef7ea96dcbac59b4f3abdbdff6cfe.zip packages_apps_trebuchet-fe41ac641bdef7ea96dcbac59b4f3abdbdff6cfe.tar.gz packages_apps_trebuchet-fe41ac641bdef7ea96dcbac59b4f3abdbdff6cfe.tar.bz2 |
Fix issue with re-order animation not hinting the correct direction
Change-Id: I5fdf55615fde974c2cc8ae1276031f413713cb10
Diffstat (limited to 'src/com/android/launcher2/CellLayout.java')
-rw-r--r-- | src/com/android/launcher2/CellLayout.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index 5591c9a..4837ddd 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -1942,13 +1942,15 @@ public class CellLayout extends ViewGroup { if (dX == dY && dX == 0) { } else { if (dY == 0) { - deltaX = mReorderHintAnimationMagnitude; + deltaX = - Math.signum(dX) * mReorderHintAnimationMagnitude; } else if (dX == 0) { - deltaY = mReorderHintAnimationMagnitude; + deltaY = - Math.signum(dY) * mReorderHintAnimationMagnitude; } else { double angle = Math.atan( (float) (dY) / dX); - deltaX = (int) (Math.cos(angle) * mReorderHintAnimationMagnitude); - deltaY = (int) (Math.sin(angle) * mReorderHintAnimationMagnitude); + deltaX = (int) (- Math.signum(dX) * + Math.abs(Math.cos(angle) * mReorderHintAnimationMagnitude)); + deltaY = (int) (- Math.signum(dY) * + Math.abs(Math.sin(angle) * mReorderHintAnimationMagnitude)); } } child.setPivotY(child.getMeasuredHeight() * 0.5f); |