}
private void animateTransition(boolean visible) {
Animator animator = createAnimator();
if (visible) {
animator.addTarget(new TimingTargetAdapter() {
@Override
public void timingEvent(float fraction) {
currentAlpha = (int) (alpha * fraction);
repaint();
}
@Override
public void end() {
currentAlpha = alpha;
}
});
} else {
final int alphaStart = currentAlpha;
animator.addTarget(new TimingTargetAdapter() {
@Override
public void timingEvent(float fraction) {
int diff = (int) (fraction * alphaStart);
currentAlpha = alphaStart - diff;