Bug 813057 - Ensure suggestion view parameters are reset if view is removed during animation. r=lucasr

This commit is contained in:
Brian Nicholson 2012-11-27 11:14:04 -08:00
parent 30a1193af7
commit be5e4e465d

View File

@ -40,8 +40,7 @@ public class AnimatedHeightLayout extends RelativeLayout {
public void onAnimationEnd(Animation animation) { public void onAnimationEnd(Animation animation) {
post(new Runnable() { post(new Runnable() {
public void run() { public void run() {
getLayoutParams().height = LayoutParams.WRAP_CONTENT; finishAnimation();
mAnimating = false;
} }
}); });
} }
@ -49,4 +48,17 @@ public class AnimatedHeightLayout extends RelativeLayout {
startAnimation(anim); startAnimation(anim);
} }
} }
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
finishAnimation();
}
private void finishAnimation() {
if (mAnimating) {
getLayoutParams().height = LayoutParams.WRAP_CONTENT;
mAnimating = false;
}
}
} }