Fix jumps in the beginning of animations
If the first draw frame of an animation is
expensive, which it often is, it causes a big
jump. Added a helper class which automatically
adjusts the animation start time if the first
frame is more than 16ms.
Change-Id: I100edbc41c2abe930a32d6bcf0a782ea9735f7f9
diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java
index 05921dc..76374d2 100644
--- a/src/com/android/launcher2/FolderIcon.java
+++ b/src/com/android/launcher2/FolderIcon.java
@@ -199,7 +199,7 @@
if (mNeutralAnimator != null) {
mNeutralAnimator.cancel();
}
- mAcceptAnimator = LauncherAnimUtils.ofFloat(0f, 1f);
+ mAcceptAnimator = LauncherAnimUtils.ofFloat(mCellLayout, 0f, 1f);
mAcceptAnimator.setDuration(CONSUMPTION_ANIMATION_DURATION);
final int previewSize = sPreviewSize;
@@ -228,7 +228,7 @@
if (mAcceptAnimator != null) {
mAcceptAnimator.cancel();
}
- mNeutralAnimator = LauncherAnimUtils.ofFloat(0f, 1f);
+ mNeutralAnimator = LauncherAnimUtils.ofFloat(mCellLayout, 0f, 1f);
mNeutralAnimator.setDuration(CONSUMPTION_ANIMATION_DURATION);
final int previewSize = sPreviewSize;
@@ -573,7 +573,7 @@
final float transY0 = (mAvailableSpaceInPreview - d.getIntrinsicHeight()) / 2;
mAnimParams.drawable = d;
- ValueAnimator va = LauncherAnimUtils.ofFloat(0f, 1.0f);
+ ValueAnimator va = LauncherAnimUtils.ofFloat(this, 0f, 1.0f);
va.addUpdateListener(new AnimatorUpdateListener(){
public void onAnimationUpdate(ValueAnimator animation) {
float progress = (Float) animation.getAnimatedValue();