diff options
Diffstat (limited to 'src/com/android/launcher3/LauncherAnimUtils.java')
-rw-r--r-- | src/com/android/launcher3/LauncherAnimUtils.java | 42 |
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; - } } |