diff options
author | Patrick Dubroy <dubroy@google.com> | 2010-11-02 14:46:20 -0700 |
---|---|---|
committer | Patrick Dubroy <dubroy@google.com> | 2010-11-02 14:51:33 -0700 |
commit | f24312876b097e25cec922edbb58334ed234dcd7 (patch) | |
tree | cf69e632488853f3d18fbe2bce18c4ee065a2612 /src/com/android | |
parent | c9a961952d1a057029874f8426b90181f6876034 (diff) | |
download | packages_apps_trebuchet-f24312876b097e25cec922edbb58334ed234dcd7.zip packages_apps_trebuchet-f24312876b097e25cec922edbb58334ed234dcd7.tar.gz packages_apps_trebuchet-f24312876b097e25cec922edbb58334ed234dcd7.tar.bz2 |
Fix bug with views disappearing after dragging.
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 08e0460..ddf441a 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -1172,28 +1172,29 @@ public class Workspace extends SmoothPagedView duration *= mQuintEaseOutInterpolator.getInterpolation(dist / maxDist); } - // Lazy initialize the animation - if (mDropAnim == null) { - mDropAnim = new ValueAnimator(); - mDropAnim.setInterpolator(mQuintEaseOutInterpolator); - - // The view is invisible during the animation; we render it manually. - mDropAnim.addListener(new AnimatorListenerAdapter() { - public void onAnimationStart(Animator animation) { - // Set this here so that we don't render it until the animation begins - mDropView = view; - } + if (mDropAnim != null) { + // This should really be end(), but that will not be called synchronously, + // so instead we use LauncherAnimatorListenerAdapter.onAnimationEndOrCancel() + // and call cancel() here. + mDropAnim.cancel(); + } + mDropAnim = new ValueAnimator(); + mDropAnim.setInterpolator(mQuintEaseOutInterpolator); - public void onAnimationEnd(Animator animation) { - if (mDropView != null) { - mDropView.setVisibility(View.VISIBLE); - mDropView = null; - } + // The view is invisible during the animation; we render it manually. + mDropAnim.addListener(new LauncherAnimatorListenerAdapter() { + public void onAnimationStart(Animator animation) { + // Set this here so that we don't render it until the animation begins + mDropView = view; + } + + public void onAnimationEndOrCancel(Animator animation) { + if (mDropView != null) { + mDropView.setVisibility(View.VISIBLE); + mDropView = null; } - }); - } else { - mDropAnim.end(); // Make sure it's not already running - } + } + }); mDropAnim.setDuration(duration); mDropAnim.setFloatValues(0.0f, 1.0f); |