summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/LauncherAnimUtils.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-07-06 22:52:49 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-07-31 13:07:14 -0700
commit5d2fc32e6da66f877dfba4fe513fbabdcdae5f99 (patch)
tree317109f395b3fe4871eb8e023b5316fbf036206e /src/com/android/launcher3/LauncherAnimUtils.java
parentc1729a4d154f28c32175823e0cb9448a9c58a4e4 (diff)
downloadandroid_packages_apps_Trebuchet-5d2fc32e6da66f877dfba4fe513fbabdcdae5f99.tar.gz
android_packages_apps_Trebuchet-5d2fc32e6da66f877dfba4fe513fbabdcdae5f99.tar.bz2
android_packages_apps_Trebuchet-5d2fc32e6da66f877dfba4fe513fbabdcdae5f99.zip
Several animation calls cleanup
> Using View property instead of strings to avoid extra reflection step > Using ViewPropertyAnimator when several properties are being animated Change-Id: I41625643b38b70bac11e2c81d18058ec878d73bd
Diffstat (limited to 'src/com/android/launcher3/LauncherAnimUtils.java')
-rw-r--r--src/com/android/launcher3/LauncherAnimUtils.java42
1 files changed, 14 insertions, 28 deletions
diff --git a/src/com/android/launcher3/LauncherAnimUtils.java b/src/com/android/launcher3/LauncherAnimUtils.java
index 6a248a332..853c2ec6b 100644
--- a/src/com/android/launcher3/LauncherAnimUtils.java
+++ b/src/com/android/launcher3/LauncherAnimUtils.java
@@ -21,14 +21,10 @@ import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
-import android.annotation.TargetApi;
-import android.os.Build;
+import android.util.Property;
import android.view.View;
-import android.view.ViewAnimationUtils;
import android.view.ViewTreeObserver;
-import com.android.launcher3.util.UiThreadCircularReveal;
-
import java.util.HashSet;
import java.util.WeakHashMap;
@@ -102,42 +98,32 @@ public class LauncherAnimUtils {
return anim;
}
- public static ObjectAnimator ofFloat(View target, String propertyName, float... values) {
- ObjectAnimator anim = new ObjectAnimator();
- anim.setTarget(target);
- anim.setPropertyName(propertyName);
- anim.setFloatValues(values);
+ public static ObjectAnimator ofFloat(View target, Property<View, Float> property,
+ float... values) {
+ ObjectAnimator anim = ObjectAnimator.ofFloat(target, property, values);
cancelOnDestroyActivity(anim);
new FirstFrameAnimatorHelper(anim, target);
return anim;
}
+ public static ObjectAnimator ofViewAlphaAndScale(View target,
+ float alpha, float scaleX, float scaleY) {
+ return ofPropertyValuesHolder(target,
+ PropertyValuesHolder.ofFloat(View.ALPHA, alpha),
+ PropertyValuesHolder.ofFloat(View.SCALE_X, scaleX),
+ PropertyValuesHolder.ofFloat(View.SCALE_Y, scaleY));
+ }
+
public static ObjectAnimator ofPropertyValuesHolder(View target,
PropertyValuesHolder... values) {
- ObjectAnimator anim = new ObjectAnimator();
- anim.setTarget(target);
- anim.setValues(values);
- cancelOnDestroyActivity(anim);
- new FirstFrameAnimatorHelper(anim, target);
- return anim;
+ return ofPropertyValuesHolder(target, target, values);
}
public static ObjectAnimator ofPropertyValuesHolder(Object target,
View view, PropertyValuesHolder... values) {
- ObjectAnimator anim = new ObjectAnimator();
- anim.setTarget(target);
- anim.setValues(values);
+ ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(target, values);
cancelOnDestroyActivity(anim);
new FirstFrameAnimatorHelper(anim, view);
return anim;
}
-
- @TargetApi(Build.VERSION_CODES.LOLLIPOP)
- public static ValueAnimator createCircularReveal(View view, int centerX,
- int centerY, float startRadius, float endRadius) {
- ValueAnimator anim = UiThreadCircularReveal.createCircularReveal(view, centerX,
- centerY, startRadius, endRadius);
- new FirstFrameAnimatorHelper(anim, view);
- return anim;
- }
}