diff options
author | Patrick Dubroy <dubroy@google.com> | 2010-10-25 11:41:41 -0700 |
---|---|---|
committer | Patrick Dubroy <dubroy@google.com> | 2010-10-25 12:11:23 -0700 |
commit | a944215d364c178c9b0b8f5bdcce16e1f10c552d (patch) | |
tree | 2bfc2c72271f52619cf26f1e5f3c773957fe857a /src/com | |
parent | ceed8fafc76c0d693b802af17fbcb00783edff0f (diff) | |
download | android_packages_apps_Trebuchet-a944215d364c178c9b0b8f5bdcce16e1f10c552d.tar.gz android_packages_apps_Trebuchet-a944215d364c178c9b0b8f5bdcce16e1f10c552d.tar.bz2 android_packages_apps_Trebuchet-a944215d364c178c9b0b8f5bdcce16e1f10c552d.zip |
Fix disappearing icons due to div-by-0 in animation.
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher2/CellLayout.java | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index 2da5ac3d2..9bb10fab4 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -122,7 +122,7 @@ public class CellLayout extends ViewGroup implements Dimmable { private boolean mDragging = false; - private ObjectAnimator mDropAnim; + private ValueAnimator mDropAnim; private TimeInterpolator mEaseOutInterpolator; public CellLayout(Context context) { @@ -252,7 +252,7 @@ public class CellLayout extends ViewGroup implements Dimmable { mDragOutlineAnims[i] = anim; } - mDropAnim = new ObjectAnimator(); + mDropAnim = ValueAnimator.ofFloat(1.0f, 0.0f); mDropAnim.setInterpolator(mEaseOutInterpolator); mBackgroundRect = new Rect(); @@ -779,7 +779,7 @@ public class CellLayout extends ViewGroup implements Dimmable { */ private void animateChildIntoPosition(final View child) { final Resources res = getResources(); - final ObjectAnimator anim = mDropAnim; + final ValueAnimator anim = mDropAnim; final CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams(); final float startX = lp.oldX - lp.x; final float startY = lp.oldY - lp.y; @@ -790,18 +790,15 @@ public class CellLayout extends ViewGroup implements Dimmable { final int duration = (int) (res.getInteger(R.integer.config_dropAnimMaxDuration) * mEaseOutInterpolator.getInterpolation(dist / maxDist)); - anim.cancel(); // Make sure it's not already running + anim.end(); // Make sure it's not already running anim.setDuration(duration); - anim.setTarget(child); - anim.setPropertyName("translationX"); - anim.setFloatValues(startX, 0); - + anim.setFloatValues(1.0f, 0.0f); anim.removeAllUpdateListeners(); anim.addUpdateListener(new AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { - // Set the value of translationY based on the current x value - final float translationX = (Float) anim.getAnimatedValue(); - child.setTranslationY((startY / startX) * translationX); + final float value = (Float) anim.getAnimatedValue(); + child.setTranslationX(startX * value); + child.setTranslationY(startY * value); } }); anim.start(); |