XRSPACE Developer Console

Sample - IME

Introduction

In this sample, we will introduce how to use IME by general and customized.

Developer can change the keyboard style by change components color.

General IME

If developer have the key-in requirements, you can pull the IME component to the scene, and not need do other things, the user can use IME keyboard direct.

Customized IME

If developer want to create their own keyboard, they must implement two class as below:

  • XRIMEjni

  • XRIMEInputfieldCursorAgent

APIs are provided here to trigger native function, the following is a summary of the function.

For Text Change

  • XRIMEjni - imsCommitTextEvent

    Commit “Test” to native, it will show on Inputfield which you specified.

    ../_images/IME-Commit.gif
  • XRIMEjni - imsSetComposingRegionEvent

    Set start point is 1 and end point is 4, it will set composing region for “est”.

    ../_images/IME-SetComposingRegion.gif
  • XRIMEjni - imsSetComposingTextEvent

    Send text “hanks” to native, it will replace the area where you set with “hanks”.

    ../_images/IME-SetComposingText.gif
  • XRIMEjni - imsDeleteTextEvent

    Set cursorPos is 4 and textLen is 2, it will delete 2 words from “n”.

    ../_images/IME-DeleteText.gif

For Keyboard Action

../_images/IME-KeyboardHint.png

For Suggestion Change

../_images/IME-ApplySuggestion.gif
  • XRIMEEventSystem - TriggerReplaceKey

    XRIMEEventSystem - OnUpdateSuggestionString

    For key-in alphabet, use TriggerReplaceKey to send “A” to native, it will invoke OnUpdateSuggestionString and callback “Apple” to OnReturnSuggestion for update suggestion lable.

  • XRIMEEventSystem - TriggerReplaceKey

    XRIMEEventSystem - OnReplaceKeyTrigger

    For click suggestion button, use TriggerReplaceKey to set word content and lenth, it will invoke OnReplaceKeyTrigger.

  • XRIMEEventSystem - ApplySuggestion

    XRIMEEventSystem - OnApplySuggestion

    For next suggestion, use ApplySuggestion to send “Apple” to native, it will invoke OnApplySuggestion and callback “is” to OnReturnSuggestion for update suggestion lable.

Note

More detail description, please vivst API - XRIMERemote, API - XRIMEEventSystem and API - XRIMEJni.