Input Method
The input method editor (IME) is an input panel (keyboard) that lets the user input text and the platform receive the entered data. The user can select an IME as their default keyboard in the device Settings application.
This feature is supported in mobile applications only.
You can create a Tizen native IME application that provides a new IME. You can start the IME application life-cycle, interact with the current IME UI state, and retrieve attributes and events.
The main features of the Input Method API include:
- Managing the IME life-cycle
The system can have multiple keyboards, and the user can choose which one to use as the default keyboard. The IME application starts its life-cycle when it is selected as the default keyboard. The following figure shows the IME application life-cycle.
Figure: IME application life-cycle
The IME application runs as follows:
- Once the IME application is started, the create() callback function is called.
- When a text input UI control gets the focus, the show() callback function is called.
The IME application can call Input Method APIs to interact with the UI control. The event callback functions are called when the UI control state changes. When the text input UI control loses the focus, the hide() callback function is called.
- When the IME application is finished, the terminate() callback function is called.
- Managing the main loop and event callback functions
The IME application must implement the ime_app_main() function. It is the main entry point, in which you can register event callback functions and call the ime_run() function to start the main loop.
During its life-cycle, the IME application can receive a number of events from the Tizen input service framework through the callback functions. You must register the mandatory create(), terminate(), show(), and hide() callbacks. Other callbacks can be registered as required by the specific IME application.
- Showing and hiding the keyboard
When an associated text input UI control has the focus, the active keyboard is requested to be shown. When the text input UI control loses the focus, the keyboard is requested to be hidden.
The show() and hide() callback functions are used to manage the keyboard visibility, and the IME application must register both of them when starting the IME main loop.
The client application can set various configurations for each text input UI control, such as the cursor position, key layout type, return key type, and flags of predictive text. The configurations are delivered to the IME application though the show() callback function, to allow the keyboard to show the correct look to the user.
- Using the keyboard option menu
Each keyboard can offer its own option menu to allow the user to manage the keyboard settings. Nowadays, most platforms provide the keyboard option menu from the device Settings application or from the keyboard directly.
You can register callback functions that are called when the keyboard option menu opens or closes. These callback functions can be registered before the ime_run() function call in the ime_app_main() function.
The device Settings application triggers the callback function to open the keyboard option menu. The keyboard itself can also trigger the callback function to open its option menu.
Input Method Manager
The Input Method Manager is a module used to manage the installed IMEs. You can use it to open the installed IME list or selector menu after your IME application is installed, and guide the user to select the installed IME:
- Showing the IME list
You can request the installed IME list menu to be opened. If a new IME has been installed, the user can see its name in the IME list, and can use the toggle button to enable the keyboard they want. All keyboards enabled in the IME list are shown in the IME selector to allow the user to select them as the default keyboard.
Figure: IME list
- Showing the IME selector
You can request the IME selector menu to be opened. When the user opens the IME selector menu, it shows all the keyboards enabled in the IME list. The user can change the default keyboard by selecting a new one. By clicking Select keyboard, the user can return to the IME list menu to enable a new IME.
Figure: IME selector
- Checking the IME status
You can check whether a specific IME is enabled or disabled in the system keyboard setting. You can also check which IME is currently selected as the default keyboard. These features are useful when the user installs a new keyboard.