summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2012-06-18 12:52:28 -0700
committerMichael Jurka <mikejurka@google.com>2012-06-19 11:44:57 -0700
commit2ecf995e0d2d55eb71d03f7230ca87270872d1a3 (patch)
treed6a76bdbeefb0ea506d5d704ee4de0cbab3a507c
parent629758ff081a354e43aa409159211210ee4ee85a (diff)
downloadandroid_packages_apps_Trebuchet-2ecf995e0d2d55eb71d03f7230ca87270872d1a3.tar.gz
android_packages_apps_Trebuchet-2ecf995e0d2d55eb71d03f7230ca87270872d1a3.tar.bz2
android_packages_apps_Trebuchet-2ecf995e0d2d55eb71d03f7230ca87270872d1a3.zip
Remove use of private ValueAnimator api
Change-Id: I455edcd17bda83ab51c2c04fa40e66097a4d6975
-rw-r--r--src/com/android/launcher2/AppWidgetResizeFrame.java12
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java7
-rw-r--r--src/com/android/launcher2/AppsCustomizeTabHost.java6
-rw-r--r--src/com/android/launcher2/CellLayout.java14
-rw-r--r--src/com/android/launcher2/DragView.java4
-rw-r--r--src/com/android/launcher2/Folder.java4
-rw-r--r--src/com/android/launcher2/FolderIcon.java6
-rw-r--r--src/com/android/launcher2/InterruptibleInOutAnimator.java2
-rw-r--r--src/com/android/launcher2/Launcher.java22
-rw-r--r--src/com/android/launcher2/LauncherAnimUtils.java87
-rw-r--r--src/com/android/launcher2/LauncherViewPropertyAnimator.java1
-rw-r--r--src/com/android/launcher2/PagedView.java5
-rw-r--r--src/com/android/launcher2/RocketLauncher.java9
-rw-r--r--src/com/android/launcher2/SearchDropTargetBar.java8
-rw-r--r--src/com/android/launcher2/Workspace.java10
15 files changed, 141 insertions, 56 deletions
diff --git a/src/com/android/launcher2/AppWidgetResizeFrame.java b/src/com/android/launcher2/AppWidgetResizeFrame.java
index 882468624..e8b1dc056 100644
--- a/src/com/android/launcher2/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher2/AppWidgetResizeFrame.java
@@ -403,17 +403,17 @@ public class AppWidgetResizeFrame extends FrameLayout {
newHeight);
PropertyValuesHolder x = PropertyValuesHolder.ofInt("x", lp.x, newX);
PropertyValuesHolder y = PropertyValuesHolder.ofInt("y", lp.y, newY);
- ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(lp, width, height, x, y);
- ObjectAnimator leftOa = ObjectAnimator.ofFloat(mLeftHandle, "alpha", 1.0f);
- ObjectAnimator rightOa = ObjectAnimator.ofFloat(mRightHandle, "alpha", 1.0f);
- ObjectAnimator topOa = ObjectAnimator.ofFloat(mTopHandle, "alpha", 1.0f);
- ObjectAnimator bottomOa = ObjectAnimator.ofFloat(mBottomHandle, "alpha", 1.0f);
+ ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(lp, width, height, x, y);
+ ObjectAnimator leftOa = LauncherAnimUtils.ofFloat(mLeftHandle, "alpha", 1.0f);
+ ObjectAnimator rightOa = LauncherAnimUtils.ofFloat(mRightHandle, "alpha", 1.0f);
+ ObjectAnimator topOa = LauncherAnimUtils.ofFloat(mTopHandle, "alpha", 1.0f);
+ ObjectAnimator bottomOa = LauncherAnimUtils.ofFloat(mBottomHandle, "alpha", 1.0f);
oa.addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
requestLayout();
}
});
- AnimatorSet set = new AnimatorSet();
+ AnimatorSet set = LauncherAnimUtils.createAnimatorSet();
if (mResizeMode == AppWidgetProviderInfo.RESIZE_VERTICAL) {
set.playTogether(oa, topOa, bottomOa);
} else if (mResizeMode == AppWidgetProviderInfo.RESIZE_HORIZONTAL) {
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index ef3327295..547080ab0 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -17,7 +17,6 @@
package com.android.launcher2;
import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetManager;
@@ -586,10 +585,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// Create a little animation to show that the widget can move
float offsetY = getResources().getDimensionPixelSize(R.dimen.dragViewOffsetY);
final ImageView p = (ImageView) v.findViewById(R.id.widget_preview);
- AnimatorSet bounce = new AnimatorSet();
- ValueAnimator tyuAnim = ObjectAnimator.ofFloat(p, "translationY", offsetY);
+ AnimatorSet bounce = LauncherAnimUtils.createAnimatorSet();
+ ValueAnimator tyuAnim = LauncherAnimUtils.ofFloat(p, "translationY", offsetY);
tyuAnim.setDuration(125);
- ValueAnimator tydAnim = ObjectAnimator.ofFloat(p, "translationY", 0f);
+ ValueAnimator tydAnim = LauncherAnimUtils.ofFloat(p, "translationY", 0f);
tydAnim.setDuration(100);
bounce.play(tyuAnim).before(tydAnim);
bounce.setInterpolator(new AccelerateInterpolator());
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 935a65676..409affe17 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -265,7 +265,7 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
onTabChangedEnd(type);
// Animate the transition
- ObjectAnimator outAnim = ObjectAnimator.ofFloat(mAnimationBuffer, "alpha", 0f);
+ ObjectAnimator outAnim = LauncherAnimUtils.ofFloat(mAnimationBuffer, "alpha", 0f);
outAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
@@ -278,14 +278,14 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
mAnimationBuffer.removeAllViews();
}
});
- ObjectAnimator inAnim = ObjectAnimator.ofFloat(mAppsCustomizePane, "alpha", 1f);
+ ObjectAnimator inAnim = LauncherAnimUtils.ofFloat(mAppsCustomizePane, "alpha", 1f);
inAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
reloadCurrentPage();
}
});
- AnimatorSet animSet = new AnimatorSet();
+ AnimatorSet animSet = LauncherAnimUtils.createAnimatorSet();
animSet.playTogether(outAnim, inAnim);
animSet.setDuration(duration);
animSet.start();
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 0760ee25d..8319cb70c 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -1082,7 +1082,7 @@ public class CellLayout extends ViewGroup {
return true;
}
- ValueAnimator va = ValueAnimator.ofFloat(0f, 1f);
+ ValueAnimator va = LauncherAnimUtils.ofFloat(0f, 1f);
va.setDuration(duration);
mReorderAnimators.put(lp, va);
@@ -2064,7 +2064,7 @@ public class CellLayout extends ViewGroup {
if (finalDeltaX == 0 && finalDeltaY == 0) {
return;
}
- ValueAnimator va = ValueAnimator.ofFloat(0f, 1f);
+ ValueAnimator va = LauncherAnimUtils.ofFloat(0f, 1f);
a = va;
va.setRepeatMode(ValueAnimator.REVERSE);
va.setRepeatCount(ValueAnimator.INFINITE);
@@ -2106,13 +2106,13 @@ public class CellLayout extends ViewGroup {
a.cancel();
}
- AnimatorSet s = new AnimatorSet();
+ AnimatorSet s = LauncherAnimUtils.createAnimatorSet();
a = s;
s.playTogether(
- ObjectAnimator.ofFloat(child, "scaleX", 1f),
- ObjectAnimator.ofFloat(child, "scaleY", 1f),
- ObjectAnimator.ofFloat(child, "translationX", 0f),
- ObjectAnimator.ofFloat(child, "translationY", 0f)
+ LauncherAnimUtils.ofFloat(child, "scaleX", 1f),
+ LauncherAnimUtils.ofFloat(child, "scaleY", 1f),
+ LauncherAnimUtils.ofFloat(child, "translationX", 0f),
+ LauncherAnimUtils.ofFloat(child, "translationY", 0f)
);
s.setDuration(REORDER_ANIMATION_DURATION);
s.setInterpolator(new android.view.animation.DecelerateInterpolator(1.5f));
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java
index b6645e102..d7ac97d07 100644
--- a/src/com/android/launcher2/DragView.java
+++ b/src/com/android/launcher2/DragView.java
@@ -76,7 +76,7 @@ public class DragView extends View {
final float scale = (width + scaleDps) / width;
// Animate the view into the correct position
- mAnim = ValueAnimator.ofFloat(0.0f, 1.0f);
+ mAnim = LauncherAnimUtils.ofFloat(0.0f, 1.0f);
mAnim.setDuration(150);
mAnim.addUpdateListener(new AnimatorUpdateListener() {
@Override
@@ -199,7 +199,7 @@ public class DragView extends View {
}
public void crossFade(int duration) {
- ValueAnimator va = ValueAnimator.ofFloat(0f, 1f);
+ ValueAnimator va = LauncherAnimUtils.ofFloat(0f, 1f);
va.setDuration(duration);
va.setInterpolator(new DecelerateInterpolator(1.5f));
va.addUpdateListener(new AnimatorUpdateListener() {
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 53c304609..84c815ea2 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -421,7 +421,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f);
PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f);
final ObjectAnimator oa = mOpenCloseAnimator =
- ObjectAnimator.ofPropertyValuesHolder(this, alpha, scaleX, scaleY);
+ LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, scaleX, scaleY);
oa.addListener(new AnimatorListenerAdapter() {
@Override
@@ -479,7 +479,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0.9f);
PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.9f);
final ObjectAnimator oa = mOpenCloseAnimator =
- ObjectAnimator.ofPropertyValuesHolder(this, alpha, scaleX, scaleY);
+ LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, scaleX, scaleY);
oa.addListener(new AnimatorListenerAdapter() {
@Override
diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java
index 76f31143c..af3eea924 100644
--- a/src/com/android/launcher2/FolderIcon.java
+++ b/src/com/android/launcher2/FolderIcon.java
@@ -199,7 +199,7 @@ public class FolderIcon extends LinearLayout implements FolderListener {
if (mNeutralAnimator != null) {
mNeutralAnimator.cancel();
}
- mAcceptAnimator = ValueAnimator.ofFloat(0f, 1f);
+ mAcceptAnimator = LauncherAnimUtils.ofFloat(0f, 1f);
mAcceptAnimator.setDuration(CONSUMPTION_ANIMATION_DURATION);
final int previewSize = sPreviewSize;
@@ -228,7 +228,7 @@ public class FolderIcon extends LinearLayout implements FolderListener {
if (mAcceptAnimator != null) {
mAcceptAnimator.cancel();
}
- mNeutralAnimator = ValueAnimator.ofFloat(0f, 1f);
+ mNeutralAnimator = LauncherAnimUtils.ofFloat(0f, 1f);
mNeutralAnimator.setDuration(CONSUMPTION_ANIMATION_DURATION);
final int previewSize = sPreviewSize;
@@ -574,7 +574,7 @@ public class FolderIcon extends LinearLayout implements FolderListener {
final float transY0 = (mAvailableSpaceInPreview - d.getIntrinsicHeight()) / 2;
mAnimParams.drawable = d;
- ValueAnimator va = ValueAnimator.ofFloat(0f, 1.0f);
+ ValueAnimator va = LauncherAnimUtils.ofFloat(0f, 1.0f);
va.addUpdateListener(new AnimatorUpdateListener(){
public void onAnimationUpdate(ValueAnimator animation) {
float progress = (Float) animation.getAnimatedValue();
diff --git a/src/com/android/launcher2/InterruptibleInOutAnimator.java b/src/com/android/launcher2/InterruptibleInOutAnimator.java
index 135fa3996..9831ba3d4 100644
--- a/src/com/android/launcher2/InterruptibleInOutAnimator.java
+++ b/src/com/android/launcher2/InterruptibleInOutAnimator.java
@@ -45,7 +45,7 @@ public class InterruptibleInOutAnimator {
private int mDirection = STOPPED;
public InterruptibleInOutAnimator(long duration, float fromValue, float toValue) {
- mAnimator = ValueAnimator.ofFloat(fromValue, toValue).setDuration(duration);
+ mAnimator = LauncherAnimUtils.ofFloat(fromValue, toValue).setDuration(duration);
mOriginalDuration = duration;
mOriginalFromValue = fromValue;
mOriginalToValue = toValue;
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 549d1b54b..4906e8153 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1466,7 +1466,7 @@ public final class Launcher extends Activity
mWorkspace = null;
mDragController = null;
- ValueAnimator.clearAllAnimations();
+ LauncherAnimUtils.onDestroyActivity();
}
public DragController getDragController() {
@@ -2141,7 +2141,7 @@ public final class Launcher extends Activity
copyFolderIconToImage(fi);
fi.setVisibility(View.INVISIBLE);
- ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(mFolderIconImageView, alpha,
+ ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(mFolderIconImageView, alpha,
scaleX, scaleY);
oa.setDuration(getResources().getInteger(R.integer.config_folderAnimDuration));
oa.start();
@@ -2158,7 +2158,7 @@ public final class Launcher extends Activity
// We remove and re-draw the FolderIcon in-case it has changed
mDragLayer.removeView(mFolderIconImageView);
copyFolderIconToImage(fi);
- ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(mFolderIconImageView, alpha,
+ ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(mFolderIconImageView, alpha,
scaleX, scaleY);
oa.setDuration(getResources().getInteger(R.integer.config_folderAnimDuration));
oa.addListener(new AnimatorListenerAdapter() {
@@ -2459,7 +2459,7 @@ public final class Launcher extends Activity
// toView should appear right at the end of the workspace shrink
// animation
- mStateAnimation = new AnimatorSet();
+ mStateAnimation = LauncherAnimUtils.createAnimatorSet();
mStateAnimation.play(scaleAnim).after(startDelay);
mStateAnimation.play(alphaAnim).after(startDelay);
@@ -2634,7 +2634,7 @@ public final class Launcher extends Activity
}
});
- mStateAnimation = new AnimatorSet();
+ mStateAnimation = LauncherAnimUtils.createAnimatorSet();
dispatchOnLauncherTransitionPrepare(fromView, animated, true);
dispatchOnLauncherTransitionPrepare(toView, animated, true);
@@ -2818,9 +2818,9 @@ public final class Launcher extends Activity
mDividerAnimator = null;
}
if (animated) {
- mDividerAnimator = new AnimatorSet();
- mDividerAnimator.playTogether(ObjectAnimator.ofFloat(mQsbDivider, "alpha", 1f),
- ObjectAnimator.ofFloat(mDockDivider, "alpha", 1f));
+ mDividerAnimator = LauncherAnimUtils.createAnimatorSet();
+ mDividerAnimator.playTogether(LauncherAnimUtils.ofFloat(mQsbDivider, "alpha", 1f),
+ LauncherAnimUtils.ofFloat(mDockDivider, "alpha", 1f));
mDividerAnimator.setDuration(mSearchDropTargetBar.getTransitionInDuration());
mDividerAnimator.start();
}
@@ -3398,7 +3398,7 @@ public final class Launcher extends Activity
* @param immediate whether to run the animation or show the results immediately
*/
private void runNewAppsAnimation(boolean immediate) {
- AnimatorSet anim = new AnimatorSet();
+ AnimatorSet anim = LauncherAnimUtils.createAnimatorSet();
Collection<Animator> bounceAnims = new ArrayList<Animator>();
// Order these new views spatially so that they animate in order
@@ -3422,7 +3422,7 @@ public final class Launcher extends Activity
} else {
for (int i = 0; i < mNewShortcutAnimateViews.size(); ++i) {
View v = mNewShortcutAnimateViews.get(i);
- ValueAnimator bounceAnim = ObjectAnimator.ofPropertyValuesHolder(v,
+ ValueAnimator bounceAnim = LauncherAnimUtils.ofPropertyValuesHolder(v,
PropertyValuesHolder.ofFloat("alpha", 1f),
PropertyValuesHolder.ofFloat("scaleX", 1f),
PropertyValuesHolder.ofFloat("scaleY", 1f));
@@ -3630,7 +3630,7 @@ public final class Launcher extends Activity
}
private void dismissCling(final Cling cling, final String flag, int duration) {
if (cling != null) {
- ObjectAnimator anim = ObjectAnimator.ofFloat(cling, "alpha", 0f);
+ ObjectAnimator anim = LauncherAnimUtils.ofFloat(cling, "alpha", 0f);
anim.setDuration(duration);
anim.addListener(new AnimatorListenerAdapter() {
public void onAnimationEnd(Animator animation) {
diff --git a/src/com/android/launcher2/LauncherAnimUtils.java b/src/com/android/launcher2/LauncherAnimUtils.java
new file mode 100644
index 000000000..182adf55f
--- /dev/null
+++ b/src/com/android/launcher2/LauncherAnimUtils.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher2;
+
+import android.animation.Animator;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.animation.PropertyValuesHolder;
+import android.animation.ValueAnimator;
+
+import java.util.HashSet;
+
+public class LauncherAnimUtils {
+ static HashSet<Animator> sAnimators = new HashSet<Animator>();
+ Animator.AnimatorListener sEndAnimListener = new Animator.AnimatorListener() {
+ public void onAnimationStart(Animator animation) {
+ }
+
+ public void onAnimationRepeat(Animator animation) {
+ }
+
+ public void onAnimationEnd(Animator animation) {
+ sAnimators.remove(animation);
+ }
+
+ public void onAnimationCancel(Animator animation) {
+ sAnimators.remove(animation);
+ }
+ };
+
+ public static void cancelOnDestroyActivity(Animator a) {
+ sAnimators.add(a);
+ }
+
+ public static void onDestroyActivity() {
+ for (Animator a : sAnimators) {
+ if (a.isRunning()) {
+ a.cancel();
+ }
+ }
+ }
+
+ public static AnimatorSet createAnimatorSet() {
+ AnimatorSet anim = new AnimatorSet();
+ cancelOnDestroyActivity(anim);
+ return anim;
+ }
+
+ public static ValueAnimator ofFloat(float... values) {
+ ValueAnimator anim = new ValueAnimator();
+ anim.setFloatValues(values);
+ cancelOnDestroyActivity(anim);
+ return anim;
+ }
+
+ public static ObjectAnimator ofFloat(Object target, String propertyName, float... values) {
+ ObjectAnimator anim = new ObjectAnimator();
+ anim.setTarget(target);
+ anim.setPropertyName(propertyName);
+ anim.setFloatValues(values);
+ cancelOnDestroyActivity(anim);
+ return anim;
+ }
+
+ public static ObjectAnimator ofPropertyValuesHolder(Object target,
+ PropertyValuesHolder... values) {
+ ObjectAnimator anim = new ObjectAnimator();
+ anim.setTarget(target);
+ anim.setValues(values);
+ cancelOnDestroyActivity(anim);
+ return anim;
+ }
+}
diff --git a/src/com/android/launcher2/LauncherViewPropertyAnimator.java b/src/com/android/launcher2/LauncherViewPropertyAnimator.java
index 88b4cb4b8..3ffc418ae 100644
--- a/src/com/android/launcher2/LauncherViewPropertyAnimator.java
+++ b/src/com/android/launcher2/LauncherViewPropertyAnimator.java
@@ -215,6 +215,7 @@ public class LauncherViewPropertyAnimator extends Animator implements AnimatorLi
}
mViewPropertyAnimator.setListener(this);
mViewPropertyAnimator.start();
+ LauncherAnimUtils.cancelOnDestroyActivity(this);
}
public LauncherViewPropertyAnimator translationX(float value) {
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index ad0baf44d..8ceac8fe7 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -18,7 +18,6 @@ package com.android.launcher2;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.TypedArray;
@@ -1756,7 +1755,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
if (immediately) {
mScrollIndicator.setAlpha(1f);
} else {
- mScrollIndicatorAnimator = ObjectAnimator.ofFloat(mScrollIndicator, "alpha", 1f);
+ mScrollIndicatorAnimator = LauncherAnimUtils.ofFloat(mScrollIndicator, "alpha", 1f);
mScrollIndicatorAnimator.setDuration(sScrollIndicatorFadeInDuration);
mScrollIndicatorAnimator.start();
}
@@ -1782,7 +1781,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
mScrollIndicator.setVisibility(View.INVISIBLE);
mScrollIndicator.setAlpha(0f);
} else {
- mScrollIndicatorAnimator = ObjectAnimator.ofFloat(mScrollIndicator, "alpha", 0f);
+ mScrollIndicatorAnimator = LauncherAnimUtils.ofFloat(mScrollIndicator, "alpha", 0f);
mScrollIndicatorAnimator.setDuration(sScrollIndicatorFadeOutDuration);
mScrollIndicatorAnimator.addListener(new AnimatorListenerAdapter() {
private boolean cancelled = false;
diff --git a/src/com/android/launcher2/RocketLauncher.java b/src/com/android/launcher2/RocketLauncher.java
index 268769d2f..6eefedd03 100644
--- a/src/com/android/launcher2/RocketLauncher.java
+++ b/src/com/android/launcher2/RocketLauncher.java
@@ -21,7 +21,6 @@
package com.android.launcher2;
import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
import android.animation.TimeAnimator;
import android.content.ComponentName;
import android.content.Context;
@@ -150,11 +149,11 @@ public class RocketLauncher extends BasicDream {
}
}, LAUNCH_ZOOM_TIME);
endscale = 0;
- AnimatorSet s = new AnimatorSet();
+ AnimatorSet s = LauncherAnimUtils.createAnimatorSet();
s.playTogether(
- ObjectAnimator.ofFloat(this, "scaleX", 15f),
- ObjectAnimator.ofFloat(this, "scaleY", 15f),
- ObjectAnimator.ofFloat(this, "alpha", 0f)
+ LauncherAnimUtils.ofFloat(this, "scaleX", 15f),
+ LauncherAnimUtils.ofFloat(this, "scaleY", 15f),
+ LauncherAnimUtils.ofFloat(this, "alpha", 0f)
);
// make sure things are still moving until the very last instant the
diff --git a/src/com/android/launcher2/SearchDropTargetBar.java b/src/com/android/launcher2/SearchDropTargetBar.java
index 49dd23c7a..fada48a25 100644
--- a/src/com/android/launcher2/SearchDropTargetBar.java
+++ b/src/com/android/launcher2/SearchDropTargetBar.java
@@ -111,14 +111,14 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
// Create the various fade animations
if (mEnableDropDownDropTargets) {
mDropTargetBar.setTranslationY(-mBarHeight);
- mDropTargetBarAnim = ObjectAnimator.ofFloat(mDropTargetBar, "translationY",
+ mDropTargetBarAnim = LauncherAnimUtils.ofFloat(mDropTargetBar, "translationY",
-mBarHeight, 0f);
- mQSBSearchBarAnim = ObjectAnimator.ofFloat(mQSBSearchBar, "translationY", 0,
+ mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mQSBSearchBar, "translationY", 0,
-mBarHeight);
} else {
mDropTargetBar.setAlpha(0f);
- mDropTargetBarAnim = ObjectAnimator.ofFloat(mDropTargetBar, "alpha", 0f, 1f);
- mQSBSearchBarAnim = ObjectAnimator.ofFloat(mQSBSearchBar, "alpha", 1f, 0f);
+ mDropTargetBarAnim = LauncherAnimUtils.ofFloat(mDropTargetBar, "alpha", 0f, 1f);
+ mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mQSBSearchBar, "alpha", 1f, 0f);
}
setupAnimation(mDropTargetBarAnim, mDropTargetBar);
setupAnimation(mQSBSearchBarAnim, mQSBSearchBar);
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 174d23b4d..4e0c3472d 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1090,7 +1090,7 @@ public class Workspace extends SmoothPagedView
if (!isSmall() && !mIsSwitchingState) {
if (mChildrenOutlineFadeOutAnimation != null) mChildrenOutlineFadeOutAnimation.cancel();
if (mChildrenOutlineFadeInAnimation != null) mChildrenOutlineFadeInAnimation.cancel();
- mChildrenOutlineFadeInAnimation = ObjectAnimator.ofFloat(this, "childrenOutlineAlpha", 1.0f);
+ mChildrenOutlineFadeInAnimation = LauncherAnimUtils.ofFloat(this, "childrenOutlineAlpha", 1.0f);
mChildrenOutlineFadeInAnimation.setDuration(CHILDREN_OUTLINE_FADE_IN_DURATION);
mChildrenOutlineFadeInAnimation.start();
}
@@ -1100,7 +1100,7 @@ public class Workspace extends SmoothPagedView
if (!isSmall() && !mIsSwitchingState) {
if (mChildrenOutlineFadeInAnimation != null) mChildrenOutlineFadeInAnimation.cancel();
if (mChildrenOutlineFadeOutAnimation != null) mChildrenOutlineFadeOutAnimation.cancel();
- mChildrenOutlineFadeOutAnimation = ObjectAnimator.ofFloat(this, "childrenOutlineAlpha", 0.0f);
+ mChildrenOutlineFadeOutAnimation = LauncherAnimUtils.ofFloat(this, "childrenOutlineAlpha", 0.0f);
mChildrenOutlineFadeOutAnimation.setDuration(CHILDREN_OUTLINE_FADE_OUT_DURATION);
mChildrenOutlineFadeOutAnimation.setStartDelay(CHILDREN_OUTLINE_FADE_OUT_DELAY);
mChildrenOutlineFadeOutAnimation.start();
@@ -1145,7 +1145,7 @@ public class Workspace extends SmoothPagedView
float startAlpha = getBackgroundAlpha();
if (finalAlpha != startAlpha) {
if (animated) {
- mBackgroundFadeOutAnimation = ValueAnimator.ofFloat(startAlpha, finalAlpha);
+ mBackgroundFadeOutAnimation = LauncherAnimUtils.ofFloat(startAlpha, finalAlpha);
mBackgroundFadeOutAnimation.addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
setBackgroundAlpha(((Float) animation.getAnimatedValue()).floatValue());
@@ -1515,7 +1515,7 @@ public class Workspace extends SmoothPagedView
// Initialize animation arrays for the first time if necessary
initAnimationArrays();
- AnimatorSet anim = animated ? new AnimatorSet() : null;
+ AnimatorSet anim = animated ? LauncherAnimUtils.createAnimatorSet() : null;
// Stop any scrolling, move to the current page right away
setCurrentPage(getNextPage());
@@ -1631,7 +1631,7 @@ public class Workspace extends SmoothPagedView
}
if (mOldBackgroundAlphas[i] != 0 ||
mNewBackgroundAlphas[i] != 0) {
- ValueAnimator bgAnim = ValueAnimator.ofFloat(0f, 1f).setDuration(duration);
+ ValueAnimator bgAnim = LauncherAnimUtils.ofFloat(0f, 1f).setDuration(duration);
bgAnim.setInterpolator(mZoomInInterpolator);
bgAnim.addUpdateListener(new LauncherAnimatorUpdateListener() {
public void onAnimationUpdate(float a, float b) {