/** * animate to a given widget. If this is called while an animation is running this is a noop. * * @param w the widget to animate to * @param animation the animation to use * @param callback a callback that will be called once the animation is finished */ public void goTo(Widget w, Animation animation, final AnimationEndCallback callback) { if (isAnimating) { return; } isAnimating = true; if (isFirst) { display.setFirstWidget(w); } else { display.setSecondWidget(w); } display.animate( animation, isFirst, new AnimationEndCallback() { @Override public void onAnimationEnd() { isAnimating = false; if (callback != null) { callback.onAnimationEnd(); } } }); isFirst = !isFirst; }