|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.microedition.lcdui.Displayable
javax.microedition.lcdui.Canvas
de.enough.polish.ui.ScreenChangeAnimation
public abstract class ScreenChangeAnimation
Paints a transition of two screens for a nice effect.
Using a screen change animation is easy:
Use the screen-change-animation CSS attribute for specifying which
animation you would like to have. You can also finetune some animations. Note
that some animations have certain conditions like support of the MIDP 2.0 profile.
screen-change-animation: left; left-screen-change-animation-speed: 5;
You can easily implement your own screen change animations by following these steps:
You can now use your animation by specifying the screen-change-animation CSS attribute
accordingly:
screen-change-animation: new com.company.ui.MyScreenChangeAnimation();
You can also ease the usage by registering your animation in ${polish.home}/custom-css-attributes:
<attribute name="screen-change-animation">
<mapping from="myanimation" to="com.company.ui.MyScreenChangeAnimation()" />
</attribute>
Now your animation is easier to use:
screen-change-animation: myanimation;
Copyright (c) Enough Software 2005 - 2008
history
27-May-2005 - rob creation
show(Style, Display, int, int, Image, Image, AccessibleCanvas, Displayable, boolean),
animate()| Field Summary | |
|---|---|
protected javax.microedition.lcdui.Display |
display
|
protected boolean |
fullScreenModeSet
|
protected boolean |
isForwardAnimation
|
protected javax.microedition.lcdui.Image |
lastCanvasImage
|
protected int[] |
lastCanvasRgb
|
protected AccessibleCanvas |
nextCanvas
|
protected javax.microedition.lcdui.Image |
nextCanvasImage
|
protected int[] |
nextCanvasRgb
|
protected javax.microedition.lcdui.Displayable |
nextDisplayable
|
protected int |
screenHeight
|
protected int |
screenWidth
|
protected boolean |
useLastCanvasRgb
set to true in subclasses for populating lastCanvasRgb |
protected boolean |
useNextCanvasRgb
set to true in subclasses for populating nextCanvasRgb |
| Fields inherited from class javax.microedition.lcdui.Canvas |
|---|
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP |
| Constructor Summary | |
|---|---|
ScreenChangeAnimation()
Creates a new ScreenChangeAnimation. |
|
| Method Summary | |
|---|---|
protected abstract boolean |
animate()
Animates this animation. |
void |
hideNotify()
Notifies this animation that it will be hidden shortly. |
void |
keyPressed(int keyCode)
Handles key pressed events. |
void |
keyReleased(int keyCode)
Handles key released events. |
void |
keyRepeated(int keyCode)
Handles key repeat events. |
void |
paint(javax.microedition.lcdui.Graphics g)
|
protected abstract void |
paintAnimation(javax.microedition.lcdui.Graphics g)
Paints the animation. |
void |
pointerDragged(int x,
int y)
Forwards pointer dragged events to the next screen. |
void |
pointerPressed(int x,
int y)
Forwards pointer pressed events to the next screen. |
void |
pointerReleased(int x,
int y)
Forwards pointer pressed events to the next screen. |
void |
run()
Runs this animation - subclasses need to ensure to call this.display.callSerially( this ); at the end of the paint method. |
protected void |
setStyle(Style style)
Sets the style for this animation. |
protected void |
show(Style style,
javax.microedition.lcdui.Display dsplay,
int width,
int height,
javax.microedition.lcdui.Image lstScreenImage,
javax.microedition.lcdui.Image nxtScreenImage,
AccessibleCanvas nxtCanvas,
javax.microedition.lcdui.Displayable nxtDisplayable,
boolean isForward)
Starts the animation. |
void |
showNotify()
Notifies this animation that it will be shown shortly. |
void |
sizeChanged(int width,
int height)
Notifies this animation that the screen space has been changed. |
protected void |
updateNextScreen(AccessibleCanvas next,
javax.microedition.lcdui.Image nextImage,
int[] rgb)
Updates the image and possibly the RGB data of the next screen. |
| Methods inherited from class javax.microedition.lcdui.Canvas |
|---|
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, isDoubleBuffered, repaint, repaint, serviceRepaints, setFullScreenMode |
| Methods inherited from class javax.microedition.lcdui.Displayable |
|---|
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setCommandListener, setTicker, setTitle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected javax.microedition.lcdui.Display display
protected AccessibleCanvas nextCanvas
protected javax.microedition.lcdui.Image lastCanvasImage
protected int[] lastCanvasRgb
protected boolean useLastCanvasRgb
protected javax.microedition.lcdui.Image nextCanvasImage
protected int[] nextCanvasRgb
protected boolean useNextCanvasRgb
protected int screenWidth
protected int screenHeight
protected boolean fullScreenModeSet
protected javax.microedition.lcdui.Displayable nextDisplayable
protected boolean isForwardAnimation
| Constructor Detail |
|---|
public ScreenChangeAnimation()
| Method Detail |
|---|
protected void show(Style style,
javax.microedition.lcdui.Display dsplay,
int width,
int height,
javax.microedition.lcdui.Image lstScreenImage,
javax.microedition.lcdui.Image nxtScreenImage,
AccessibleCanvas nxtCanvas,
javax.microedition.lcdui.Displayable nxtDisplayable,
boolean isForward)
style - the associated style.dsplay - the display, which is used for setting this animationwidth - the screen's widthheight - the screen's heightlstScreenImage - an image of the last screennxtScreenImage - an image of the next screennxtCanvas - the next screen that should be displayed when this animation finishes (as an AccessibleCanvas)nxtDisplayable - the next screen that should be displayed when this animation finishes (as a Displayable)isForward - true when the animation should run in the normal direction/mode - false if it should run backwardsprotected void setStyle(Style style)
style - the styleprotected abstract boolean animate()
protected abstract void paintAnimation(javax.microedition.lcdui.Graphics g)
g - the graphics contextpublic final void paint(javax.microedition.lcdui.Graphics g)
paint in interface AccessibleCanvaspaint in class javax.microedition.lcdui.Canvas
public void pointerPressed(int x,
int y)
pointerPressed in interface AccessibleCanvaspointerPressed in class javax.microedition.lcdui.Canvasx - the horizontal coordinate of the clicked pixely - the vertical coordinate of the clicked pixelupdateNextScreen(AccessibleCanvas, Image, int[])
public void pointerReleased(int x,
int y)
pointerReleased in interface AccessibleCanvaspointerReleased in class javax.microedition.lcdui.Canvasx - the horizontal coordinate of the clicked pixely - the vertical coordinate of the clicked pixelupdateNextScreen(AccessibleCanvas, Image, int[])
public void pointerDragged(int x,
int y)
pointerDragged in interface AccessibleCanvaspointerDragged in class javax.microedition.lcdui.Canvasx - the horizontal coordinate of the clicked pixely - the vertical coordinate of the clicked pixelupdateNextScreen(AccessibleCanvas, Image, int[])public void showNotify()
showNotify in interface AccessibleCanvasshowNotify in class javax.microedition.lcdui.Canvaspublic void hideNotify()
hideNotify in interface AccessibleCanvashideNotify in class javax.microedition.lcdui.Canvas
public void sizeChanged(int width,
int height)
sizeChanged in interface AccessibleCanvassizeChanged in class javax.microedition.lcdui.Canvaswidth - the widthheight - the heightpublic void keyRepeated(int keyCode)
keyRepeated in interface AccessibleCanvaskeyRepeated in class javax.microedition.lcdui.CanvaskeyCode - the code of the keynextCanvasImage,
updateNextScreen(AccessibleCanvas, Image, int[])public void keyReleased(int keyCode)
keyReleased in interface AccessibleCanvaskeyReleased in class javax.microedition.lcdui.CanvaskeyCode - the code of the keynextCanvasImage,
updateNextScreen(AccessibleCanvas, Image, int[])public void keyPressed(int keyCode)
keyPressed in interface AccessibleCanvaskeyPressed in class javax.microedition.lcdui.CanvaskeyCode - the code of the keynextCanvasImage,
updateNextScreen(AccessibleCanvas, Image, int[])
protected void updateNextScreen(AccessibleCanvas next,
javax.microedition.lcdui.Image nextImage,
int[] rgb)
next - the next screennextImage - the image to which the screen should be paintedrgb - the RGB data, can be nullpublic void run()
run in interface java.lang.RunnableRunnable.run()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||