use of com.codename1.ui.animations.CommonTransitions in project CodenameOne by codenameone.
the class SwipeBackSupport method startBackTransition.
void startBackTransition(final Form currentForm, Form destination) {
final Transition t = destination.getTransitionOutAnimator().copy(true);
if (t instanceof CommonTransitions) {
Transition originalTransition = currentForm.getTransitionOutAnimator();
currentForm.setTransitionOutAnimator(CommonTransitions.createEmpty());
Form blank = new Form() {
protected boolean shouldSendPointerReleaseToOtherForm() {
return true;
}
};
blank.addPointerDraggedListener(pointerDragged);
blank.addPointerReleasedListener(pointerReleased);
blank.addPointerPressedListener(pointerPressed);
blank.setTransitionInAnimator(CommonTransitions.createEmpty());
blank.setTransitionOutAnimator(CommonTransitions.createEmpty());
blank.show();
currentForm.setTransitionOutAnimator(originalTransition);
((CommonTransitions) t).setMotion(new LazyValue<Motion>() {
public Motion get(Object... args) {
return new ManualMotion(((Integer) args[0]).intValue(), ((Integer) args[1]).intValue(), ((Integer) args[2]).intValue());
}
});
t.init(currentForm, destination);
t.initTransition();
blank.setGlassPane(new Painter() {
public void paint(Graphics g, Rectangle rect) {
t.animate();
t.paint(g);
}
});
}
}
Aggregations