public final class CommonTransitions extends Transition
Instances of this class are created using factory methods.
Modifier and Type | Field and Description |
---|---|
static int |
SLIDE_HORIZONTAL
Slide the transition horizontally
|
static int |
SLIDE_VERTICAL
Slide the transition vertically
|
Modifier and Type | Method and Description |
---|---|
boolean |
animate()
Allows the animation to reduce "repaint" calls when it returns false.
|
void |
cleanup()
Optional operation to cleanup the garbage left over by a running transition
|
Transition |
copy(boolean reverse)
Create a copy of the transition, usually the transition used is a copy.
|
static CommonTransitions |
createEmpty()
Creates an empty transition that does nothing.
|
static CommonTransitions |
createFade(int duration)
Creates a transition for fading a form in while fading out the original form
|
static CommonTransitions |
createFastSlide(int type,
boolean forward,
int duration)
Creates a slide transition with the given duration and direction, this differs from the
standard slide animation by focusing on speed rather than on minimizing heap usage.
|
static CommonTransitions |
createFastSlide(int type,
boolean forward,
int duration,
boolean drawDialogMenu)
Creates a slide transition with the given duration and direction, this differs from the
standard slide animation by focusing on speed rather than on minimizing heap usage
This method works by creating two images and sliding them which works much faster for
all devices however takes up more ram.
|
protected Motion |
createMotion(int startOffset,
int dest,
int speed)
This method can be overriden by subclasses to create their own motion object on the fly
|
static CommonTransitions |
createSlide(int type,
boolean forward,
int duration)
Creates a slide transition with the given duration and direction
|
static CommonTransitions |
createSlide(int type,
boolean forward,
int duration,
boolean drawDialogMenu)
Creates a slide transition with the given duration and direction
|
Motion |
getMotion()
Motion represents the physical movement within a transition, it can
be replaced by the user to provide a more appropriate physical feel
|
void |
initTransition()
Callback thats invoked before a transition begins, the source form may be null
for the first form in the application.
|
static boolean |
isDefaultLinearMotion()
Indicates whether the motion associated with these transitions by default is linear or spline motion
|
boolean |
isLinearMotion()
Indicates whether the motion associated with this transition is linear or spline motion
|
void |
paint(Graphics g)
Draws the animation, within a component the standard paint method would be
invoked since it bares the exact same signature.
|
static void |
setDefaultLinearMotion(boolean aDefaultLinearMotion)
Indicates whether the motion associated with these transitions by default is linear or spline motion
|
void |
setLinearMotion(boolean linearMotion)
Indicates whether the motion associated with this transition is linear or spline motion
|
void |
setMotion(Motion motion)
Motion represents the physical movement within a transition, it can
be replaced by the user to provide a more appropriate physical feel
|
cleanSource, copy, getDestination, getSource, init
public static final int SLIDE_HORIZONTAL
public static final int SLIDE_VERTICAL
public static CommonTransitions createEmpty()
public static CommonTransitions createFastSlide(int type, boolean forward, int duration)
type
- type can be either vertically or horizontally, which means
the movement direction of the transitionforward
- forward is a boolean value, represent the directions of
switching forms, for example for a horizontally type, true means
horizontally movement to right.duration
- represent the time the transition should take in millisecondpublic static CommonTransitions createSlide(int type, boolean forward, int duration)
type
- type can be either vertically or horizontally, which means
the movement direction of the transitionforward
- forward is a boolean value, represent the directions of
switching forms, for example for a horizontally type, true means
horizontally movement to right.duration
- represent the time the transition should take in millisecondpublic static CommonTransitions createSlide(int type, boolean forward, int duration, boolean drawDialogMenu)
type
- type can be either vertically or horizontally, which means
the movement direction of the transitionforward
- forward is a boolean value, represent the directions of
switching forms, for example for a horizontally type, true means
horizontally movement to right.duration
- represent the time the transition should take in milliseconddrawDialogMenu
- indicates that the menu (softkey area) of the dialog
should be kept during a slide transition. This is only relevant for
dialog in/out transitions.public static CommonTransitions createFastSlide(int type, boolean forward, int duration, boolean drawDialogMenu)
type
- type can be either vertically or horizontally, which means
the movement direction of the transitionforward
- forward is a boolean value, represent the directions of
switching forms, for example for a horizontally type, true means
horizontally movement to right.duration
- represent the time the transition should take in milliseconddrawDialogMenu
- indicates that the menu (softkey area) of the dialog
should be kept during a slide transition. This is only relevant for
dialog in/out transitions.public static CommonTransitions createFade(int duration)
duration
- represent the time the transition should take in millisecondpublic void initTransition()
Transition
initTransition
in class Transition
protected Motion createMotion(int startOffset, int dest, int speed)
startOffset
- the start offset for the menudest
- the destination of the motionspeed
- the speed of the motionpublic boolean animate()
Animation
Display
class.animate
in interface Animation
animate
in class Transition
public void paint(Graphics g)
Animation
paint
in interface Animation
paint
in class Transition
g
- graphics contextpublic void cleanup()
Transition
cleanup
in class Transition
public Motion getMotion()
public void setMotion(Motion motion)
motion
- new instance of the motion class that will be used by the transitionpublic Transition copy(boolean reverse)
Transition
copy
in class Transition
reverse
- creates a new transition instance with "reverse" behavior useful
for signifying "back" operationspublic boolean isLinearMotion()
public void setLinearMotion(boolean linearMotion)
linearMotion
- the linearMotion to setpublic static boolean isDefaultLinearMotion()
public static void setDefaultLinearMotion(boolean aDefaultLinearMotion)
aDefaultLinearMotion
- the defaultLinearMotion to set