-
Notifications
You must be signed in to change notification settings - Fork 375
AnimatedView
ZieIony edited this page May 19, 2015
·
2 revisions
public interface AnimatedView {
public Animator getAnimator();
public AnimUtils.Style getOutAnimation();
public void setOutAnimation(AnimUtils.Style outAnim);
public AnimUtils.Style getInAnimation();
public void setInAnimation(AnimUtils.Style inAnim);
}
private AnimUtils.Style inAnim, outAnim;
private Animator animator;
public void setVisibility(final int visibility) {
if (getVisibility() != View.VISIBLE && visibility == View.VISIBLE && inAnim != null) {
animator = AnimUtils.animateIn(this, inAnim, null);
super.setVisibility(visibility);
} else if (getVisibility() == View.VISIBLE && visibility != View.VISIBLE) {
animator = AnimUtils.animateOut(this, outAnim, new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
Button.super.setVisibility(visibility);
}
});
}
}
public Animator getAnimator() {
return animator;
}
public AnimUtils.Style getOutAnimation() {
return outAnim;
}
public void setOutAnimation(AnimUtils.Style outAnim) {
this.outAnim = outAnim;
}
public AnimUtils.Style getInAnimation() {
return inAnim;
}
public void setInAnimation(AnimUtils.Style inAnim) {
this.inAnim = inAnim;
}
Copyright 2015 Marcin Korniluk 'Zielony'