* @param type
* Represents the type of screen transitions to execute
*/
void push(final int type) {
TransitionScreen screen = null;
TransitionContext transitionContextIn;
TransitionContext transitionContextOut;
final UiEngineInstance engine = Ui.getUiEngineInstance();
switch (type) {
case SLIDE:
screen = new TransitionScreen("Slider", Color.BEIGE);
transitionContextIn =
new TransitionContext(
TransitionContext.TRANSITION_SLIDE);
transitionContextIn.setIntAttribute(
TransitionContext.ATTR_DURATION, 1000);
transitionContextIn.setIntAttribute(
TransitionContext.ATTR_DIRECTION,
TransitionContext.DIRECTION_UP);
transitionContextOut =
new TransitionContext(
TransitionContext.TRANSITION_SLIDE);
transitionContextOut.setIntAttribute(
TransitionContext.ATTR_DURATION, 1000);
transitionContextOut.setIntAttribute(
TransitionContext.ATTR_DIRECTION,
TransitionContext.DIRECTION_DOWN);
transitionContextOut
.setIntAttribute(TransitionContext.ATTR_KIND,
TransitionContext.KIND_OUT);
engine.setTransition(null, screen,
UiEngineInstance.TRIGGER_PUSH, transitionContextIn);
engine.setTransition(screen, null,
UiEngineInstance.TRIGGER_POP, transitionContextOut);
break;
case FADE:
screen = new TransitionScreen("Fade", Color.TEAL);
transitionContextIn =
new TransitionContext(TransitionContext.TRANSITION_FADE);
transitionContextIn.setIntAttribute(
TransitionContext.ATTR_DURATION, 1000);
transitionContextOut =
new TransitionContext(TransitionContext.TRANSITION_FADE);
transitionContextOut.setIntAttribute(
TransitionContext.ATTR_DURATION, 1000);
transitionContextOut
.setIntAttribute(TransitionContext.ATTR_KIND,
TransitionContext.KIND_OUT);
engine.setTransition(null, screen,
UiEngineInstance.TRIGGER_PUSH, transitionContextIn);
engine.setTransition(screen, null,
UiEngineInstance.TRIGGER_POP, transitionContextOut);
break;
case WIPE:
screen = new TransitionScreen("Wipe", Color.LIGHTBLUE);
transitionContextIn =
new TransitionContext(TransitionContext.TRANSITION_WIPE);
transitionContextIn.setIntAttribute(
TransitionContext.ATTR_DURATION, 1000);
transitionContextIn.setIntAttribute(
TransitionContext.ATTR_DIRECTION,
TransitionContext.DIRECTION_LEFT);
transitionContextOut =
new TransitionContext(TransitionContext.TRANSITION_WIPE);
transitionContextOut.setIntAttribute(
TransitionContext.ATTR_DURATION, 1000);
transitionContextOut.setIntAttribute(
TransitionContext.ATTR_DIRECTION,
TransitionContext.DIRECTION_RIGHT);
transitionContextOut
.setIntAttribute(TransitionContext.ATTR_KIND,
TransitionContext.KIND_OUT);
engine.setTransition(null, screen,
UiEngineInstance.TRIGGER_PUSH, transitionContextIn);
engine.setTransition(screen, null,
UiEngineInstance.TRIGGER_POP, transitionContextOut);
break;
case ZOOM:
screen = new TransitionScreen("Zoom", Color.LIGHTGREEN);
transitionContextIn =
new TransitionContext(TransitionContext.TRANSITION_ZOOM);
transitionContextIn.setIntAttribute(
TransitionContext.ATTR_DURATION, 1000);
transitionContextOut =
new TransitionContext(TransitionContext.TRANSITION_ZOOM);
transitionContextOut.setIntAttribute(
TransitionContext.ATTR_DURATION, 1000);
transitionContextOut
.setIntAttribute(TransitionContext.ATTR_KIND,
TransitionContext.KIND_OUT);
engine.setTransition(null, screen,
UiEngineInstance.TRIGGER_PUSH, transitionContextIn);