Eyelid Field Manager sample app
The eyelid field sample application demonstrates how to use the EyelidFieldManager class to display fields on a pair of managers that appear temporarily at the top and bottom of the screen.
When a BlackBerry device user moves the trackpad or trackball, or when the user touches the screen (on a BlackBerry device with a touch screen), the managers are displayed temporarily on the top and bottom of the screen. While the managers are visible, the user can interact with the fields that appear on each manager. The user can also control the appearance of the managers by selecting or clearing check boxes that appear in the center of the screen.
For more information about displaying fields and managers in a BlackBerry device application, see the UI and Navigation Development Guide.
This file defines the EyelidFieldDemo class.
The EyelidFieldDemo class extends the UiApplication class to support a UI and contains the following constructor and methods:
This file defines the EyelidFieldDemoScreen class and the CustomEditField, CustomLabelField, and SimpleButton nested classes.
The EyelidFieldDemoScreen class extends the MainScreen class to support screen characteristics that are common to BlackBerry device applications and contains the following constructor and methods:
This sample features the following classes:
This class displays fields on a pair of managers that appear temporarily at the top and bottom of the screen. You can add a field to the top manager or bottom manager by invoking addTop(Field field) and addBottom(Field field), respectively. You can also add a field at an absolute position by invoking add(Field field, int x, int y), which is inherited from the AbsoluteFieldManager class.
By default, the managers appear when a BlackBerry device user moves the trackpad or trackball, or touches the screen. The managers disappear after a period of inactivity (by default, 1.2 seconds). You can change the amount of time that the managers are displayed by invoking setEyelidDisplayTime(int time), and you can show or hide the managers manually by invoking setEyelidsVisible(boolean visible).
The sample application adds the following fields to the screen:
- Four fields to the top manager (two CustomLabelField objects, a SeparatorField object, and a CustomEditField object)
- Two fields to the bottom manager (a CustomLabelField object and a HorizontalFieldManager object that contains three SimpleButton objects)
- Two CheckboxField objects at absolute positions
Install the sample app
In the BlackBerry Java Development Environment, open the workspace that you want to add the sample application to.
In the Files pane, right-click <workspace_name>.
Click Add project to <workspace_name>.
In the Add project to <workspace_name> dialog box, browse to the eyelidfielddemo folder. The default location of this folder is C:\Program Files\Research In Motion\BlackBerry JDE 5.0.0\samples\com\rim\samples\device\ui\eyelidfielddemo.
Click the EyelidFieldDemo.jdp file.
The sample is also available in github.
Run the sample app
In the BlackBerry Java Development Environment, in the workspace that you added the EyelidFieldDemo project to, right-click EyelidFieldDemo.
Click Build project.
On the taskbar, click Start > Applications > Research In Motion > BlackBerry JDE 5.0.0 > Device Simulator.
On the Home screen of the BlackBerry Smartphone Simulator, click the Downloads folder.
Click the Eyelid Field Demo icon.