de.enough.polish.ui.splash
Class InitializerMovieScreen

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Canvas
          extended by de.enough.polish.ui.splash.InitializerMovieScreen
All Implemented Interfaces:
Runnable, PlayerListener

public class InitializerMovieScreen
extends Canvas
implements Runnable, PlayerListener

Provides a SplashScreen that initializes the real application in a background thread while playing back a movie.

When the movie playback has finished and the application is initialized, the next screen provided by ApplicationInitializer.initApp() will be shown automatically.

Note that this screen is only available when the target device supports the MMAPI (//#if polish.api.mmapi).

Copyright (c) Enough Software 2008

Author:
Robert Virkus, j2mepolish@enough.de
See Also:
ApplicationInitializer.initApp()

Field Summary
 
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
 
Fields inherited from interface javax.microedition.media.PlayerListener
CLOSED, DEVICE_AVAILABLE, DEVICE_UNAVAILABLE, DURATION_UPDATED, END_OF_MEDIA, ERROR, STARTED, STOPPED, VOLUME_CHANGED
 
Constructor Summary
InitializerMovieScreen(Display display, String movieUrl, String mimeType, ApplicationInitializer initializer)
          Creates a new InitializerMovieScreen using the provided movie URL and a white background.
InitializerMovieScreen(Display display, String movieUrl, String mimeType, ApplicationInitializer initializer, Style style)
          Creates a new InitializerMovieScreen using the provided movie URL and the background specified by the style.
InitializerMovieScreen(Display display, String movieUrl, String mimeType, int backgroundColor, ApplicationInitializer initializer)
          Creates a new InitializerMovieScreen using the internal default view.
InitializerMovieScreen(Display display, String movieUrl, String mimeType, int backgroundColor, ApplicationInitializer initializer, Style style)
          Creates a new InitializerMovieScreen using the internal default view.
 
Method Summary
 Background getBackground()
          Retrieves the background.
 void hideNotify()
           
 void keyPressed(int keyCode)
           
 void paint(Graphics g)
           
 void playerUpdate(Player p, String event, Object data)
           
 void pointerPressed(int x, int y)
           
 void pointerReleased(int x, int y)
           
 void run()
           
 void setBackground(Background background)
          Sets the background of this splash screen.
 void showNotify()
           
 void sizeChanged(int width, int height)
           
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, isDoubleBuffered, keyReleased, keyRepeated, pointerDragged, 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
 

Constructor Detail

InitializerMovieScreen

public InitializerMovieScreen(Display display,
                              String movieUrl,
                              String mimeType,
                              ApplicationInitializer initializer)
Creates a new InitializerMovieScreen using the provided movie URL and a white background.

Parameters:
display - the display responsible for switching screens
movieUrl - the URL to the movie that should be played
mimeType - the mime type of the movie, e.g. image/gif
initializer - the application initializer that will be called in a background thread

InitializerMovieScreen

public InitializerMovieScreen(Display display,
                              String movieUrl,
                              String mimeType,
                              ApplicationInitializer initializer,
                              Style style)
Creates a new InitializerMovieScreen using the provided movie URL and the background specified by the style.

Parameters:
display - the display responsible for switching screens
movieUrl - the URL to the movie that should be played
mimeType - the mime type of the movie, e.g. image/gif
initializer - the application initializer that will be called in a background thread
style - the style for this screen - only the background is currently applied

InitializerMovieScreen

public InitializerMovieScreen(Display display,
                              String movieUrl,
                              String mimeType,
                              int backgroundColor,
                              ApplicationInitializer initializer)
Creates a new InitializerMovieScreen using the internal default view. The message will be shown in the default font.

Parameters:
display - the display responsible for switching screens
movieUrl - the URL to the movie that should be played
mimeType - the mime type of the movie, e.g. image/gif
backgroundColor - the background color, e.g. white: 0xFFFFFF
initializer - the application initializer that will be called in a background thread

InitializerMovieScreen

public InitializerMovieScreen(Display display,
                              String movieUrl,
                              String mimeType,
                              int backgroundColor,
                              ApplicationInitializer initializer,
                              Style style)
Creates a new InitializerMovieScreen using the internal default view. The message will be shown in the default font.

Parameters:
display - the display responsible for switching screens
movieUrl - the URL to the movie that should be played
mimeType - the mime type of the movie, e.g. image/gif
backgroundColor - the background color, e.g. white: 0xFFFFFF
initializer - the application initializer that will be called in a background thread
style - the style for this screen - only the background is currently applied
Method Detail

paint

public void paint(Graphics g)
Specified by:
paint in class Canvas

run

public void run()
Specified by:
run in interface Runnable

keyPressed

public void keyPressed(int keyCode)
Overrides:
keyPressed in class Canvas

pointerPressed

public void pointerPressed(int x,
                           int y)
Overrides:
pointerPressed in class Canvas

pointerReleased

public void pointerReleased(int x,
                            int y)
Overrides:
pointerReleased in class Canvas

sizeChanged

public void sizeChanged(int width,
                        int height)
Overrides:
sizeChanged in class Canvas

showNotify

public void showNotify()
Overrides:
showNotify in class Canvas

hideNotify

public void hideNotify()
Overrides:
hideNotify in class Canvas

getBackground

public Background getBackground()
Retrieves the background. Warning: this method is only available when the J2ME Polish GUI is used, check for the polish.usePolishGui preprocessing symbol

Returns:
the background

setBackground

public void setBackground(Background background)
Sets the background of this splash screen. Warning: this method is only available when the J2ME Polish GUI is used, check for the polish.usePolishGui preprocessing symbol

Parameters:
background - the background to set

playerUpdate

public void playerUpdate(Player p,
                         String event,
                         Object data)
Specified by:
playerUpdate in interface PlayerListener