Package ej.navigation.transition
Class SlideTransition
- java.lang.Object
-
- ej.navigation.transition.SlideTransition
-
- All Implemented Interfaces:
Transition
public class SlideTransition extends Object implements Transition
A transition that slides the incoming content horizontally over the outgoing one.The direction selects the edge the incoming content enters from:
RIGHT_TO_LEFT(the default) enters from the right and pushes the outgoing content off to the left;LEFT_TO_RIGHTdoes the opposite.- Since:
- 0.2.0
-
-
Field Summary
Fields Modifier and Type Field Description static intLEFT_TO_RIGHTDirection where the incoming content enters from the left edge and the outgoing content leaves through the right edge.static intRIGHT_TO_LEFTDirection where the incoming content enters from the right edge and the outgoing content leaves through the left edge.-
Fields inherited from interface ej.navigation.transition.Transition
DEFAULT_DURATION_MILLIS, IMMEDIATE
-
-
Constructor Summary
Constructors Constructor Description SlideTransition()Creates a right-to-left slide with the default duration.SlideTransition(int direction)Creates a slide in the given direction with the default duration.SlideTransition(int direction, int duration)Creates a slide in the given direction with the given duration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidrun(TransitionContext context, TransitionListener listener)Animates the page change described by the given context.
-
-
-
Field Detail
-
RIGHT_TO_LEFT
public static final int RIGHT_TO_LEFT
Direction where the incoming content enters from the right edge and the outgoing content leaves through the left edge.- See Also:
- Constant Field Values
-
LEFT_TO_RIGHT
public static final int LEFT_TO_RIGHT
Direction where the incoming content enters from the left edge and the outgoing content leaves through the right edge.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SlideTransition
public SlideTransition()
Creates a right-to-left slide with the default duration.
-
SlideTransition
public SlideTransition(int direction)
Creates a slide in the given direction with the default duration.- Parameters:
direction-RIGHT_TO_LEFTorLEFT_TO_RIGHT.
-
SlideTransition
public SlideTransition(int direction, int duration)Creates a slide in the given direction with the given duration.- Parameters:
direction-RIGHT_TO_LEFTorLEFT_TO_RIGHT.duration- the slide duration, in milliseconds; must be strictly positive.- Throws:
IllegalArgumentException- if the given duration is not strictly positive.
-
-
Method Detail
-
run
public void run(TransitionContext context, TransitionListener listener)
Description copied from interface:TransitionAnimates the page change described by the given context.Called on the MicroUI thread once per navigation. The implementation must call
TransitionListener.onTransitionEnd()exactly once when the animation is finished.- Specified by:
runin interfaceTransition- Parameters:
context- the stage exposing the contents, the content area size, and the animation primitives.listener- the listener to notify once, when the transition finishes.
-
-