Fix crash caused by unregistering animation listener

This commit is contained in:
Michael Jurka
2013-03-28 13:39:35 -07:00
parent f1ad608c28
commit 98720c96ee
@@ -60,7 +60,7 @@ public class FirstFrameAnimatorHelper implements ValueAnimator.AnimatorUpdateLis
view.getViewTreeObserver().addOnDrawListener(sGlobalDrawListener);
}
public void onAnimationUpdate(ValueAnimator animation) {
public void onAnimationUpdate(final ValueAnimator animation) {
if (mStartTime == -1) {
mStartFrame = sGlobalFrameCounter;
mStartTime = System.currentTimeMillis();
@@ -86,7 +86,11 @@ public class FirstFrameAnimatorHelper implements ValueAnimator.AnimatorUpdateLis
mAdjustedSecondFrameTime = true;
} else {
if (frameNum > 1) {
animation.removeUpdateListener(this);
mTarget.post(new Runnable() {
public void run() {
animation.removeUpdateListener(FirstFrameAnimatorHelper.this);
}
});
}
if (DEBUG) print(animation);
}