Figure: LWUIT application in Series 40 full touch
By default, LWUIT applications are run in normal canvas in full touch devices. This way familiar look and feel can be achieved by displaying the platform chrome (Status bar, Header bar with Action button 1 and Options menu, and Back button). Also Series 40 Category bar is available.
LWUITMenuBar is not used, but commands are mapped to Options menu, Action button 1, and Back button transparently using native commands.
The sections below describe how developers can change the orientation and run an application in full screen.
Setting the orientation
Series 40 full touch supports both portrait and landscape orientations. By default, an application is run in portrait orientation.
Figure: UI in portrait mode |
|
Figure: UI in landscape mode |
Follow the device orientation
To enable orientation switching, you only have to have MIDlet JAD and JAR manifest attribute "Nokia-MIDlet-App-Orientation" set to value "manual".
Force a specific orientation
Use setAppOrientation(int orientation) method of the OrientationProvider API to force a specific orientation. An example:
OrientationProvider op = OrientationProvider.getOrientationProvider(); if (op != null) { Orientation.setAppOrientation(Orientation.ORIENTATION_LANDSCAPE); }
Listen to orientation changes
With OrientationListener, you can listen to orientation change events and add functionality to your program if the user rotates the device to a different orientation. Use OrientationProvider class to add a new OrientationListener. An example:
OrientationProvider p = OrientationProvider.getOrientationProvider(); p.addOrientationListener(new OrientationListener() { public void displayOrientationChanged(int newDisplayOrientation) { switch (newDisplayOrientation) { case Orientation.ORIENTATION_LANDSCAPE: System.out.println("Switched to landscape mode"); break; case Orientation.ORIENTATION_PORTRAIT: System.out.println("Switched to portrait mode"); break; } } });
In Series 40 full touch, you can force a LWUIT application to run in full screen mode by calling Display.setForceFullScreen(true).
Figure: UI in full screen mode
It is also possible to have the application in full screen mode while having a visible status bar. In Series 40 applications this is typically done by setting “status_zone” trait for the Canvas. When using LWUIT for Series 40, the Canvas is not directly accessible, but you can call Display.getInstance().setObjectTrait(Display.getInstance().getImplementation(), "nokia.ui.canvas.status_zone", Boolean.TRUE);
Figure: UI in full screen mode with status bar visible
There is a limitation that TextEditor cannot be used in full screen mode when having a visible status bar.