Using ViewPropertyAnimator for animations

Replacing some use of fastInvalidate/setFast*
methods with ViewPropertyAnimator animations

Change-Id: Id5a8934b38d9ae3a95b6dccb431f9787839d2927
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 5abfa28..45a9e31 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2226,14 +2226,13 @@
                 mWorkspace.getChangeStateAnimation(Workspace.State.SMALL, animated);
 
         if (animated) {
-            final ValueAnimator scaleAnim = ValueAnimator.ofFloat(0f, 1f).setDuration(duration);
-            scaleAnim.setInterpolator(new Workspace.ZoomOutInterpolator());
-            scaleAnim.addUpdateListener(new LauncherAnimatorUpdateListener() {
-                public void onAnimationUpdate(float a, float b) {
-                    toView.setScaleX(a * scale + b * 1f);
-                    toView.setScaleY(a * scale + b * 1f);
-                }
-            });
+            toView.setScaleX(scale);
+            toView.setScaleY(scale);
+            final LauncherViewPropertyAnimator scaleAnim = new LauncherViewPropertyAnimator(toView);
+            scaleAnim.
+                scaleX(1f).scaleY(1f).
+                setDuration(duration).
+                setInterpolator(new Workspace.ZoomOutInterpolator());
 
             toView.setVisibility(View.VISIBLE);
             toView.setAlpha(0f);
@@ -2248,8 +2247,8 @@
             // toView should appear right at the end of the workspace shrink
             // animation
             mStateAnimation = new AnimatorSet();
-            mStateAnimation.play(alphaAnim).after(startDelay);
             mStateAnimation.play(scaleAnim).after(startDelay);
+            mStateAnimation.play(alphaAnim).after(startDelay);
 
             mStateAnimation.addListener(new AnimatorListenerAdapter() {
                 boolean animationCancelled = false;
@@ -2579,8 +2578,10 @@
     void showHotseat(boolean animated) {
         if (!LauncherApplication.isScreenLarge()) {
             if (animated) {
-                int duration = mSearchDropTargetBar.getTransitionInDuration();
-                mHotseat.animate().alpha(1f).setDuration(duration);
+                if (mHotseat.getAlpha() != 1f) {
+                    int duration = mSearchDropTargetBar.getTransitionInDuration();
+                    mHotseat.animate().alpha(1f).setDuration(duration);
+                }
             } else {
                 mHotseat.setAlpha(1f);
             }
@@ -2593,8 +2594,10 @@
     void hideHotseat(boolean animated) {
         if (!LauncherApplication.isScreenLarge()) {
             if (animated) {
-                int duration = mSearchDropTargetBar.getTransitionOutDuration();
-                mHotseat.animate().alpha(0f).setDuration(duration);
+                if (mHotseat.getAlpha() != 0f) {
+                    int duration = mSearchDropTargetBar.getTransitionOutDuration();
+                    mHotseat.animate().alpha(0f).setDuration(duration);
+                }
             } else {
                 mHotseat.setAlpha(0f);
             }