fix image button repeating animation incorrectly

Closes #3610
// FREEBIE
This commit is contained in:
Jake McGinty 2015-07-10 18:15:34 -07:00 committed by Moxie Marlinspike
parent d400f0fb58
commit 7593918006

View file

@ -26,7 +26,7 @@ public class HidingImageButton extends ImageButton {
} }
public void hide() { public void hide() {
if (!isEnabled()) return; if (!isEnabled() || getVisibility() == GONE) return;
final Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.slide_to_right); final Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.slide_to_right);
animation.setAnimationListener(new AnimationListener() { animation.setAnimationListener(new AnimationListener() {
@Override public void onAnimationStart(Animation animation) {} @Override public void onAnimationStart(Animation animation) {}
@ -39,7 +39,7 @@ public class HidingImageButton extends ImageButton {
} }
public void show() { public void show() {
if (!isEnabled()) return; if (!isEnabled() || getVisibility() == VISIBLE) return;
setVisibility(VISIBLE); setVisibility(VISIBLE);
animateWith(AnimationUtils.loadAnimation(getContext(), R.anim.slide_from_right)); animateWith(AnimationUtils.loadAnimation(getContext(), R.anim.slide_from_right));
} }