diff --git a/developer/engine/android/16.0/KMManager/addKeyboard.php b/developer/engine/android/16.0/KMManager/addKeyboard.php new file mode 100644 index 000000000..4a25b1c9b --- /dev/null +++ b/developer/engine/android/16.0/KMManager/addKeyboard.php @@ -0,0 +1,87 @@ +%s.%s(Context %s, Keyboard %s)', $class, $method, $param1, $param2); + $methodSyntax2 = sprintf('%s.%s(Context %s, HashMap<String, String> %s)', $class, $method, $param1, $param2); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.addKeyboard()

+ +

Summary

+

The method adds a keyboard into the keyboards list.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+
A Keyboard type of keyboard information.
+
+ +

Returns

+

Returns true if the keyboard was added successfully, false otherwise.

+ +

Description

+

Use this method to include a keyboard in the keyboards list so that it can be selected from the keyboards menu. If the keyboard with same keyboard ID and language ID exists, it updates the existing keyboard info.

+ +

+ +

Syntax (Deprecated)

+
+ +

Parameters

+
+
+
The context.
+
+
A dictionary of keyboard information with keys and values defined as HashMap<String key, String value>.
+
+ +

Returns

+

Returns true if the keyboard was added successfully, false otherwise.

+ +

Description

+

Use this method to include a keyboard in the keyboards list so that it can be selected from the keyboards menu. If the keyboard with same keyboard ID and language ID exists, it updates the existing keyboard info.

+ +

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    // Add a custom keyboard
+    Keyboard kbInfo = new Keyboard(
+      "basic_kbdtam99", // Package ID - filename of the .kmp file
+      "basic_kbdtam99", // Keyboard ID - filename of the .js file
+      "Tamil 99 Basic", // Keyboard Name
+      "ta",             // Language ID
+      "Tamil",          // Language Name
+      "1.0",            // Keyboard Version
+      null,             // URL to help documentation if available
+      null,             // URL to latest .kmp file
+      true,             // Boolean to show this is a new keyboard in the keyboard picker
+
+      // Font information of the .ttf font to use in KMSample2 (for example "aava1.ttf").
+      // basic_kbdtam99 doesn't include a font. Can set blank "" or KMManager.KMDefault_KeyboardFont
+      // KMEA will use the font for the OSK, but the Android device determines the system font used for keyboard output
+      KMManager.KMDefault_KeyboardFont,  // Font for KMSample2
+      KMManager.KMDefault_KeyboardFont); // Font for OSK
+
+    KMManager.addKeyboard(this, kbInfo);
+
+ +

History

+

Added syntax using Keyboard type parameter in Keyman Engine for Android 14.0.

+

Deprecated syntax using the HashMap<String key, String value> parameter in Keyman Engine for Android 14.0

+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/addKeyboardDownloadEventListener.php b/developer/engine/android/16.0/KMManager/addKeyboardDownloadEventListener.php new file mode 100644 index 000000000..594b5821b --- /dev/null +++ b/developer/engine/android/16.0/KMManager/addKeyboardDownloadEventListener.php @@ -0,0 +1,43 @@ +%s.%s(OnKeyboardDownloadEventListener %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.addKeyboardDownloadEventListener()

+ +

Summary

+

The method adds the specified listener into the list of keyboard download event listeners.

+ +

Syntax

+
+ +

Parameters

+
+
+
The listener to receive keyboard download event notifications.
+
+ +

Description

+

Use this method to add a listener to receive keyboard download event notifications. The listener must implement KMManager.OnKeyboardDownloadEventListener interface.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
	@Override
+    protected void onResume() {
+        super.onResume();
+        // ...
+        KMManager.addKeyboardDownloadEventListener(this);
+        // ...
+    }
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/addKeyboardEventListener.php b/developer/engine/android/16.0/KMManager/addKeyboardEventListener.php new file mode 100644 index 000000000..902173de6 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/addKeyboardEventListener.php @@ -0,0 +1,43 @@ +%s.%s(OnKeyboardEventListener %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.addKeyboardEventListener()

+ +

Summary

+

The method adds the specified listener into the list of keyboard event listeners.

+ +

Syntax

+
+ +

Parameters

+
+
+
The listener to receive keyboard event notifications.
+
+ +

Description

+

Use this method to add a listener to receive keyboard event notifications. The listener must implement KMManager.OnKeyboardEventListener interface.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
	@Override
+    protected void onResume() {
+        super.onResume();
+        // ...
+        KMManager.addKeyboardEventListener(this);
+        // ...
+    }
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/addLexicalModel.md b/developer/engine/android/16.0/KMManager/addLexicalModel.md new file mode 100644 index 000000000..72237277d --- /dev/null +++ b/developer/engine/android/16.0/KMManager/addLexicalModel.md @@ -0,0 +1,49 @@ +--- +title: KMManager.addLexicalModel() +--- + +## Summary +The **addLexicalModel()** method adds a lexical model into the lexical models list. + +## Syntax + +```javascript +KMManager.addLexicalModel(Context context, HashMap lexicalModelInfo) +``` + +### Parameters + +`context` +: The context. + +`lexicalModelInfo` +: A dictionary of lexical model information with keys and values defined as `HashMaplexicalModelInfo = new HashMap(); + lexicalModelInfo.put(KMManager.KMKey_PackageID, "example.ta.wordlist"); + lexicalModelInfo.put(KMManager.KMKey_LanguageID, "ta"); + lexicalModelInfo.put(KMManager.KMKey_LexicalModelID, "example.ta.wordlist"); + lexicalModelInfo.put(KMManager.KMKey_LexicalModelVersion, "1.0"); + KMManager.addLexicalModel(this, lexicalModelInfo); + + KMManager.registerLexicalModel(lexicalModelInfo); +``` + +## See also +* [registerLexicalModel()](registerLexicalModel) diff --git a/developer/engine/android/16.0/KMManager/advanceToNextInputMode.md b/developer/engine/android/16.0/KMManager/advanceToNextInputMode.md new file mode 100644 index 000000000..486294b75 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/advanceToNextInputMode.md @@ -0,0 +1,31 @@ +--- +title: KMManager.advanceToNextInputMode() +--- + +## Summary +The **advanceToNextInputMode()** method switches to the next system keyboard input mode. + +## Syntax + +```javascript +KMManager.advanceToNextInputMode() +``` + +## Description +Use this method to switch to the next system keyboard. + + +## Examples + +### Example: Using `advanceToNextInputMode()` + +The following script illustrates the use of `advanceToNextInputMode()`: +```java + // Remove the second keyboard in the list + KMManager.removeKeyboard(this, 1); + + KMManager.advanceToNextInputMode(); +``` + +## See also +* [advanceToPreviousInputMethod()](advanceToPreviousInputMethod) diff --git a/developer/engine/android/16.0/KMManager/advanceToPreviousInputMethod.md b/developer/engine/android/16.0/KMManager/advanceToPreviousInputMethod.md new file mode 100644 index 000000000..3d4b248d4 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/advanceToPreviousInputMethod.md @@ -0,0 +1,32 @@ +--- +title: KMManager.advanceToPreviousInputMethod() +--- + +## Summary +The **advanceToPreviousInputMethod()** method switches to the previous system keyboard input mode. + +## Syntax + +```javascript +KMManager.advanceToPreviousInputMethod() +``` + +## Description +Use this method to switch to the previous system keyboard. + +When only 1 Keyman keyboard is installed, this is the default action for pressing the globe key. + +## Examples + +### Example: Using `advanceToPreviousInputMethod()` + +The following script illustrates the use of `advanceToPreviousInputMethod()`: +```java + // Remove the second keyboard in the list + KMManager.removeKeyboard(this, 1); + + KMManager.advanceToPreviousInputMethod(); +``` + +## See also +* [advanceToNextInputMode()](advanceToNextInputMode) diff --git a/developer/engine/android/16.0/KMManager/applyKeyboardHeight.md b/developer/engine/android/16.0/KMManager/applyKeyboardHeight.md new file mode 100644 index 000000000..2830519c6 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/applyKeyboardHeight.md @@ -0,0 +1,54 @@ +--- +title: KMManager.applyKeyboardHeight() +--- + +## Summary +The **applyKeyboardHeight()** method sets the height of the keyboard frame for +the device's current [screen orientation](https://developer.android.com/training/multiscreen/screensizes#TaskUseOriQuali) +(portrait vs landscape). + +## Syntax +```java +KMManager.applyKeyboardHeight(Context context, int height) +``` + +### Parameters + +`context` +: The context + +`height` +: The height of the keyboard frame in *density-independent pixels (dp)* + +## Description +Use this method when you want to increase or decrease the keyboard height for +the device in the current screen orientation. This height is independent from +the height of the suggestion banner frame. + +For reference, here's a table of the default Keyman keyboard heights for various devices and screen orientation. + + Device Type and Screen Orientation | Default height (dp) | +|-----------------------------------|---------------------| +| Default handset in portrait | 205 | +| Default handset in landscape | 150 | +| 7" tablet in portrait | 305 | +| 7" tablet in landscape | 200 | +| 10" tablet in portrait | 405 | +| 10" tablet in landscape | 300 | + +**Note:** This new keyboard height would be applied for all platforms, so an +adjusted keyboard height for a phone would appear too small for a tablet. + +## Examples + +### Example: Using `applyKeyboardHeight()` +The following script illustrates the use of `applyKeyboardHeight()`: + +```java + // Increase the Keyman keyboard height (default Keyman value for most phones is 205dp) + int newKeyboardHeight = 300; + KMManager.applyKeyboardHeight(this, newKeyboardHeight); +``` + +## See also +* [getKeyboardHeight()](getKeyboardHeight) diff --git a/developer/engine/android/16.0/KMManager/canAddNewKeyboard.php b/developer/engine/android/16.0/KMManager/canAddNewKeyboard.php new file mode 100644 index 000000000..9548851b6 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/canAddNewKeyboard.php @@ -0,0 +1,37 @@ +%s.%s()', $class, $method); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.canAddNewKeyboard()

+ +

Summary

+

The method returns whether adding a new keyboard is enabled.

+ +

Syntax

+
+ +

Returns

+

Returns true if adding a new keyboard is enabled, false otherwise.

+ +

Description

+

Use this method to check if additional keyboards can be added.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    Keyboard kbInfo = ...; // Keyboard information
+    if (KMManager.canAddNewKeyboard()) {
+        KMManager.addKeyboard(this, kbInfo);
+    }
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/canRemoveKeyboard.md b/developer/engine/android/16.0/KMManager/canRemoveKeyboard.md new file mode 100644 index 000000000..b3217d5ac --- /dev/null +++ b/developer/engine/android/16.0/KMManager/canRemoveKeyboard.md @@ -0,0 +1,33 @@ +--- +title: KMManager.canRemoveKeyboard() +--- + +## Summary +The **canRemoveKeyboard()** method returns whether removing a keyboard is enabled, like in the keyboard picker menu. + +## Syntax + +```javascript +KMManager.canRemoveKeyboard() +``` +## Returns + +Returns `true` if removing a keyboard is enabled, `false` otherwise. + +## Description +Use this method to check if a keyboard can be removed. If enabled, you can long-press on a row in the keyboard picker menu to remove a keyboard. + +## Examples + +### Example: Using `canRemoveKeyboard()` + +The following script illustrates the use of `canRemoveKeyboard()`: +```java + if (KeyboardController.getInstance().get().size() > 1 && KMManager.canRemoveKeyboard()) { + // Remove the second keyboard + KMManager.removeKeyboard(this, 1); + } +``` + +## See also +* [canAddNewKeyboard()](canAddNewKeyboard) diff --git a/developer/engine/android/16.0/KMManager/createInputView.php b/developer/engine/android/16.0/KMManager/createInputView.php new file mode 100644 index 000000000..198445f75 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/createInputView.php @@ -0,0 +1,56 @@ +%s.%s(InputMethodService %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.createInputView()

+ +

Summary

+

The creates the input view to be used in InputMethodService.

+ +

Syntax

+
+ +

Parameters

+
+
+
The InputMethodService.
+
+ +

Returns

+

Returns the input view created.

+ +

Description

+

Use this method to create the input view in response to an InputMethodService's onCreateInputView() method.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
private static View inputView = null;
+
+@Override
+public View onCreateInputView() {
+    // create the inputView only once
+    if (inputView == null)
+        inputView = KMManager.createInputView(this);
+    
+    // we must remove the inputView from its previous parent before returning it
+    ViewGroup parent = (ViewGroup) inputView.getParent();
+    if (parent != null)
+        parent.removeView(inputView);
+    
+    return inputView;
+}
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/deregisterLexicalModel.md b/developer/engine/android/16.0/KMManager/deregisterLexicalModel.md new file mode 100644 index 000000000..427fa2f76 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/deregisterLexicalModel.md @@ -0,0 +1,35 @@ +--- +title: KMManager.deregisterLexicalModel() +--- + +## Summary +The **deregisterLexicalModel()** method deregisters the specified lexical model from the LMLayer so it isn't used. + +## Syntax +```javascript +KMManager.degisterLexicalModel(String modelID) +``` + +### Parameters + +`modelID` +: The ID of the lexical model to deregister + +### Returns +`true` + +## Description +Use this method when you want the lexical model to stop generating suggestions. + +## Examples + +### Example: Using `deregisterLexicalModel()` +The following script illustrates the use of `dergisterLexicalModel()`: + +```java + String lexicalModelID = "example.ta.wordlist"; + KMManager.deregisterLexicalModel(lexicalModelID); +``` + +## See also +* [registerLexicalModel()](registerLexicalModel) diff --git a/developer/engine/android/16.0/KMManager/getAssociatedLexicalModel.md b/developer/engine/android/16.0/KMManager/getAssociatedLexicalModel.md new file mode 100644 index 000000000..e92e6f344 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getAssociatedLexicalModel.md @@ -0,0 +1,39 @@ +--- +title: KMManager.getAssociatedLexicalModel() +--- + +## Summary +The **getAssociatedLexicalModel()** method searches the installed lexical models list and see if there's an associated model for a given language + +## Syntax +```java +HashMap getAssociatedLexicalModel(String langId) +``` + +### Parameters + +`langId` +: The language ID + +### Returns +A dictionary of the associated lexical model information with keys and values defined as +`HashMap lexModelMap = KMManager.getAssociatedLexicalModel(langId); +``` + +## See also +* [addLexicalModel()](addLexicalModel) +* [registerLexicalModel()](registerLexicalModel) diff --git a/developer/engine/android/16.0/KMManager/getBannerHeight.php b/developer/engine/android/16.0/KMManager/getBannerHeight.php new file mode 100644 index 000000000..38b0e1513 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getBannerHeight.php @@ -0,0 +1,35 @@ +%s.%s(Context %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getBannerHeight()

+ +

Summary

+

The method returns the height of the suggestion banner.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+ +

Returns

+

Returns the height of the suggestion banner frame in density-independent pixel (dp).

+ +

Description

+

Use this method to get the height of the suggestion banner frame.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    int bannerHeight = KMManager.getBannerHeight(this);
+
diff --git a/developer/engine/android/16.0/KMManager/getCurrentKeyboardIndex.php b/developer/engine/android/16.0/KMManager/getCurrentKeyboardIndex.php new file mode 100644 index 000000000..227f31e00 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getCurrentKeyboardIndex.php @@ -0,0 +1,44 @@ +%s.%s(Context %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getCurrentKeyboardIndex()

+ +

Summary

+

The method returns index number of the current keyboard in keyboards list.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+ +

Returns

+

Returns 0-based index number of the current keyboard if exists in keyboards list, -1 otherwise.

+ +

Description

+

Use this method to get the index number of the currently selected keyboard if it exists in keyboards list.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    int index = KMManager.getCurrentKeyboardIndex(this);
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/getCurrentKeyboardInfo.php b/developer/engine/android/16.0/KMManager/getCurrentKeyboardInfo.php new file mode 100644 index 000000000..9eb17c1e4 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getCurrentKeyboardInfo.php @@ -0,0 +1,78 @@ +%s.%s(Context %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getCurrentKeyboardInfo()

+ +

Summary

+

The method returns keyboard information of the current keyboard.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+ +

Returns

+

Returns the current keyboard information of Keyboard type.

+ +

Description

+

Use this method to get details of the currently selected keyboard. Details include package ID, keyboard ID, language ID, keyboard name, language name and fonts.

+ +

+ +

Syntax (Deprecated)

+
+ +

Parameters

+
+
+
The context.
+
+ +

Returns

+

(Deprecated) Returns an information dictionary of the current keyboard with keys and values defined as HashMap<String key, String value>.

+ +

Description

+

Use this method to get details of the currently selected keyboard. Details include keyboard ID, language ID, keyboard name, language name and fonts.

+ +

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    Keyboard keyboardInfo = KMManager.getCurrentKeyboardInfo(this);
+    if (keyboardInfo != null) {
+        String packageID = keyboardInfo.getPackageID();
+        String keyboardId = keyboardInfo.getKeyboardID();
+        String keyboardName = keyboardInfo.getKeyboardName();
+        String languageId = keyboardInfo.getLanguageID();
+        String languageName = keyboardInfo.getLanguageName();
+        String version = keyboardInfo.getVersion();
+        String font = keyboardInfo.getFont();
+        String oskFont = keyboardInfo.getOSKFont();
+        //
+    }
+
+ +

History

+

Added syntax for returning Keyboard type in Keyman Engine for Android 14.0.

+

Deprecated syntax for returning HashMap<String key, String value> in Keyman Engine for Android 14.0

+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/getDefaultKeyboard.md b/developer/engine/android/16.0/KMManager/getDefaultKeyboard.md new file mode 100644 index 000000000..ad62af60d --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getDefaultKeyboard.md @@ -0,0 +1,29 @@ +--- +title: KMManager.getDefaultKeyboard() +--- + +## Summary +The `getDefaultKeyboard()` method returns the keyboard information for the fallback keyboard. + +## Syntax +```java +KMManager.getDefaultKeyboard() +``` + +### Returns +Returns `Keyboard` type for the fallback keyboard. If not specified, this defaults to keyboard information for sil_euro_latin. + +## Description +The `getDefaultKeyboard()` method returns the keyboard information for the fallback keyboard. If Keyman Engine +has issues with a current keyboard, KMManager will switch to this fallback keyboard. + +## Examples + +### Example: Using getDefaultKeyboard() +The following script illustrates the use of `getDefaultKeyboard()`: +```java + Keyboard kbd = KMManager.getDefaultKeyboard(); +``` + +## See also +* [setDefaultKeyboard](setDefaultKeyboard) diff --git a/developer/engine/android/16.0/KMManager/getDefaultKeyboard.php b/developer/engine/android/16.0/KMManager/getDefaultKeyboard.php new file mode 100644 index 000000000..3a39d33bd --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getDefaultKeyboard.php @@ -0,0 +1,41 @@ +%s.%s()', $class, $method); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getDefaultKeyboard()

+ +

Summary

+

The method returns the default fallback keyboard which will + be used if the app never adds a keyboard.

+ +

Syntax

+
+ +

Returns

+

Returns the Keyboard information of the default fallback keyboard. If + setDefaultKeyboard() is never called, this method returns keyboard info for the + sil_euro_latin keyboard package.

+ +

Description

+

Use this method to get the default fallback keyboard. This is for apps that could start with an empty keyboards list + when the user attempts to use the KEYBOARD_TYPE_INAPP or KEYBOARD_TYPE_SYSTEM keyboard.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    Keyboard kbd = KMManager.getDefaultKeyboard();
+    KMManager.setKeyboard(kbd);
+
+ +

History

+

Added syntax in Keyman Engine for Android 14.0.

+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/getFontTypeface.php b/developer/engine/android/16.0/KMManager/getFontTypeface.php new file mode 100644 index 000000000..f8d74b1b9 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getFontTypeface.php @@ -0,0 +1,48 @@ +%s.%s(Context %s, String %s)', $class, $method, $param1, $param2); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getFontTypeface()

+ +

Summary

+

The method creates a new typeface from the specified font filename.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+
The filename of the font.
+
+ +

Returns

+

Returns the new typeface created from font file with specified filename if it exists, null otherwise.

+ +

Description

+

Use this method to create a new typeface from the font file with specified filename if it exists in assets/fonts/ folder.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    KMTextView textView = (KMTextView) findViewById(R.id.kmTextView);
+    Typeface fontTypeface = KMManager.getFontTypeface(this, "aava1.ttf");
+    textView.setTypeface(fontTypeface);
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/getGlobeKeyAction.md b/developer/engine/android/16.0/KMManager/getGlobeKeyAction.md new file mode 100644 index 000000000..62f1eee28 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getGlobeKeyAction.md @@ -0,0 +1,35 @@ +--- +title: KMMnaager.getGlobeKeyAction() +--- + +## Summary +The **getGlobeKeyAction()** method returns the short-press action type of the 'Globe' key. + +## Syntax +```java +KMManager.getGlobeKeyAction(KeyboardType kbType) +``` + +### Parameters +kbType +: The keyboard type. `KEYBOARD_TYPE_INAPP` or `KEYBOARD_TYPE_SYSTEM` + +### Returns +Returns the action type of the short-press 'Globe' key as one of + `GLOBE_KEY_ACTION_SHOW_MENU`, `GLOBE_KEY_ACTION_SWITCH_TO_NEXT_KEYBOARD`, + `GLOBE_KEY_ACTION_ADVANCE_TO_PREVIOUS_SYSTEM_KEYBOARD`, `GLOBE_KEY_ACTION_ADVANCE_TO_NEXT_SYSTEM_KEYBOARD`, + `GLOBE_KEY_ACTION_SHOW_SYSTEM_KEYBOARDS`, or `GLOBE_KEY_ACTION_DO_NOTHING`. + +## Description +Use this method to get the short-press action type of the 'Globe' key. + +## Examples + +### Example: Using getGLobeKeyAction() +The following script illustrate the use of `getGLobeKeyAction()`: +```java +GlobeKeyAction action = KMManager.getGlobeKeyAction(KeyboardType.KEYBOARD_TYPE_SYSTEM); +``` + +## See also +* [setGlobeKeyAction](setGlobeKeyAction()) diff --git a/developer/engine/android/16.0/KMManager/getHapticFeedback.md b/developer/engine/android/16.0/KMManager/getHapticFeedback.md new file mode 100644 index 000000000..ff428ca24 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getHapticFeedback.md @@ -0,0 +1,23 @@ +--- +title: KMManager.getHapticFeedback() +--- + +## Summary +The **getHapticFeedback()** method returns whether the device vibrates as the user types. + +## Syntax +```java +KMManager.getHapticFeedback() +``` + +### Returns +Returns `true` if the device vibrates as the user types, `false` otherwise. + +## Description +Use this method to check if the device is currently configured to provide haptic feedback. Default is `false`. + +## History +Keyman Engine for Android 15.0: New function. + +## See also +* [setHapticFeedback](setHapticFeedback) diff --git a/developer/engine/android/16.0/KMManager/getKeyboardFontFilename.php b/developer/engine/android/16.0/KMManager/getKeyboardFontFilename.php new file mode 100644 index 000000000..c055e67cd --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getKeyboardFontFilename.php @@ -0,0 +1,34 @@ +%s.%s()', $class, $method); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getKeyboardFontFilename() (Deprecated)

+ +

Summary

+

(Deprecated) The method returns the selected keyboard's font filename.

+ +

Syntax

+
+ +

Returns

+

Returns the selected keyboard's font filename as String if it has any, empty string otherwise.

+ +

Description

+

Use this method to get the font filename of the selected keyboard.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
 String fontFilename = KMManager.getKeyboardFontFilename();
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/getKeyboardFontTypeface.php b/developer/engine/android/16.0/KMManager/getKeyboardFontTypeface.php new file mode 100644 index 000000000..a845372cb --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getKeyboardFontTypeface.php @@ -0,0 +1,43 @@ +%s.%s(Context %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getKeyboardFontTypeface() (Deprecated)

+ +

Summary

+

(Deprecated) The method creates a new typeface from the selected keyboard's font.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+ +

Returns

+

Returns the new typeface created from the selected keyboard's font if it exists, null otherwise.

+ +

Description

+

Use this method to create a new typeface from the selected keyboard's font if it has any.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    KMTextView textView = (KMTextView) findViewById(R.id.kmTextView);
+    Typeface fontTypeface = KMManager.getKeyboardFontTypeface(this);
+    textView.setTypeface(fontTypeface);
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/getKeyboardHeight.php b/developer/engine/android/16.0/KMManager/getKeyboardHeight.php new file mode 100644 index 000000000..33cfcfe07 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getKeyboardHeight.php @@ -0,0 +1,40 @@ +%s.%s(Context %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getKeyboardHeight()

+ +

Summary

+

The method returns the height of the keyboard frame.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+ +

Returns

+

Returns the height of the keyboard frame in density-independent pixels (dp).

+ +

Description

+

Use this method to get the height of the keyboard frame.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    int keyboardHeight = KMManager.getKeyboardHeight(this);
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/getKeyboardIndex.php b/developer/engine/android/16.0/KMManager/getKeyboardIndex.php new file mode 100644 index 000000000..ffc024dfa --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getKeyboardIndex.php @@ -0,0 +1,50 @@ +%s.%s(Context %s, String %s, String %s)', $class, $method, $param1, $param2, $param3); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getKeyboardIndex()

+ +

Summary

+

The method returns index number of the specified keyboard in keyboards list.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+
ID of the keyboard.
+
+
ID of the associated language.
+
+ +

Returns

+

Returns 0-based index number of the specified keyboard if exists in keyboards list, -1 otherwise.

+ +

Description

+

Use this method to get the index number of the keyboard with given keyboard ID and language ID if it exists in keyboards list.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    int index = KMManager.getKeyboardIndex(this, "tamil99m", "ta");
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/getKeyboardInfo.php b/developer/engine/android/16.0/KMManager/getKeyboardInfo.php new file mode 100644 index 000000000..81afbf73d --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getKeyboardInfo.php @@ -0,0 +1,81 @@ +%s.%s(Context %s, int %s)', $class, $method, $param1, $param2); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getKeyboardInfo()

+ +

Summary

+

The method returns information of the specified keyboard.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+
0-based position of the keyboard in keyboards list.
+
+ +

Returns

+

Returns an information Keyboard type of the specified keyboard.

+ +

Description

+

Use this method to get details of the keyboard at given position in keyboards list. Details include keyboard ID, language ID, keyboard name, language name and fonts.

+ +

+ +

Syntax (Deprecated)

+
+ +

Parameters

+
+
+
The context.
+
+
0-based position of the keyboard in keyboards list.
+
+ +

Returns

+

(Deprecated) Returns an information dictionary of the specified keyboard with keys and values defined as HashMap<String key, String value>.

+ +

Description

+

Use this method to get details of the keyboard at given position in keyboards list. Details include keyboard ID, language ID, keyboard name, language name and fonts.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    Keyboard keyboardInfo = KMManager.getKeyboardInfo(this, 1);
+    if (keyboardInfo != null) {
+        String packageID = keyboardInfo.getPackageID();
+        String keyboardId = keyboardInfo.getKeyboardID();
+        String keyboardName = keyboardInfo.getKeyboardName();
+        String languageId = keyboardInfo.getLanguageID();
+        String languageName = keyboardInfo.getLanguageName();
+        String version = keyboardInfo.getVersion();
+        String font = keyboardInfo.getFont();
+        String oskFont = keyboardInfo.getOSKFont();
+        //
+    }
+
+ +

History

+

Added syntax for returning Keyboard type in Keyman Engine for Android 14.0.

+

Deprecated syntax for returning the HashMap<String key, String value> in Keyman Engine for Android 14.0

+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/getKeyboardOskFontFilename.php b/developer/engine/android/16.0/KMManager/getKeyboardOskFontFilename.php new file mode 100644 index 000000000..505fc11f4 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getKeyboardOskFontFilename.php @@ -0,0 +1,36 @@ +%s.%s()', $class, $method); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getKeyboardOskFontFilename()

+ +

Summary

+

The method returns the selected keyboard's OSK font filename.

+ +

Syntax

+
+ +

Returns

+

Returns the selected keyboard's OSK font filename as String if it has any, empty string otherwise.

+ +

Description

+

Use this method to get the OSK font filename of the selected keyboard.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
 String oskFontFilename = KMManager.getKeyboardOskFontFilename();
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/getKeyboardOskFontTypeface.php b/developer/engine/android/16.0/KMManager/getKeyboardOskFontTypeface.php new file mode 100644 index 000000000..36c7d635c --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getKeyboardOskFontTypeface.php @@ -0,0 +1,43 @@ +%s.%s(Context %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getKeyboardOskFontTypeface()

+ +

Summary

+

The method creates a new typeface from the selected keyboard's OSK font.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+ +

Returns

+

Returns the new typeface created from the selected keyboard's OSK font if it exists, null otherwise.

+ +

Description

+

Use this method to create a new typeface from the selected keyboard's OSK font if it has any.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    Typeface oskFontTypeface = KMManager.getKeyboardOskFontTypeface(this);
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/getKeyboardState.php b/developer/engine/android/16.0/KMManager/getKeyboardState.php new file mode 100644 index 000000000..791336fae --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getKeyboardState.php @@ -0,0 +1,60 @@ +%s.%s(Context %s, String %s, String %s)', $class, $method, $param1, $param2, $param3); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getKeyboardState()

+ +

Summary

+

The method returns the specified keyboard's state.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+
ID of the keyboard.
+
+
ID of the associated language.
+
+ +

Returns

+

Returns the state of the specified keyboard as one of KEYBOARD_STATE_UNDEFINED, KEYBOARD_STATE_NEEDS_DOWNLOAD, KEYBOARD_STATE_NEEDS_UPDATE or KEYBOARD_STATE_UP_TO_DATE.

+ +

Description

+

Use this method to get the state of the specified keyboard. It returns KEYBOARD_STATE_UNDEFINED + if keyboardID or languageID is not specified (null or empty string). + It returns KEYBOARD_STATE_NEEDS_DOWNLOAD if the specified keyboard does not exist in + assets/languages/ folder. In all other cases it returns either KEYBOARD_STATE_UP_TO_DATE or + KEYBOARD_STATE_NEEDS_UPDATE. Note: Only keyboards provided by Keyman may return + KEYBOARD_STATE_NEEDS_UPDATE. If you have a custom keyboard, you need to implement your own method to + check whether or not it needs update. KEYBOARD_STATE_UP_TO_DATE does not necessarily mean that the + keyboard is in fact up to date, you need to make sure language list has recently been displayed (see + showLanguageList() (Deprecated)) without failure to access Keyman server to be certain. + +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    KeyboardState keyboardState = KMManager.getKeyboardState(this, "tamil99m", "ta");
+    switch (keyboardState) {
+        case KEYBOARD_STATE_NEEDS_DOWNLOAD:
+            // We need to download this keyboard or manually add it into assets/languages/ folder.
+            break;
+        case KEYBOARD_STATE_UP_TO_DATE:
+        case KEYBOARD_STATE_NEEDS_UPDATE:
+            // We can safely use this keyboard since it exists in assets/languages/ folder.
+            break;
+        default:
+            // Undefined state
+    }
+
diff --git a/developer/engine/android/16.0/KMManager/getKeyboardTextFontFilename.php b/developer/engine/android/16.0/KMManager/getKeyboardTextFontFilename.php new file mode 100644 index 000000000..94f719ebd --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getKeyboardTextFontFilename.php @@ -0,0 +1,36 @@ +%s.%s()', $class, $method); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getKeyboardTextFontFilename()

+ +

Summary

+

The method returns the selected keyboard's text font filename.

+ +

Syntax

+
+ +

Returns

+

Returns the selected keyboard's text font filename as String if it has any, empty string otherwise.

+ +

Description

+

Use this method to get the text font filename of the selected keyboard.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
 String textFontFilename = KMManager.getKeyboardTextFontFilename();
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/getKeyboardTextFontTypeface.php b/developer/engine/android/16.0/KMManager/getKeyboardTextFontTypeface.php new file mode 100644 index 000000000..d78655db0 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getKeyboardTextFontTypeface.php @@ -0,0 +1,45 @@ +%s.%s(Context %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getKeyboardTextFontTypeface()

+ +

Summary

+

The method creates a new typeface from the selected keyboard's text font.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+ +

Returns

+

Returns the new typeface created from the selected keyboard's text font if it exists, null otherwise.

+ +

Description

+

Use this method to create a new typeface from the selected keyboard's text font if it has any.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    KMTextView textView = (KMTextView) findViewById(R.id.kmTextView);
+    Typeface textFontTypeface = KMManager.getKeyboardTextFontTypeface(this);
+    textView.setTypeface(textFontTypeface);
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/getKeyboardsList.php b/developer/engine/android/16.0/KMManager/getKeyboardsList.php new file mode 100644 index 000000000..5328afac3 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getKeyboardsList.php @@ -0,0 +1,73 @@ +%s.%s(Context %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getKeyboardsList()

+ +

Summary

+

The method returns the keyboards list.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+ +

Returns

+

Returns keyboards list as List<Keyboard> if it exists, null otherwise.

+ +

Description

+

Use this method to get details of all keyboard's in keyboards menu.

+ +

+ +

Syntax (Deprecated)

+
+ +

Parameters

+
+
+
The context.
+
+ +

Returns

+

(Deprecated) Returns keyboards list as ArrayList<HashMap<String key, String value>> if it exists, null otherwise.

+ +

Description

+

Use this method to get details of all keyboard's in keyboards menu.

+ +

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    List<Keyboard> keyboardsList = KMManager.getKeyboardsList(this);
+    if ((keyboardsList != null) && keyboardsList.size() < 2) {
+        // Add another Keyboard
+        Keyboard kbd = new Keyboard(...);
+        KMManager.addKeyboard(kbd);
+    }
+
+ +

History

+ +

Added syntax for returning list of Keyboard type in Keyman Engine for Android 14.0.

+

Deprecated syntax for returning the list of HashMap<String key, String value> in Keyman Engine for Android 14.0

+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/getLanguageCorrectionPreferenceKey.md b/developer/engine/android/16.0/KMManager/getLanguageCorrectionPreferenceKey.md new file mode 100644 index 000000000..42f75f727 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getLanguageCorrectionPreferenceKey.md @@ -0,0 +1,40 @@ +--- +title: KMManager.getLanguageCorrectionPreferenceKey() +--- + +## Summary +A constant to use as a shared preference key to store whether the LMLayer should enable corrections for a given language. + +## Syntax +```java +KMManager.getLanguageCorrectionPreferenceKey(String langID) +``` + +### Parameters + +`langId` +: The BCP 47 language ID + +### Returns +Returns the language correction preference key as a String. + +## Description +Use this method to get a String that can be used as a shared preference key. + +The usage of this preference key is experimental and likely to be deprecated in a future release of Keyman Engine for Android. + +## Examples + +### Example: Using `getLanguageCorrectionPreferenceKey()` +The following script illustrates the use of `getLanguageCorrectionPreferenceKey()`: + +```java + SharedPreferences prefs = ...; // Get the app's shared preferences + String langID = "ta"; + boolean key = KMManager.getLanguageCorrectionPreferenceKey(langID); + + boolean mayCorrect = prefs.getBoolean(key, true); +``` + +## See also +* [getLanguagePredictionPreferenceKey()](getLanguagePredictionPreferenceKey) diff --git a/developer/engine/android/16.0/KMManager/getLanguagePredictionPreferenceKey.md b/developer/engine/android/16.0/KMManager/getLanguagePredictionPreferenceKey.md new file mode 100644 index 000000000..fe5102bcd --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getLanguagePredictionPreferenceKey.md @@ -0,0 +1,40 @@ +--- +title: KMManager.getLanguagePredictionPreferenceKey() +--- + +## Summary +A constant to use as a shared preference key to store whether the LMLayer should enable suggestions for a given language. + +## Syntax +```java +KMManager.getLanguagePredictionPreferenceKey(String langID) +``` + +### Parameters + +`langId` +: The BCP 47 language ID + +### Returns +Returns the language prediction preference key as a String. + +## Description +Use this method to get a String that can be used as a shared preference key. + +The usage of this preference key is experimental and likely to be deprecated in a future release of Keyman Engine for Android. + +## Examples + +### Example: Using `getLanguagePredictionPreferenceKey()` +The following script illustrates the use of `getLanguagePredictionPreferenceKey()`: + +```java + SharedPreferences prefs = ...; // Get the app's shared preferences + String langID = "ta"; + boolean key = KMManager.getLanguagePredictionPreferenceKey(langID); + + boolean mayPredict = prefs.getBoolean(key, true); +``` + +## See also +* [getLanguageCorrectionPreferenceKey()](getLanguageCorrectionPreferenceKey) diff --git a/developer/engine/android/16.0/KMManager/getLatestKeyboardFileVersion.php b/developer/engine/android/16.0/KMManager/getLatestKeyboardFileVersion.php new file mode 100644 index 000000000..c87e6cd3a --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getLatestKeyboardFileVersion.php @@ -0,0 +1,54 @@ +%s.%s(Context %s, String %s, String %s)', + $class, $method, $param1, $param2, $param3); +head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getLatestKeyboardFileVersion()

+ +

Summary

+

The method returns the specified keyboard's latest file version number.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+
ID of the package.
+
+
ID of the keyboard.
+
+ +

Returns

+

Returns the specified keyboard's latest file version number as String if the keyboard exists, null otherwise.

+ +

Description

+

Use this method to get the latest file version number of the specified keyboard if it exists in the + assets/cloud/ or assets/packages/ folder.

+ +

If packageID is cloud, this method determines the latest file version by the filename.

+ +

If packageID is something else, the metadata file assets/packageID/kmp.json is parsed to determine the keyboard version.

+

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    String latestVersion = getLatestKeyboardFileVersion(this, "cloud", "tamil99m");
+    if (latestVersion != null) {
+        // If we assume that there are 2 tamil99m keyboard files in assets/cloud/ folder
+        // with filenames; tamil99m-1.0.js and tamil99m-1.1.js
+        // then latestVersion = "1.1"
+    }
+    else {
+        // This keyboard does not exist in assets/cloud/ folder!
+    }
+
diff --git a/developer/engine/android/16.0/KMManager/getMaySendCrashReport.md b/developer/engine/android/16.0/KMManager/getMaySendCrashReport.md new file mode 100644 index 000000000..84a5ffd56 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getMaySendCrashReport.md @@ -0,0 +1,23 @@ +--- +title: KMManager.getMaySendCrashReport() +--- + +## Summary +The **getMaySendCrashReport()** method returns whether Keyman Engine is allowed to send crash reports over the network to sentry.keyman.com. + +## Syntax +```java +KMManager.getMaySendCrashReport() +``` + +### Returns +Returns `true` if crash reports can be sent over the network to sentry.keyman.com, `false` otherwise. + +## Description +Use this method to check if Keyman Engine will be accessing the network to send crash reports. + +## History +Added syntax in Keyman Engine for Android 14.0. + +## See also +* [setMaySendCrashReport](setMaySendCrashReport) diff --git a/developer/engine/android/16.0/KMManager/getSpacebarText.md b/developer/engine/android/16.0/KMManager/getSpacebarText.md new file mode 100644 index 000000000..3b94ffe3b --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getSpacebarText.md @@ -0,0 +1,45 @@ +--- +title: KMManager.getSpacebarText() +--- + +## Summary + +The `getSpacebarText()` method returns the current text display pattern for the +spacebar. + +## Syntax + +```java +KMManager.SpacebarText KMManager.getSpacebarText() +``` + +### Returns + +The current text display pattern for the spacebar, one of: + + * `LANGUAGE` - the language name for the keyboard + * `KEYBOARD` - the keyboard name + * `LANGUAGE_KEYBOARD` - both the language name and the keyboard name, + separated by hyphen + * `BLANK` - no text to be displayed + +## Description + +The default text display pattern is `LANGUAGE_KEYBOARD`. The text shown on the +keyboard may be overridden on a per-keyboard basis with the `displayName` +parameter of the `setKeyboard()` function. + +--- + +## Example: Using `getSpacebarText()` + +The following script illustrates the use of `getSpacebarText()`: + +```java +// get the current spacebar text mode +KMManager.SpacebarText mode = KMManager.getSpacebarText(); +``` + +## See also + +* [`setSpacebarText()`](setSpacebarText) diff --git a/developer/engine/android/16.0/KMManager/getVersion.php b/developer/engine/android/16.0/KMManager/getVersion.php new file mode 100644 index 000000000..4d8170f11 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/getVersion.php @@ -0,0 +1,28 @@ +%s.%s()', $class, $method); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.getVersion()

+ +

Summary

+

The method returns the version number of Keyman Engine.

+ +

Syntax

+
+ +

Returns

+

Returns Keyman Engine version number as String.

+ +

Description

+

Use this method to get the version number of Keyman Engine.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    String version = KMManager.getVersion();
+
diff --git a/developer/engine/android/16.0/KMManager/hasConnection.md b/developer/engine/android/16.0/KMManager/hasConnection.md new file mode 100644 index 000000000..305ed41b0 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/hasConnection.md @@ -0,0 +1,38 @@ +--- +title: KMManager.hasConnection() +--- + +## Summary +The **hasConnection()** method returns whether the device has active network connection. + +## Syntax +```java +KMManager.hasConnection(Context context) +``` + +## Parameters + +`context` +: The context + +## Returns +Returns `true` if application's AndroidManifest.xml file has granted +[Manifest.permission.ACCESS_NETWORK_STATE](https://developer.android.com/reference/android/Manifest.permission#ACCESS_NETWORK_STATE) +permission and the device has an active network connection, `false` otherwise. + +## Description +Use this method to check if the device has an active network connection. It is important to make sure there is an active network connection before initiating a download or update. + +## Examples + +### Example: Using `hasConnection()` +The following script illustrate the use of `hasConnection()`: + +```java + if (KMManager.hasConnection(this)) { + // has network connection + } + else { + // no network connection + } +``` diff --git a/developer/engine/android/16.0/KMManager/hideSystemKeyboard.php b/developer/engine/android/16.0/KMManager/hideSystemKeyboard.php new file mode 100644 index 000000000..5469f00c4 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/hideSystemKeyboard.php @@ -0,0 +1,35 @@ +%s.%s()', $class, $method); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.hideSystemKeyboard()

+ +

Summary

+

The method hides the system OSK.

+ +

Syntax

+
+ +

Description

+

Use this method to hide the system OSK. A common usage is to prevent your app from displaying both in-app OSK and the system OSK.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+

+protected void onResume() {
+  super.onResume();
+  KMManager.onResume();
+  KMManager.hideSystemKeyboard();
+  // ...
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/index.php b/developer/engine/android/16.0/KMManager/index.php new file mode 100644 index 000000000..d3503e8a3 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/index.php @@ -0,0 +1,264 @@ + "$class class"]); + + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array for sample +?> +

KMManager class

+ +

Summary

+ +

The KMManager class provides methods for controlling Keyman Engine

+ +

Syntax

+ +
KMManager.methodName()
+
KMManager.CONSTANT
+ +

Description

+ +

The KMManager is the core class which provides most of the methods and constants you will need to develop your apps with Keyman Engine

+ + + +

Methods

+ +
+
addKeyboard()
+
adds a keyboard into the keyboards list
+ +
addKeyboardDownloadEventListener()
+
adds the specified listener into the list of keyboard download event listeners
+ +
addKeyboardEventListener()
+
adds the specified listener into the list of keyboard event listeners
+ +
addLexicalModel()
+
adds a lexical model into the lexical models list
+ +
advanceToNextInputMode()
+
switch to the next system keyboard input mode
+ +
advanceToPreviousInputMethod()
+
switch to the previous system keyboard input mode
+ +
applyKeyboardHeight()
+
sets the height of keyboard frame
+ +
canAddNewKeyboard()
+
returns whether adding a new keyboard is enabled, like in the keyboard picker menu
+ +
canRemoveKeyboard()
+
returns whether removing a keyboard is enabled, like in the keyboard picker menu
+ +
createInputView()
+
creates the input view to be used in InputMethodService
+ +
deregisterLexicalModel()
+
deregisters the specified lexical model from the LMLayer so it isn't used
+ +
executeHardwareKeystroke()
+
process the keystroke generated from a physical keyboard
+ +
getAssociatedLexicalModel()
+
search the installed lexical models list and see if there's an associated model for a given language
+ +
getBannerHeight()
+
returns the height of the suggestion banner
+ +
getCurrentKeyboardIndex()
+
returns index number of the current keyboard in keyboards list
+ +
getCurrentKeyboardInfo()
+
returns information dictionary of the current keyboard
+ +
getDefaultKeyboard()
+
returns the keyboard information for the fallback keyboard
+ +
getFontTypeface()
+
creates a new typeface from the specified font filename
+ +
getGlobeKeyAction()
+
returns the action type of the 'Globe' key
+ +
getHapticFeedback()
+
returns whether the device vibrates as the user types
+ +
getKeyboardFontFilename() (Deprecated)
+
use getKeyboardTextFontFilename or getKeyboardOskFontFilename instead
+ +
getKeyboardFontTypeface() (Deprecated)
+
use getKeyboardTextFontTypeface or getKeyboardOskFontTypeface instead
+ +
getKeyboardHeight()
+
returns the height of the keyboard frame
+ +
getKeyboardIndex()
+
returns index number of the specified keyboard in keyboards list
+ +
getKeyboardInfo()
+
returns information dictionary of the specified keyboard
+ +
getKeyboardsList()
+
returns the array of keyboards list
+ +
getKeyboardOskFontFilename()
+
returns the selected keyboard's OSK font filename
+ +
getKeyboardOskFontTypeface()
+
creates a new typeface from the selected keyboard's OSK font
+ +
getKeyboardState()
+
returns the specified keyboard's state
+ +
getKeyboardTextFontFilename()
+
returns the selected keyboard's text font filename
+ +
getKeyboardTextFontTypeface()
+
creates a new typeface from the selected keyboard's text font
+ +
getKMKeyboard()
+
returns the KMKeyboard depending whether it's an in-app or system keyboard
+ +
getLatestKeyboardFileVersion()
+
returns the specified keyboard's latest file version number
+ +
getLexicalModelInfo()
+
returns information dictionary of the specified lexical model
+ +
getLexicalModelsList()
+
returns the array of lexical models list
+ +
getLanguageCorrectionPreferenceKey()
+
returns a String to use as a shared preference key to store whether the LMLayer should enable corrections for a given language
+ +
getLanguagePredictionPreferenceKey()
+
returns a String to use as a shared preference key to store whether the LMLayer should enable suggestions for a given language.
+ +
getMaySendCrashReport()
+
returns whether Keyman Engine is allowed to send crash reports over the network to sentry.keyman.com
+ +
getSpacebarText()
+
returns the current text display pattern for the spacebar
+ +
getVersion()
+
returns the version number of Keyman Engine
+ +
hasConnection()
+
returns whether the device has active network connection
+ +
hideSystemKeyboard()
+
hides the system OSK
+ +
initialize()
+
initializes the Keyman manager
+ +
isDebugMode()
+
returns whether debugging of Keyman Engine is enabled
+ +
isHelpBubbleEnabled() (Deprecated)
+
returns whether the help bubble is enabled
+ +
isKeyboardLoaded()
+
returns whether the specified in-app or system keyboard is loaded
+ +
keyboardExists()
+
returns whether the specified keyboard exists in keyboards list
+ +
lexicalModelExists()
+
returns whether the specified lexical model exists in lexical models list
+ +
onConfigurationChanged()
+
performs necessary actions in an InputMethodService's onConfigurationChanged()
+ +
onDestroy()
+
performs necessary actions in an InputMethodService's onDestroy()
+ +
onPause()
+
performs necessary actions in an Activity's onPause()
+ +
onResume()
+
performs necessary actions in an Activity's onResume()
+ +
onStartInput()
+
performs necessary actions in an InputMethodService's onStartInput()
+ +
registerAssociatedLexicalModel()
+
registers a lexical model with the associated language ID
+ +
registerLexicalModel
+
registers a lexical model to use with the LMLayer
+ +
removeKeyboard()
+
removes the keyboard at specified position from the keyboards list
+ +
removeKeyboardDownloadEventListener()
+
removes the specified listener from the list of keyboard download event listeners
+ +
removeKeyboardEventListener()
+
removes the specified listener from the list of keyboard event listeners
+ +
setCanAddNewKeyboard()
+
sets whether adding a new keyboard is allowed
+ +
setCanRemoveKeyboard()
+
sets whether removing a keyboard is allowed, like in the keyboard picker menu
+ +
setDebugMode()
+
enables or disables debugging of Keyman Engine
+ +
setDefaultKeyboard()
+
sets the keyboard information for the fallback keyboard
+ +
setGlobeKeyAction()
+
sets an action type for the 'Globe' key
+ +
setHapticFeedback()
+
sets whether the device vibrates as the user types
+ +
setHelpBubbleEnabled() (deprecated)
+
enables or disables the help bubble
+ +
setKeyboard()
+
sets the keyboard to be used
+ +
setKeyboardPickerFont()
+
sets the font for the keyboard picker menu
+ +
setKeymanLicense() (Deprecated)
+
sets the developer license/key pair to unlock Keyman Engine
+ +
setMaySendCrashReport()
+
sets whether Keyman Engine can send crash reports over the network to sentry.keyman.com
+ +
setShouldAllowSetKeyboard()
+
sets whether Keyman Engine allows setting a keyboard other than the default keyboard
+ +
setShouldCheckKeyboardUpdates()
+
sets whether Keyman Engine should check for keyboard updates
+ +
setSpacebarText()
+
sets the current text display pattern for the spacebar
+ +
shouldAllowSetKeyboard()
+
returns whether Keyman Engine allows setting a keyboard other than the default keyboard
+ +
shouldCheckKeyboardUpdates()
+
returns whether Keyman Engine should check for keyboard updates
+ +
showKeyboardPicker()
+
displays the keyboard picker menu
+ +
showLanguageList() (Deprecated)
+
displays the language list
+ +
switchToNextKeyboard()
+
loads the next available keyboard in keyboards list
+ +
updateSelectionRange()
+
updates the selection range of the current context
+ +
updateText()
+
updates the current context with the specified text
+
diff --git a/developer/engine/android/16.0/KMManager/initialize.php b/developer/engine/android/16.0/KMManager/initialize.php new file mode 100644 index 000000000..99a443d07 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/initialize.php @@ -0,0 +1,44 @@ +%s.%s(Context %s, KeyboardType %s)', $class, $method, $param1, $param2); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.initialize()

+ +

Summary

+

The method initializes the Keyman manager.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context that starts the initialization. This is normally an Activity or the application context of an InputMethodService.
+
+
KeyboardType to be used. KEYBOARD_TYPE_INAPP or KEYBOARD_TYPE_SYSTEM.
+
+ +

Description

+

This method is normally called from onCreate() method of an Activity or InputMethodService.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
@Override
+protected void onCreate(Bundle savedInstanceState) {
+    super.onCreate(savedInstanceState);
+    // ...
+    KMManager.initialize(this, KeyboardType.KEYBOARD_TYPE_INAPP);
+    // ...
+    // do not call setContentView before initializing the Keyman manager.
+    setContentView(R.layout.activity_main);
+    // ...
+}
+
diff --git a/developer/engine/android/16.0/KMManager/isDebugMode.php b/developer/engine/android/16.0/KMManager/isDebugMode.php new file mode 100644 index 000000000..5a58a6d71 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/isDebugMode.php @@ -0,0 +1,33 @@ +%s.%s()', $class, $method); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.isDebugMode()

+ +

Summary

+

The method returns whether debugging of Keyman Engine is enabled.

+ +

Syntax

+
+ +

Returns

+

Returns true if debugging is enabled, false otherwise.

+ +

Description

+

Use this method to check if debugging of Keyman Engine is enabled.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    boolean isDebugEnabled = KMManager.isDebugMode();
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/isHelpBubbleEnabled.php b/developer/engine/android/16.0/KMManager/isHelpBubbleEnabled.php new file mode 100644 index 000000000..adeca94b5 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/isHelpBubbleEnabled.php @@ -0,0 +1,36 @@ +%s.%s()', $class, $method); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.isHelpBubbleEnabled() (Deprecated)

+ +

Summary

+

The method returns whether the help bubble is enabled.

+ +

Syntax

+
+ +

Returns

+

Returns true if the help bubble is enabled, false otherwise.

+ +

Description

+

Use this method to check if the help bubble is enabled. This method only works for the in-app keyboard since the system-wide keyboard never displays a help bubble.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    boolean isHelpBubbleEnabled = KMManager.isHelpBubbleEnabled();
+
+ +

History

+

Deprecated syntax in Keyman Engine for Android 16.0

+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/isKeyboardLoaded.md b/developer/engine/android/16.0/KMManager/isKeyboardLoaded.md new file mode 100644 index 000000000..8e390c739 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/isKeyboardLoaded.md @@ -0,0 +1,44 @@ +--- +title: KMManager.isKeyboardLoaded() +--- + +## Summary +The **isKeyboardLoaded()** method returns whether the specified in-app or system keyboard is loaded. + +## Syntax +```java +KMManager.isKeyboardLoaded(KeyboardType type) +``` + +### Parameters +type + +: `KeyboardType.KEYBOARD_TYPE_INAPP` or `KeyboardType.KEYBOARD_TYPE_SYSTEM` + +If type is `KeyboardType.KEYBOARD_TYPE_UNDEFINED`, the function will return `false`. + +### Returns +Returns `true` if the specified keyboard is loaded, `false` otherwise. + +## Description +Use this method to check if a keyboard is loaded and ready to use. + +--- + +## Examples + +### Example: Using isKeyboardLoaded +The following script illustrate the use of `isKeyboardLoaded` + +```java +if (KMManager.isKeyboardLoaded(KeyboardType.KEYBOARD_TYPE_SYSTEM) { + // Get the keyboard info at index 0 + Keyboard keyboardInfo = KMManager.getKeyboardInfo(this, 0) +} +``` + +## History +Added syntax in Keyman Engine for Android 14.0. + +## See also +* [setKeyboard](setKeyboard) diff --git a/developer/engine/android/16.0/KMManager/keyboardExists.php b/developer/engine/android/16.0/KMManager/keyboardExists.php new file mode 100644 index 000000000..ebbf3ef7d --- /dev/null +++ b/developer/engine/android/16.0/KMManager/keyboardExists.php @@ -0,0 +1,50 @@ +%s.%s(Context %s, String %s, String %s)', $class, $method, $param1, $param2, $param3); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.keyboardExists()

+ +

Summary

+

The method returns whether the specified keyboard exists in keyboards list.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+
ID of the keyboard.
+
+
ID of the associated language.
+
+ +

Returns

+

Returns true if the keyboard exists in keyboards list, false otherwise.

+ +

Description

+

Use this method to check if the keyboard with given keyboard ID and language ID exists in keyboards list.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    boolean keyboardExists = KMManager.keyboardExists(this, "tamil99m", "ta");
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/onConfigurationChanged.php b/developer/engine/android/16.0/KMManager/onConfigurationChanged.php new file mode 100644 index 000000000..70f1994df --- /dev/null +++ b/developer/engine/android/16.0/KMManager/onConfigurationChanged.php @@ -0,0 +1,44 @@ +%s.%s(Configuration %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.onConfigurationChanged()

+ +

Summary

+

The method performs necessary actions in an InputMethodService's onConfigurationChanged().

+ +

Syntax

+
+ +

Parameters

+
+
+
The new device configuration.
+
+ +

Description

+

To be called from an InputMethodService's onConfigurationChanged() method.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
@Override
+public void onConfigurationChanged(Configuration newConfig) {
+    super.onConfigurationChanged(newConfig);
+    KMManager.onConfigurationChanged(newConfig);
+    // ...
+}
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/onDestroy.php b/developer/engine/android/16.0/KMManager/onDestroy.php new file mode 100644 index 000000000..aefc1a228 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/onDestroy.php @@ -0,0 +1,37 @@ +%s.%s()', $class, $method); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.onDestroy()

+ +

Summary

+

The method performs necessary actions in an InputMethodService's onDestroy().

+ +

Syntax

+
+ +

Description

+

To be called from an InputMethodService's onDestroy() method.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
@Override
+public void onDestroy() {
+    // ...
+    KMManager.onDestroy();
+    super.onDestroy();
+}
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/onPause.php b/developer/engine/android/16.0/KMManager/onPause.php new file mode 100644 index 000000000..03b20b657 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/onPause.php @@ -0,0 +1,35 @@ +%s.%s()', $class, $method); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.onPause()

+ +

Summary

+

The method performs necessary actions in an Activity's onPause().

+ +

Syntax

+
+ +

Description

+

To be called from an Activity's onPause() method.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
@Override
+protected void onPause() {
+    super.onPause();
+    KMManager.onPause();
+    // ...
+}
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/onResume.php b/developer/engine/android/16.0/KMManager/onResume.php new file mode 100644 index 000000000..2ca2ad77f --- /dev/null +++ b/developer/engine/android/16.0/KMManager/onResume.php @@ -0,0 +1,35 @@ +%s.%s()', $class, $method); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.onResume()

+ +

Summary

+

The method performs necessary actions in an Activity's onResume().

+ +

Syntax

+
+ +

Description

+

To be called from an Activity's onResume() method.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
@Override
+protected void onResume() {
+    super.onResume();
+    KMManager.onResume();
+    // ...
+}
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/onStartInput.php b/developer/engine/android/16.0/KMManager/onStartInput.php new file mode 100644 index 000000000..2badd982a --- /dev/null +++ b/developer/engine/android/16.0/KMManager/onStartInput.php @@ -0,0 +1,48 @@ +%s.%s(EditorInfo %s, boolean %s)', $class, $method, $param1, $param2); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.onStartInput()

+ +

Summary

+

The method performs necessary actions in an InputMethodService's onStartInput().

+ +

Syntax

+
+ +

Parameters

+
+
+
Description of the type of text being edited.
+
+
Set to true if we are restarting input on the same text field as before.
+
+ +

Description

+

To be called from an InputMethodService's onStartInput() method.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
@Override
+public void onStartInput(EditorInfo attribute, boolean restarting) {
+    // ...
+    super.onStartInput(attribute, restarting);
+    KMManager.onStartInput(attribute, restarting);
+    // ...
+}
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/registerAssociatedLexicalModel.md b/developer/engine/android/16.0/KMManager/registerAssociatedLexicalModel.md new file mode 100644 index 000000000..32943839d --- /dev/null +++ b/developer/engine/android/16.0/KMManager/registerAssociatedLexicalModel.md @@ -0,0 +1,36 @@ +--- +title: KMManager.registerAssociatedLexicalModel() +--- + +## Summary +The **registerAssociatedLexicalModel()** method registers a lexical model with the associated language ID. + +## Syntax +```java +KMManager.registerAssociatedLexicalModel(String langId) +``` + +### Parameters + +`langId` +: The BCP 47 language ID + +### Returns +Returns `true` if a new lexical model is loaded (different from the currently loaded lexical model), `false` otherwise. + +## Description +Use this method after switching keyboard languages so the LMLayer will load and use the correct lexical model for generating suggestions. + +## Examples + +### Example: Using `registerAssociatedLexicalModel()` +The following script illustrates the use of `registerAssociatedLexicalModel()`: + +```java + String langId = "ta"; + KMManager.registerAssociatedLexicalModel(langId); +``` + +## See also +* [getAssociatedLexicalModel()](getAssociatedLexicalModel) +* [registerLexicalModel()](registerLexicalModel) diff --git a/developer/engine/android/16.0/KMManager/registerLexicalModel.md b/developer/engine/android/16.0/KMManager/registerLexicalModel.md new file mode 100644 index 000000000..3c8a14589 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/registerLexicalModel.md @@ -0,0 +1,45 @@ +--- +title: KMManager.registerLexicalModel() +--- + +## Summary +The **registerLexicalModel()** method registers a lexical model to use with the LMLayer. + +## Syntax +```java +KMManager.registerLexicalModel(HashMap lexicalModelInfo) +``` + +### Parameters +`lexicalModelInfo` + +: A dictionary of lexical model information with keys and values defined as `HashMaplexicalModelInfo = new HashMap(); + lexicalModelInfo.put(KMManager.KMKey_PackageID, "example.ta.wordlist"); + lexicalModelInfo.put(KMManager.KMKey_LanguageID, "ta"); + lexicalModelInfo.put(KMManager.KMKey_LexicalModelID, "example.ta.wordlist"); + lexicalModelInfo.put(KMManager.KMKey_LexicalModelVersion, "1.0"); + KMManager.addLexicalModel(this, lexicalModelInfo); + + KMManager.registerLexicalModel(lexicalModelInfo); +``` + +## See also +* [addLexicalModel()](addLexicalModel) +* [deregisterLexicalModel()](deregisterLexicalModel) diff --git a/developer/engine/android/16.0/KMManager/removeKeyboard.php b/developer/engine/android/16.0/KMManager/removeKeyboard.php new file mode 100644 index 000000000..d1e51eb72 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/removeKeyboard.php @@ -0,0 +1,44 @@ +%s.%s(Context %s, int %s)', $class, $method, $param1, $param2); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.removeKeyboard()

+ +

Summary

+

The method removes the keyboard at specified position from the keyboards list.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+
0-based position of the keyboard in the keyboards list.
+
+ +

Returns

+

Returns true if the keyboard was removed successfully, false otherwise.

+ +

Description

+

Use this method to remove a keyboard from the keyboards list. If the position is invalid, it will be ignored and the method will return false without altering the keyboards list.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    // Remove the second keyboard in the list
+    KMManager.removeKeyboard(this, 1);
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/removeKeyboardDownloadEventListener.php b/developer/engine/android/16.0/KMManager/removeKeyboardDownloadEventListener.php new file mode 100644 index 000000000..69ecaf71e --- /dev/null +++ b/developer/engine/android/16.0/KMManager/removeKeyboardDownloadEventListener.php @@ -0,0 +1,43 @@ +%s.%s(OnKeyboardDownloadEventListener %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.removeKeyboardDownloadEventListener()

+ +

Summary

+

The method removes the specified listener from the list of keyboard download event listeners.

+ +

Syntax

+
+ +

Parameters

+
+
+
The listener to be removed.
+
+ +

Description

+

Use this method to remove the listener to stop receiving keyboard download event notifications. The listener must be removed once you finished with it.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
	@Override
+    protected void onPause() {
+        super.onPause();
+        // ...
+        KMManager.removeKeyboardDownloadEventListener(this);
+        // ...
+    }
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/removeKeyboardEventListener.php b/developer/engine/android/16.0/KMManager/removeKeyboardEventListener.php new file mode 100644 index 000000000..22bca76b4 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/removeKeyboardEventListener.php @@ -0,0 +1,43 @@ +%s.%s(OnKeyboardEventListener %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.removeKeyboardEventListener()

+ +

Summary

+

The method removes the specified listener from the list of keyboard event listeners.

+ +

Syntax

+
+ +

Parameters

+
+
+
The listener to be removed.
+
+ +

Description

+

Use this method to remove the listener to stop receiving keyboard event notifications. The listener must be removed once you finished with it.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
	@Override
+    protected void onPause() {
+        super.onPause();
+        // ...
+        KMManager.removeKeyboardEventListener(this);
+        // ...
+    }
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/sample_template.php b/developer/engine/android/16.0/KMManager/sample_template.php new file mode 100644 index 000000000..9166db2ca --- /dev/null +++ b/developer/engine/android/16.0/KMManager/sample_template.php @@ -0,0 +1,45 @@ +%s.%s(Param %s, Param %s)', $class, $method, $param1, $param2); + head(['title' => $class.'.'.$method.'()']); +?> + + + +

Summary

+

The method does . . .

+ +

Syntax

+
+ +

Parameters

+
+
+
Param details.
+
+
Param details.
+
+ +

Returns

+

Details of return value if any

+ +

Description

+

Description.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
//Code here
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/setCanAddNewKeyboard.php b/developer/engine/android/16.0/KMManager/setCanAddNewKeyboard.php new file mode 100644 index 000000000..a3c4b9594 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/setCanAddNewKeyboard.php @@ -0,0 +1,38 @@ +%s.%s(boolean %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.setCanAddNewKeyboard()

+ +

Summary

+

The method sets whether adding a new keyboard is allowed.

+ +

Syntax

+
+ +

Parameters

+
+
+
If false, adding a new keyboard is disabled.
+
+ +

Description

+

Use this method to enable or disable '+' (add new keyboard) button in the keyboard picker menu.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    // Disable add new keyboard button.
+    KMManager.setCanAddNewKeyboard(false);
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/setDebugMode.php b/developer/engine/android/16.0/KMManager/setDebugMode.php new file mode 100644 index 000000000..4e23fba8b --- /dev/null +++ b/developer/engine/android/16.0/KMManager/setDebugMode.php @@ -0,0 +1,39 @@ +%s.%s(boolean %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.setDebugMode()

+ +

Summary

+

The enables or disables debugging of Keyman Engine.

+ +

Syntax

+
+ +

Parameters

+
+
+
Set true to enable debugging, false to disable.
+
+ +

Description

+

Use this method to enable or disable log output generated by Keyman Engine. By default debugging is disabled.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    KMManager.setDebugMode(true);
+    // Debugging is now on
+    // Initialize KMManager here
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/setDefaultKeyboard.md b/developer/engine/android/16.0/KMManager/setDefaultKeyboard.md new file mode 100644 index 000000000..ac6684dca --- /dev/null +++ b/developer/engine/android/16.0/KMManager/setDefaultKeyboard.md @@ -0,0 +1,55 @@ +--- +title: KMManager.setDefaultKeyboard() +--- + +## Summary +The **setDefaultKeyboard()** method sets the keyboard information for the fallback keyboard. + +## Syntax +```java +KMManager.setDefaultKeyboard(Keyboard keyboardInfo) +``` + +### Parameters +keyboardInfo + +The keyboard information for the default keyboard. + +## Description +The **setDefaultKeyboard()** method sets the keyboard information for the fallback keyboard. If Keyman Engine +has issues with a current keyboard, KMManager will switch to this fallback keyboard. + +A fallback keyboard should also be defined if an app doesn't automatically add a keyboard (requires user selection). + +**setDefaultKeyboard** should be called after KMManager.initialize(). + +## Examples + +### Example: Using setDefaultKeyboard() +The following script illustrates the use of `setDefaultKeyboard()`: +```java + KMManager.initialize(getApplicationContext(), KMManager.KeyboardType.KEYBOARD_TYPE_INAPP); + + // Set the default (fallback) keyboard if this app doesn't automatically call addKeyboard(). + KMManager.setDefaultKeyboard( + new Keyboard( + "basic_kbdtam99", // Package ID - filename of the .kmp file + "basic_kbdtam99", // Keyboard ID + "Tamil 99 Basic", // Keyboard Name + "ta", // Language ID + "Tamil", // Language Name + "1.0", // Keyboard Version + null, // URL to help documentation if available + "", // URL to latest .kmp file + true, // Boolean to show this is a new keyboard in the keyboard picker + + KMManager.KMDefault_KeyboardFont, // Font for the keyboard + KMManager.KMDefault_KeyboardFont) // Font for OSK + ); +``` + +## History +Added syntax in Keyman Engine for Android 14.0. + +## See also +* [getDefaultKeyboard](getDefaultKeyboard) diff --git a/developer/engine/android/16.0/KMManager/setDefaultKeyboard.php b/developer/engine/android/16.0/KMManager/setDefaultKeyboard.php new file mode 100644 index 000000000..8954aeb28 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/setDefaultKeyboard.php @@ -0,0 +1,56 @@ +%s.%s(Keyboard %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.setDefaultKeyboard()

+ +

Summary

+

The method sets the default fallback keyboard which will + be used if the app never adds a keyboard.

+ +

Syntax

+
+ +

Parameters

+
+
+
The keyboard information. If null, the default fallback keyboard reverts to keyboard info from the + sil_euro_latin keyboard package.
+
+ +

Description

+

Use this method to set the default fallback keyboard. This is for apps that could start with an empty keyboards list + when the user attempts to use the KEYBOARD_TYPE_INAPP or KEYBOARD_TYPE_SYSTEM keyboard.

+ +

If null keyboard is passed, the default fallback keyboard reverts to keyboard info from the + sil_euro_latin keyboard package.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
KMManager.setDefaultKeyboard(
+    new Keyboard(
+        "fv_all",           // default package ID
+        "sil_euro_latin",   // default keyboard ID
+        "EuroLatin (SIL)",  // default keyboard name
+        "en",               // default language ID
+        "English",          // default language name
+        "1.9.1",            // keyboard version
+        null,               // optional path to welcome.htm
+        "",                 // optional URL to kmp file
+        false,              // new keyboard
+        KMManager.KMDefault_KeyboardFont,
+        KMManager.KMDefault_KeyboardFont)
+);
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/setGlobeKeyAction.md b/developer/engine/android/16.0/KMManager/setGlobeKeyAction.md new file mode 100644 index 000000000..4b56dbb4d --- /dev/null +++ b/developer/engine/android/16.0/KMManager/setGlobeKeyAction.md @@ -0,0 +1,58 @@ +--- +title: KMManager.setGlobeKeyAction() +--- + +## Summary +The **setGlobeKeyAction()** method sets the short-press action type for the 'Globe' key. + +## Syntax +```java +KMManager.setGlobeKeyAction(KeyboardType kbType, int action) +``` + +### Parameters +type + +: `KeyboardType.KEYBOARD_TYPE_INAPP` or `KeyboardType.KEYBOARD_TYPE_SYSTEM` + +action + +: The action type. `GLOBE_KEY_ACTION_SHOW_MENU`, `GLOBE_KEY_ACTION_SWITCH_TO_NEXT_KEYBOARD`, + `GLOBE_KEY_ACTION_ADVANCE_TO_PREVIOUS_SYSTEM_KEYBOARD`, `GLOBE_KEY_ACTION_ADVANCE_TO_NEXT_SYSTEM_KEYBOARD`, + `GLOBE_KEY_ACTION_SHOW_SYSTEM_KEYBOARDS`, `GLOBE_KEY_ACTION_DO_NOTHING`. + +## Description +Use this method to set the short-press action type for the 'Globe' key. Even when the default action type is +set, Keyman Engine will still use the following default action types when only one Keyman keyboard is installed: + +| KeyboardType | # Keyman Keyboards Installed | Globe Key Action Type | +|----------------------|:----------------------------:|------------------------------------------------------| +| KEYBOARD_TYPE_INAPP | 1 | GLOBE_KEY_ACTION_SHOW_MENU | +| KEYBOARD_TYPE_SYSTEM | 1 | GLOBE_KEY_ACTION_ADVANCE_TO_PREVIOUS_SYSTEM_KEYBOARD | + +The action `GLOBE_KEY_ACTION_SHOW_MENU` displays the Keyman keyboard picker menu. +Other enabled system keyboards are also listed at the end of the menu

+ +The action `GLOBE_KEY_ACTION_SWITCH_TO_NEXT_KEYBOARD` switches to the next Keyman keyboard (if more than 1 are installed). +Otherwise, the Keyman keyboard picker menu is displayed. + +The action `GLOBE_KEY_ACTION_ADVANCE_TO_PREVIOUS_SYSTEM_KEYBOARD` switches to the previous system keyboard. + +The action `GLOBE_KEY_ACTION_ADVANCE_TO_NEXT_SYSTEM_KEYBOARD` switches to the next system keyboard. + +The action `GLOBE_KEY_ACTION_SHOW_SYSTEM_KEYBOARDS` brings up the Android input method picker and +can only be set for `KEYBOARD_TYPE_SYSTEM`. + +## Examples + +### Example: Using setGlobeKeyAction +The following script illustrate the use of `setGlobeKeyAction` + +```java +// Tapping 'Globe' key will switch to the next keyboard +KMManager.setGlobeKeyAction(KeyboardType.KEYBOARD_TYPE_SYSTEM, + GlobeKeyAction.GLOBE_KEY_ACTION_SWITCH_TO_NEXT_KEYBOARD); +``` + +## See also +* [getGlobeKeyAction](getGlobeKeyAction) diff --git a/developer/engine/android/16.0/KMManager/setHapticFeedback.md b/developer/engine/android/16.0/KMManager/setHapticFeedback.md new file mode 100644 index 000000000..2e3c4422f --- /dev/null +++ b/developer/engine/android/16.0/KMManager/setHapticFeedback.md @@ -0,0 +1,35 @@ +--- +title: KMManager.setHapticFeedback() +--- + +## Summary +The **setHapticFeedback()** method sets whether the device vibrates as the user types. + +## Syntax +```java +KMManager.setHapticFeedback(boolean value) +``` + +### Parameters +value + +Set `true` to enable device vibrating as the user types, `false` to disable. + +## Description +Use this method to enable or disable haptic feedback. This determines if the device vibrates as the user types. +By default, haptic feedback is disabled. + +## Examples + +### Example: Using setHapticFeedback() +The following script illustrates the use of `setHapticFeedback()`: +```java + // Enable haptic feeedback + KMManager.setHapticFeedback(true); +``` + +## History +Keyman Engine for Android 15.0: New function. + +## See also +* [getHapticFeedback](getHapticFeedback) diff --git a/developer/engine/android/16.0/KMManager/setHelpBubbleEnabled.php b/developer/engine/android/16.0/KMManager/setHelpBubbleEnabled.php new file mode 100644 index 000000000..81221fa44 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/setHelpBubbleEnabled.php @@ -0,0 +1,41 @@ +%s.%s(boolean %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.setHelpBubbleEnabled() (Deprecated)

+ +

Summary

+

The enables or disables the help bubble.

+ +

Syntax

+
+ +

Parameters

+
+
+
Set true to enable the help bubble, false to disable.
+
+ +

Description

+

Use this method to enable or disable the help bubble which displays "Tap here to change keyboard" over the 'Globe' key if the user has never used it yet. By default it is enabled. This method only works for the in-app keyboard since the system-wide keyboard never displays a help bubble.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    KMManager.setHelpBubbleEnabled(false);
+    // Help bubble is now disabled
+
+ +

History

+

Deprecated syntax in Keyman Engine for Android 16.0

+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/setKeyboard.md b/developer/engine/android/16.0/KMManager/setKeyboard.md new file mode 100644 index 000000000..4a152f248 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/setKeyboard.md @@ -0,0 +1,155 @@ +--- +title: KMManager.setKeyboard() +--- + +## Summary + +The `setKeyboard()` method sets the active keyboard. + +## Syntax + +```java +KMManager.setKeyboard(Context context, Keyboard keyboardInfo) +``` + +### Parameters + +`context` +: The context. + +`keyboardInfo` +: `Keyboard` type of the keyboard information. + +### Returns + +Returns `true` if the keyboard was set successfully, `false` otherwise. + +## Description + +Selects the keyboard identified by the keyboard information, which is +normally returned by [`getKeyboardInfo()`](getKeyboardInfo). + +--- + +## Syntax + +```java +KMManager.setKeyboard(String packageID, String keyboardID, String languageID) +KMManager.setKeyboard(String packageID, String keyboardID, String languageID, String keyboardName, String languageName, String kFont, String kOskFont) +KMManager.setKeyboard(String packageID, String keyboardID, String languageID, String keyboardName, String languageName, String kFont, String kOskFont, String displayName) +``` + +### Parameters + +`packageID` +: ID of the keyboard package. + +`keyboardID` +: ID of the keyboard. + +`languageID` +: ID of the associated language. + +`keyboardName` +: Name of the keyboard. + +`languageName` +: Name of the associated language. + +`kFont` +: Filename or description of the font to type with the keyboard. Can be `null` + or empty string. + +`kOskFont` +: Filename or description of the font displayed on the keyboard. Can be `null` + or empty string. + +`displayName` +: A text string to display on the spacebar identifying this keyboard; if `null`, + uses engine default from [`setSpacebarText()`](setSpacebarText); if `""`, + shows no text on the spacebar. + +### Returns + +Returns `true` if the keyboard was set successfully, `false` otherwise. + +## Description + +Sets the currently active keyboard, along with font and display details. + +--- + +## Syntax + +``` +KMManager.setKeyboard(Context context, int position) +``` + +### Parameters + +`context` +: The context. + +`position` +: 0-based position of the keyboard in the keyboards list. + +### Returns + +Returns `true` if the keyboard was set successfully, `false` otherwise. + +## Description + +Sets the currently active keyboard by position in the keyboards list, as +returned by [`getKeyboardsList()`](getKeyboardsList) + +--- + +## Examples + +### Example 1: Using `setKeyboard()` + +The following script illustrates the use of `setKeyboard()` with keyboard information: + +```java +// Setting a Keyman keyboard +Keyboard keyboardInfo = KMManager.getDefaultKeyboard(); +KMManager.setKeyboard(getApplicationContext(), keyboardInfo); +``` + +### Example 2: Using `setKeyboard()` + +The following script illustrates the use of `setKeyboard()` with package ID, +keyboard ID, and language ID: + +```java +// Setting a Keyman keyboard +KMManager.setKeyboard("sil_euro_latin", "sil_euro_latin", "en"); +``` + +### Example 3: Using `setKeyboard()` + +The following script illustrates the use of `setKeyboard()`, providing +additional font detail: + +```java +// Setting a custom keyboard from the tamil99m keyboard package +KMManager.setKeyboard("tamil99m", "tamil99m", "ta", "Tamil 99M", "Tamil", "aava1.ttf", "aava1.ttf"); +``` + +### Example 4: Using `setKeyboard()` + +The following script illustrates the use of `setKeyboard()` with keyboard index: + +```java +// Setting a custom keyboard which exists in keyboards list +int kbIndex = KMManager.getKeyboardIndex(this, "tamil99m", "ta"); +KMManager.setKeyboard(this, kbIndex); +``` + +## See also + +* [`addKeyboard()`](addKeyboard) +* [`getDefaultKeyboard()`](getDefaultKeyboard) +* [`getKeyboardInfo()`](getKeyboardInfo) +* [`getKeyboardsList()`](getKeyboardsList) +* [`switchToNextKeyboard()`](switchToNextKeyboard) diff --git a/developer/engine/android/16.0/KMManager/setKeyboardPickerFont.php b/developer/engine/android/16.0/KMManager/setKeyboardPickerFont.php new file mode 100644 index 000000000..31a1f831e --- /dev/null +++ b/developer/engine/android/16.0/KMManager/setKeyboardPickerFont.php @@ -0,0 +1,32 @@ +%s.%s(Typeface %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.setKeyboardPickerFont()

+ +

Summary

+

The sets the font for the keyboard picker menu.

+ +

Syntax

+
+ +

Parameters

+
+
+
The font
+
+ +

Description

+

Use this method to set a font for the keyboard picker menu.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    KMManager.setKeyboardPickerFont(Typeface.createFromAsset(getAssets(), "fonts/custom_font.ttf"));
+
diff --git a/developer/engine/android/16.0/KMManager/setKeymanLicense.php b/developer/engine/android/16.0/KMManager/setKeymanLicense.php new file mode 100644 index 000000000..41c059677 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/setKeymanLicense.php @@ -0,0 +1,44 @@ +%s.%s(String %s, String %s)', $class, $method, $param1, $param2); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.setKeymanLicense() (Deprecated)

+ +

Summary

+

(Deprecated) The method sets the developer license/key pair to unlock Keyman Engine.

+ +

Syntax

+
+ +

Parameters

+
+
+
Your developer license for Keyman Engine for Android.
+
+
Your developer key for Keyman Engine for Android.
+
+ +

Description

+

You must use this method to set the developer license/key pair before initializing the KMManager. You will receive the license/key pair when you purchase Keyman Engine for Android.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    KMManager.setLicense(“YourLicense”,”YourKey”);
+    // Initialize KMManager here after setting the license
+
+ +

History

+

Deprecated in Keyman Engine for Android 12.0

+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/setMaySendCrashReport.md b/developer/engine/android/16.0/KMManager/setMaySendCrashReport.md new file mode 100644 index 000000000..0c5cf650e --- /dev/null +++ b/developer/engine/android/16.0/KMManager/setMaySendCrashReport.md @@ -0,0 +1,40 @@ +--- +title: KMManager.setMaySendCrashReport() +--- + +## Summary +The **setMaySendCrashReport()** enables or disables whether Keyman Engine can send crash reports over the +network to sentry.keyman.com. + +## Syntax +```java +KMManager.setMaySendCrashReport(boolean value) +``` + +### Parameters +value + +Set `true` to enable crash reports to be sent, `false` to disable. + +## Description +Use this method to enable or disable whether Keyman Engine can send crash reports over the network. +By default sending crash reports is enabled. + +If you don't want crash reports to be sent, your app must disable this before `KMManager.initialize()`. + +## Examples + +### Example: Using setMaySendCrashReport() +The following script illustrates the use of `setMaySendCrashReport()`: +```java + // Disable crash reports from being sent + KMManager.setMaySendCrashReport(false); + // Initialize KMManager + KMManager.initialize(getApplicationContext(), KeyboardType.KEYBOARD_TYPE_INAPP); +``` + +## History +Added syntax in Keyman Engine for Android 14.0. + +## See also +* [getMaySendCrashReport](getMaySendCrashReport) diff --git a/developer/engine/android/16.0/KMManager/setShouldAllowSetKeyboard.php b/developer/engine/android/16.0/KMManager/setShouldAllowSetKeyboard.php new file mode 100644 index 000000000..476517b95 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/setShouldAllowSetKeyboard.php @@ -0,0 +1,38 @@ +%s.%s(boolean %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.setShouldAllowSetKeyboard()

+ +

Summary

+

The method sets whether Keyman Engine allows setting a keyboard other than the default keyboard.

+ +

Syntax

+
+ +

Parameters

+
+
+
If false, Keyman Engine will not allow setting a keyboard.
+
+ +

Description

+

Use this method to enable or disable setting a keyboard other than the default keyboard. If set to false Keyman Engine will immediately load the default keyboard, and ignore calls to setKeyboard method. It is particularly useful if used with Google Play Licensing service in order to put the Keyman on-screen keyboard in a locked state if the paid app is unlicensed.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    // Put Keyman on-screen keyboard in locked state if the app is unlicensed.
+    KMManager.setShouldAllowSetKeyboard(false);
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/setShouldCheckKeyboardUpdates.php b/developer/engine/android/16.0/KMManager/setShouldCheckKeyboardUpdates.php new file mode 100644 index 000000000..a6c9a3187 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/setShouldCheckKeyboardUpdates.php @@ -0,0 +1,38 @@ +%s.%s(boolean %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.setShouldCheckKeyboardUpdates()

+ +

Summary

+

The method sets whether Keyman Engine should check for keyboard updates.

+ +

Syntax

+
+ +

Parameters

+
+
+
If false, Keyman Engine will not check for keyboard updates.
+
+ +

Description

+

Use this method to enable or disable keyboard updates when the keyboard picker menu is displayed.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    // Disable keyboard updates.
+    KMManager.setShouldCheckKeyboardUpdates(false);
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/setSpacebarText.md b/developer/engine/android/16.0/KMManager/setSpacebarText.md new file mode 100644 index 000000000..63788e77d --- /dev/null +++ b/developer/engine/android/16.0/KMManager/setSpacebarText.md @@ -0,0 +1,50 @@ +--- +title: KMManager.setSpacebarText() +--- + +## Summary + +The `setSpacebarText()` method sets the text display pattern for the +spacebar. + +## Syntax + +```java +KMManager.setSpacebarText(KMManager.SpacebarText mode) +``` + +### Parameters + +`mode` +: The display pattern to use for the spacebar, one of: + + * `LANGUAGE` - the language name for the keyboard + * `KEYBOARD` - the keyboard name + * `LANGUAGE_KEYBOARD` - both the language name and the keyboard name, + separated by hyphen + * `BLANK` - no text to be displayed + +### Returns + +No return value. + +## Description + +The default text display pattern is `LANGUAGE_KEYBOARD`. The text shown on the +keyboard may be overridden on a per-keyboard basis with the `displayName` +parameter of the `setKeyboard()` function. + +--- + +## Example: Using `setSpacebarText()` + +The following script illustrates the use of `setSpacebarText()`: + +```java +// don't show anything on the spacebar +KMManager.setSpacebarText(KMManager.SpacebarText.BLANK); +``` + +## See also + +* [`getSpacebarText()`](getSpacebarText) diff --git a/developer/engine/android/16.0/KMManager/shouldAllowSetKeyboard.php b/developer/engine/android/16.0/KMManager/shouldAllowSetKeyboard.php new file mode 100644 index 000000000..50e4a5a6c --- /dev/null +++ b/developer/engine/android/16.0/KMManager/shouldAllowSetKeyboard.php @@ -0,0 +1,38 @@ +%s.%s()', $class, $method); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.shouldAllowSetKeyboard()

+ +

Summary

+

The method returns whether Keyman Engine allows setting a keyboard other than the default keyboard.

+ +

Syntax

+
+ +

Returns

+

Returns true if Keyman Engine allows setting a keyboard, false otherwise.

+ +

Description

+

Use this method to check if Keyman Engine allows setting a keyboard other than the default keyboard.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    if (KMManager.shouldAllowSetKeyboard()) {
+        // setting a keyboard is allowed
+    }
+    else {
+        // setting a keyboard is not allowed
+    }
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/shouldCheckKeyboardUpdates.php b/developer/engine/android/16.0/KMManager/shouldCheckKeyboardUpdates.php new file mode 100644 index 000000000..f42520cca --- /dev/null +++ b/developer/engine/android/16.0/KMManager/shouldCheckKeyboardUpdates.php @@ -0,0 +1,35 @@ +%s.%s()', $class, $method); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.shouldCheckKeyboardUpdates()

+ +

Summary

+

The method returns whether Keyman Engine should check for keyboard updates.

+ +

Syntax

+
+ +

Returns

+

Returns true if Keyman Engine should check for keyboard updates, false otherwise.

+ +

Description

+

Use this method to check if Keyman Engine should check for keyboard updates when the keyboard picker menu is displayed.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    if (KMManager.shouldCheckKeyboardUpdates()) {
+        // checking keyboard updates is enabled
+    }
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/showKeyboardPicker.php b/developer/engine/android/16.0/KMManager/showKeyboardPicker.php new file mode 100644 index 000000000..fd5c3d4af --- /dev/null +++ b/developer/engine/android/16.0/KMManager/showKeyboardPicker.php @@ -0,0 +1,47 @@ +%s.%s(Context %s, KeyboardType %s)', $class, $method, $param1, $param2); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.showKeyboardPicker()

+ +

Summary

+

The method displays the keyboard picker menu.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+
The keyboard type. KEYBOARD_TYPE_INAPP or KEYBOARD_TYPE_SYSTEM.
+
+ +

Description

+

Use this method to display keyboard picker menu. Normally you do not need to call this method explicitly since, by default, Keyman on-screen keyboard calls this method to display the keyboard picker menu whenever 'globe' key is tapped. Multiple calls to this method is unsafe and may result in multiple instances of keyboard picker menu being displayed at the same time.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    final Context context = this;
+    ImageButton globeButton = (ImageButton) findViewById(R.id.globeButton);
+    globeButton.setOnClickListener(new OnClickListener() {
+        @Override
+        public void onClick(View v) {
+            KMManager.showKeyboardPicker(context, KMManager.KeyboardType.KEYBOARD_TYPE_INAPP);
+        }
+    });
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/showLanguageList.php b/developer/engine/android/16.0/KMManager/showLanguageList.php new file mode 100644 index 000000000..ee07ed653 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/showLanguageList.php @@ -0,0 +1,48 @@ +%s.%s(Context %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.showLanguageList() (Deprecated)

+ +

Summary

+

(Deprecated) The method displays the language list.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+ +

Description

+

The Keyman keyboard picker menu used to call this method to display the language list whenever the '+' button was tapped. + As of 14.0, keyboards are no longer added this way, and this call is removed.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    final Context context = this;
+    ImageButton languageButton = (ImageButton) findViewById(R.id.languageButton);
+    languageButton.setOnClickListener(new OnClickListener() {
+        @Override
+        public void onClick(View v) {
+            KMManager.showLanguageList(context);
+        }
+    });
+
+ +

History

+

Deprecated syntax in Keyman Engine for Android 14.0

+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/switchToNextKeyboard.php b/developer/engine/android/16.0/KMManager/switchToNextKeyboard.php new file mode 100644 index 000000000..56c04d3f1 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/switchToNextKeyboard.php @@ -0,0 +1,44 @@ +%s.%s(Context %s)', $class, $method, $param1); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.switchToNextKeyboard()

+ +

Summary

+

The method loads the next available keyboard in keyboards list.

+ +

Syntax

+
+ +

Parameters

+
+
+
The context.
+
+ +

Description

+

Use this method to switch to next keyboard in the keyboards list. If the next keyboard does not exists, then it loads the first keyboard in the keyboards list.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    final Context context = this;
+    ImageButton nextButton = (ImageButton) findViewById(R.id.nextButton);
+    nextButton.setOnClickListener(new OnClickListener() {
+        @Override
+        public void onClick(View v) {
+            KMManager.switchToNextKeyboard(context);
+        }
+    });
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/updateSelectionRange.php b/developer/engine/android/16.0/KMManager/updateSelectionRange.php new file mode 100644 index 000000000..6ea1fdf72 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/updateSelectionRange.php @@ -0,0 +1,50 @@ +%s.%s(KeyboardType %s, int %s, int %s)', $class, $method, $param1, $param2, $param3); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.updateSelectionRange()

+ +

Summary

+

The method updates the selection range of the current context.

+ +

Syntax

+
+ +

Parameters

+
+
+
Keyboard type requesting the selection range update. KEYBOARD_TYPE_INAPP or KEYBOARD_TYPE_SYSTEM.
+
+
The new selection start location.
+
+
The new selection end location.
+
+ +

Returns

+

Returns true if the selection range was updated successfully, false otherwise.

+ +

Description

+

Use this method to update the selection range of the current context. It must be called in response to InputMethodService's onUpdateSelection method and whenever InputMethodService's onStartInput method has been called. Normally you do not need to call this method for in-app keyboards.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    @Override
+    public void onUpdateSelection(int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd) {
+        super.onUpdateSelection(oldSelStart, oldSelEnd, newSelStart, newSelEnd, candidatesStart, candidatesEnd);
+        KMManager.updateSelectionRange(KMManager.KeyboardType.KEYBOARD_TYPE_SYSTEM, newSelStart, newSelEnd);
+    }
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KMManager/updateText.php b/developer/engine/android/16.0/KMManager/updateText.php new file mode 100644 index 000000000..4648ddc53 --- /dev/null +++ b/developer/engine/android/16.0/KMManager/updateText.php @@ -0,0 +1,56 @@ +%s.%s(KeyboardType %s, String %s)', $class, $method, $param1, $param2); + head(['title' => $class.'.'.$method.'()']); +?> + +

KMManager.updateText()

+ +

Summary

+

The method updates the current context with the specified text.

+ +

Syntax

+
+ +

Parameters

+
+
+
Keyboard type requesting the context update. KEYBOARD_TYPE_INAPP or KEYBOARD_TYPE_SYSTEM.
+
+
The text to replace the current context.
+
+ +

Returns

+

Returns true if the current context was updated successfully, false otherwise.

+ +

Description

+

Use this method to update the current context. It must be called in InputMethodService's onStartInput method to match the current context with the text in the editor. Normally you do not need to call this method for in-app keyboards.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    @Override
+    public void onStartInput(EditorInfo attribute, boolean restarting) {
+        super.onStartInput(attribute, restarting);
+        // ...
+        InputConnection ic = getCurrentInputConnection();
+        if (ic != null) {
+            ExtractedText icText = ic.getExtractedText(new ExtractedTextRequest(), 0);
+            if (icText != null) {
+                KMManager.updateText(KeyboardType.KEYBOARD_TYPE_SYSTEM, icText.text.toString());
+                // ...
+            }
+        }
+        // ...
+    }
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KeyboardEventHandler/index.php b/developer/engine/android/16.0/KeyboardEventHandler/index.php new file mode 100644 index 000000000..8d2ca5e61 --- /dev/null +++ b/developer/engine/android/16.0/KeyboardEventHandler/index.php @@ -0,0 +1,45 @@ + "$class class"]); + + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array for sample +?> +

KeyboardEventHandler class

+ +

Description

+ +

The KeyboardEventHandler class provides keyboard events and methods to notify registered listeners on keyboard and lexical-model events.

+ +

Events

+ +

OnKeyboardEventListener Interface

+
+
onKeyboardLoaded()
+
is called when the keyboard has been loaded for the first time
+ +
onKeyboardChanged()
+
is called when another keyboard has been set
+ +
onKeyboardShown()
+
is called when the keyboard has been shown
+ +
onKeyboardDismissed()
+
is called when the keyboard has been dismissed
+
+ +

OnKeyboardDownloadEventListener Interface

+
+
onKeyboardDownloadStarted()
+
is called when a keyboard download has started
+ +
onKeyboardDownloadFinished()
+
is called when a keyboard download has finished
+ +
onPackageInstalled()
+
is called when a keyboard package has been installed
+ +
onLexicalModelInstalled()
+
is called when a lexical-model package has been installed
+ +
\ No newline at end of file diff --git a/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardChanged.php b/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardChanged.php new file mode 100644 index 000000000..fc23e7384 --- /dev/null +++ b/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardChanged.php @@ -0,0 +1,42 @@ +String %s)', $event, $param1); + head(['title' => $event.'()']); +?> + +

onKeyboardChanged()

+ +

Summary

+

The event is called when another keyboard has been set.

+ +

Syntax

+
+ +

Parameters

+
+
+
New keyboard identifier as languageID_keyboardID (e.g. eng_us).
+
+ +

Description

+

Implement this method to handle keyboard changed event.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    @Override
+    public void onKeyboardChanged(String newKeyboard) {
+        // handle keyboard changed event here
+    }
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardDismissed.php b/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardDismissed.php new file mode 100644 index 000000000..050672d3f --- /dev/null +++ b/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardDismissed.php @@ -0,0 +1,35 @@ + $event.'()']); +?> + +

onKeyboardDismissed()

+ +

Summary

+

The event is called when the keyboard has been dismissed.

+ +

Syntax

+
+ +

Description

+

Implement this method to handle keyboard dismissed event.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    @Override
+    public void onKeyboardDismissed() {
+        // handle keyboard dismissed event here
+    }
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardDownloadFinished.php b/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardDownloadFinished.php new file mode 100644 index 000000000..b0f2a4373 --- /dev/null +++ b/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardDownloadFinished.php @@ -0,0 +1,44 @@ +HashMap<String key, String value> %s, int %s)', $event, $param1, $param2); + head(['title' => $event.'()']); +?> + +

onKeyboardDownloadFinished()

+ +

Summary

+

The event is called when a keyboard download has finished.

+ +

Syntax

+
+ +

Parameters

+
+
+
The information dictionary of the keyboard with keys and values defined as HashMap<String key, String value>.
+ +
+
The result of the download (result > 0 if successful, < 0 if failed).
+
+ +

Description

+

Implement this method to handle keyboard download finished event.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    @Override
+    public void onKeyboardDownloadFinished(HashMap<String key, String value> keyboardInfo, int result) {
+        // handle keyboard download finished event here
+    }
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardDownloadStarted.php b/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardDownloadStarted.php new file mode 100644 index 000000000..28661eb90 --- /dev/null +++ b/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardDownloadStarted.php @@ -0,0 +1,40 @@ +HashMap<String key, String value> %s)', $event, $param1); + head(['title' => $event.'()']); +?> + +

onKeyboardDownloadStarted()

+ +

Summary

+

The event is called when a keyboard download has started.

+ +

Syntax

+
+ +

Parameters

+
+
+
The information dictionary of the keyboard with keys and values defined as HashMap<String key, String value>.
+
+ +

Description

+

Implement this method to handle keyboard download started event.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    @Override
+    public void onKeyboardDownloadStarted(HashMap<String key, String value> keyboardInfo) {
+        // handle keyboard download started event here
+    }
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardLoaded.php b/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardLoaded.php new file mode 100644 index 000000000..68b78e4d1 --- /dev/null +++ b/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardLoaded.php @@ -0,0 +1,42 @@ +KeyboardType %s)', $event, $param1); + head(['title' => $event.'()']); +?> + +

onKeyboardLoaded()

+ +

Summary

+

The event is called when the keyboard has been loaded for the first time.

+ +

Syntax

+
+ +

Parameters

+
+
+
The keyboard type that has been loaded. KEYBOARD_TYPE_INAPP or KEYBOARD_TYPE_SYSTEM.
+
+ +

Description

+

Implement this method to handle keyboard loaded event.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    @Override
+    public void onKeyboardLoaded(KeyboardType keyboardType) {
+        // handle keyboard loaded event here
+    }
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardShown.php b/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardShown.php new file mode 100644 index 000000000..387bdd0e4 --- /dev/null +++ b/developer/engine/android/16.0/KeyboardEventHandler/onKeyboardShown.php @@ -0,0 +1,35 @@ + $event.'()']); +?> + +

onKeyboardShown()

+ +

Summary

+

The event is called when the keyboard has been shown.

+ +

Syntax

+
+ +

Description

+

Implement this method to handle keyboard shown event.

+ +

Examples

+ +

Example: Using

+

The following script illustrate the use of :

+
    @Override
+    public void onKeyboardShown() {
+        // handle keyboard shown event here
+    }
+
+ +

See also

+ diff --git a/developer/engine/android/16.0/KeyboardEventHandler/onLexicalModelInstalled.md b/developer/engine/android/16.0/KeyboardEventHandler/onLexicalModelInstalled.md new file mode 100644 index 000000000..7a3ee5825 --- /dev/null +++ b/developer/engine/android/16.0/KeyboardEventHandler/onLexicalModelInstalled.md @@ -0,0 +1,34 @@ +--- +title: onLexicalModelInstalled() +--- + +## Summary +The `onLexicalModelInstalled()` event is called when a lexical-model package has been installed. + +## Syntax +```java +onLexicalModelInstalled(List> lexicalModelsInstalled) +``` + +### Parameters +`lexicalModelsInstalled` + +The information dictionaries of the lexical-models installed from a lexical-model package with keys and values defined as `List>`. + + +## Description +Implement this method to handle lexical-model package installed event. + +## Examples + +### Example: Using `onLexicalModelInstalled()` +The following script illustrate the use of `onLexicalModelInstalled()`: +```java + @Override + public void onLexicalModelInstalled(List> lexicalModelsInstalled) { + // handle lexical-model package installed event here + } +``` + +## See also +* [onPackageInstalled()](onPackageInstalled) diff --git a/developer/engine/android/16.0/KeyboardEventHandler/onPackageInstalled.md b/developer/engine/android/16.0/KeyboardEventHandler/onPackageInstalled.md new file mode 100644 index 000000000..3653dfc81 --- /dev/null +++ b/developer/engine/android/16.0/KeyboardEventHandler/onPackageInstalled.md @@ -0,0 +1,35 @@ +--- +title: onPackageInstalled() +--- + +## Summary +The `onPackageInstalled()` is called when a keyboard package has been installed. + +## Syntax +```java +onPackageInstalled(List> keyboardsInstalled) +``` + +### Parameters +`keyboardsInstalled` + +The information dictionaries of the keyboards installed from a keyboard package with keys and values defined as `List>`. + +## Description +Implement this method to handle keyboard package installed event. + +## Examples ## + +### Example: Using `onPackageInstalled()` ### +The following script illustrate the use of `onPackageInstalled()`: + +```java + @Override + public void onPackageInstalled(List> keyboardsInstalled) { + // handle keyboard package installed event here + } +``` + +## See also +* [onLexicalModelInstalled()](onLexicalModelInstalled) + diff --git a/developer/engine/android/16.0/guides/in-app/index.md b/developer/engine/android/16.0/guides/in-app/index.md new file mode 100644 index 000000000..676015a2e --- /dev/null +++ b/developer/engine/android/16.0/guides/in-app/index.md @@ -0,0 +1,136 @@ +--- +title: Guide: build an in-app keyboard +--- + +Keyman Engine for Android allows you to use any Keyman touch keyboard in your Android app, or even to create your own +system keyboard app for purchase in the Play Store.
+This guide will walk you through the steps for creating your first Android app with Keyman Engine for Android. + +If you are not familiar with Android development, you will find the +[Android Developer online training](https://developer.android.com/training/index.html) an invaluable +resource, and working through some of their tutorials first will help you with the rest of this guide. + +### 1. Install Free Tools +* Install [Keyman Developer 15 or later](https://keyman.com/developer/). +* Install + Java SE Development Kit. +* Install Android Studio. + Android Studio runs on several platforms. Keyman Developer 10 runs on Windows 7 or later. + +### 2. Configure Android Studio +* For Windows users, from Control Panel>System>System Properties>Environment Variables,
+ create a system variable ANDROID_HOME to the location of your Android SDK. The default + installation location is
+ c:\Users\[USER]\AppData\Local\Android\sdk where [USER] is your Windows username. +* For Linux users, add the following to ~/.bashrc +```bash +export ANDROID_HOME=$HOME/Android/Sdk +export PATH=$PATH:$ANDROID_HOME/tools +``` +* In a command prompt or terminal, accept all the SDK license agreements +```bash +cd c:\Users\[USER]\AppData\Local\Android\sdk\tools\bin +yes | ./sdkmanager.bat --licenses +``` + +### 3. Download Keyman Engine for Android and Build Sample projects +* Download the Keyman for Android SDK + and extract the files to a new folder. + +The archive includes two sample projects and an Android .aar library file. This guide will use the first + example project, KMSample1. + +* If KMSample1.zip exists, extract it to a new folder. Otherwise, the KMSample1 project + can be found at Samples/KMSample1 +* In Android Studio, select File>Open and choose the KMSample1 project folder from + the previous step. + +* When the project loads, you may be prompted to install Android SDKs; go ahead and follow the prompts to + fixup any missing SDK dependencies. + +### 4. Create a keyboard layout +Use Keyman Developer to build a touch layout. The following blog posts walk through some of the development and + testing for creating a touch keyboard layout: + +* [Creating a Touch Keyboard Layout for Amharic with Keyman Developer 13](/developer/13.0/guides/develop/creating-a-touch-keyboard-layout-for-amharic-with-keyman-developer-10") +* [Creating A Touch Keyboard Layout For Amharic — The Nitty Gritty](/developer/13.0/guides/develop/creating-a-touch-keyboard-layout-for-amharic-the-nitty-gritty) +* [How to test your keyboard layout with Keyman Developer 13 — touch and desktop](/developer/13.0/guides/test/how-to-test-your-keyboard-layout-with-keyman-developer-10-touch-and-desktop) +* [How to test your touch layout in the Google Chrome mobile emulator](/developer/13.0/guides/test/how-to-test-your-touch-layout-in-the-google-chrome-mobile-emulator) + +When your keyboard is ready, you should have a compiled keyboard package file. The example below shows the + Tamil 99 Basic touch layout. +[Keyman-developer](/cdn/dev/img/engine/android/14.0/guides/in-app/touch-layout.png) + +From the package editor, open the containing folder for the keyboard package to find the .kmp file to copy over; its name will be based on + your source keyboard name. If your keyboard project settings is configured to output to **$PROJECTPATH\build**, + you may need to navigate up a folder and into the build folder. + +[Keyman-developer-open-containing-folder](/cdn/dev/img/engine/android/14.0/guides/in-app/open-containing-folder.png) + +[Compiled-keyboard-file](/cdn/dev/img/engine/android/14.0/guides/in-app/compiled-keyboard-file.png) + +### 5. Add your keyboard package to the project +Copy your compiled keyboard package file (in this example **basic_kbdtam99.kmp**) to the + **KMSample1\app\src\main\assets\** folder. If you have an associated dictionary, then copy that to the + same **assets** folder. This example uses **example.ta.wordlist.model.kmp**. +[Copy-keyboard-file](/cdn/dev/img/engine/android/14.0/guides/in-app/copy-keyboard-file.png) + +When you switch back into Android Studio, you should see the assets folder + with your keyboard and dictionary files: + +[Android-studio-assets](/cdn/dev/img/engine/android/14.0/guides/in-app/android-studio-assets.png) + +Next, edit `MainActivity.onCreate()` to add the keyboard (tamil99m) with `KMManager`. + If your keyboard package is not using a custom font, you can set KMKey_Font to the default font: +```java + // Add a custom keyboard + Keyboard kbInfo = new Keyboard( + "basic_kbdtam99", // Package ID - filename of the .kmp file + "basic_kbdtam99", // Keyboard ID + "Tamil 99 Basic", // Keyboard Name + "ta", // Language ID + "Tamil", // Language Name + "1.0", // Keyboard Version + null, // URL to help documentation if available + "", // URL to latest .kmp file + true, // Boolean to show this is a new keyboard in the keyboard picker + + // Font information of the .ttf font to use in KMSample1 (for example "aava1.ttf"). + // basic_kbdtam99 doesn't include a font. Can set blank "" or KMManager.KMDefault_KeyboardFont + KMManager.KMDefault_KeyboardFont, // Font for KMSample1 text field + KMManager.KMDefault_KeyboardFont); // Font for OSK + KMManager.addKeyboard(this, kbInfo); +``` +If you included a dictionary in the sample app, add and register it with `KMManager`. +```java + // Add a dictionary + HashMaplexicalModelInfo = new HashMap(); + lexicalModelInfo.put(KMManager.KMKey_PackageID, "example.ta.wordlist"); + lexicalModelInfo.put(KMManager.KMKey_LanguageID, "ta"); + lexicalModelInfo.put(KMManager.KMKey_LexicalModelID, "example.ta.wordlist"); + lexicalModelInfo.put(KMManager.KMKey_LexicalModelVersion, "1.0"); + KMManager.addLexicalModel(context, lexicalModelInfo); + KMManager.registerAssociatedLexicalModel("ta"); +``` + +[Android-studio-adding-keyboard](/cdn/dev/img/engine/android/14.0/guides/in-app/android-studio-adding-keyboard.png) + +### 6. Build and run the app +You can run your app on a [created Virtual Device](https://developer.android.com/studio/run/managing-avds.html), + or connect an Android device via USB to your computer to test. In either case, click the green Run button to start + the app. The steps below show how to create a new Virtual Device + +[Android-studio-starting-debug](/cdn/dev/img/engine/android/14.0/guides/in-app/android-studio-starting-debug.png) + +Click the **[Create Virtual Device]** button to add a new virtual device, and follow the prompts. Any recent emulated + device should work fine. You will be prompted to download additional resources for the emulator when this runs. + +[Android-emulator-tamil](/cdn/dev/img/engine/android/14.0/guides/in-app/android-emulator-tamil.png) + +And there you have it: your first Keyman Engine for Android app! + +## See Also +* [Guide: Build a system keyboard app](../system-keyboard/) +* [Keyman Developer Documentation](/developer/16.0/) +* [Keyman Engine for Android Documentation](/developer/engine/android/16.0/) +* [Android Developer Home](https://developer.android.com/index.html) diff --git a/developer/engine/android/16.0/guides/index.php b/developer/engine/android/16.0/guides/index.php new file mode 100644 index 000000000..1e9513a38 --- /dev/null +++ b/developer/engine/android/16.0/guides/index.php @@ -0,0 +1,14 @@ + 'Keyman Engine for Android Developer Guides' + ]); +?> + +

Keyman Engine for Android Developer Guides

+ + diff --git a/developer/engine/android/16.0/guides/system-keyboard/index.php b/developer/engine/android/16.0/guides/system-keyboard/index.php new file mode 100644 index 000000000..17ed59c2c --- /dev/null +++ b/developer/engine/android/16.0/guides/system-keyboard/index.php @@ -0,0 +1,78 @@ + $pagetitle +]); +?> +

+ +

In part 1 of this series, we looked at the steps involved in creating a basic Android app + which included a Keyman in-app keyboard. In this post, we'll work with the second sample included in the Keyman + Engine for Android package, which is a very basic System Keyboard app. This post builds on concepts and setup from + the first post, so be sure you are familiar with that before you start on this one.

+ +

1. Basic configuration

+ +

If KMSample2.zip exists from the downloaded Keyman Engine for Android, extract it + to a new folder. Otherwise, the KMSample2 project + can be found at Samples/KMSample2

+ +

2. Run the sample app

+ +

The KMSample2 app includes the Tamil 99 Basic keyboard as an example keyboard. Without any further modifications, the + app should run and you'll be able to configure your device to use your app as the system keyboard.

+ +

">" + alt="Emulator" border="0"/>

+ +

3. Extending the app

+ +

From here, you will no doubt want to replace the keyboard with your own one; again, follow the instructions from Part + 1 to make this change.

+

You can also customise the look and feel of the on screen keyboard by including a custom CSS file in your keyboard + through Keyman Developer.

+

">" + alt="AddEmbeddedCSS" border="0"/>

+ +

The CSS rules required to style your keyboard are beyond the scope of this post, but the kmwosk.css + file included in the Keyman Developer 16.0 distribution and in the + + KeymanWeb 16.0 source is a good place to start. See this + + reference for more information + about the On-Screen Keyboard.

+ +

Do take the time to read through the source of KMSample2, as it includes some boilerplate code + required to link Keyman Engine through to the Android Input Method services and vice versa.

+ +

Finally, you will want to improve the style and branding of the main activity in KMSample2. The sample includes just + two buttons to link to the Android Input Method Settings and Input Method Menu, as a pointer to the two + configuration steps that your users will need to undertake in order to start using your keyboard.

+ +

">" + alt="MainActivityLayout" border="0"/>

+ +

You will probably want to make that a lot prettier, and include more detailed instructions!

+ +

That's all there is to creating a System Keyboard with Keyman Engine for Android. We've taken care of all the complex + details of keyboarding in the Keyman Engine, so you can focus on the look and feel and the layout of your + keyboard.

+ +

Further links

+ + diff --git a/developer/engine/android/16.0/index.php b/developer/engine/android/16.0/index.php new file mode 100644 index 000000000..634580dbe --- /dev/null +++ b/developer/engine/android/16.0/index.php @@ -0,0 +1,50 @@ + 'Keyman Engine for Android' + ]); +?> +

Keyman Engine for Android

+ +

Overview

+ +

Keyman Engine for Android 16.0 is a Java library for Android 5.0 and later versions which enables a fully customisable keyboard layout, both within an app and system-wide. +Keyboard layouts for Keyman Engine can be created with Keyman Developer, and a library of existing keyboard layouts +is also available.

+ +

For keyboard developers updating from an older versions of Keyman Engine for Android, +see What's New for breaking changes + +

Guides

+ + + +

Classes

+ +
+
KMManager
+
The core class for controlling Keyman Engine
+ +
KeyboardEventHandler
+
Provides keyboard and lexical-model events and methods to notify registered listeners
+
+ +

See also

+ + diff --git a/developer/engine/android/16.0/whatsnew.md b/developer/engine/android/16.0/whatsnew.md new file mode 100644 index 000000000..db53ea4bb --- /dev/null +++ b/developer/engine/android/16.0/whatsnew.md @@ -0,0 +1,27 @@ +--- +title: What's New +--- + +## Keyman Engine for Android Breaking Changes: ## + +* Default short press globe key action changed from `GLOBE_KEY_ACTION_SHOW_MENU` to behave as follows: + +| KeyboardType | # Keyman Keyboards Installed | Globe Key Action Type | +|----------------------|:----------------------------:|------------------------------------------------------| +| KEYBOARD_TYPE_INAPP | 1 | GLOBE_KEY_ACTION_SHOW_MENU | +| KEYBOARD_TYPE_SYSTEM | 1 | GLOBE_KEY_ACTION_ADVANCE_TO_PREVIOUS_SYSTEM_KEYBOARD | +| KEYBOARD_TYPE_INAPP | 2+ | GLOBE_KEY_ACTION_SWITCH_TO_NEXT_KEYBOARD | +| KEYBOARD_TYPE_SYSTEM | 2+ | GLOBE_KEY_ACTION_SWITCH_TO_NEXT_KEYBOARD | +* Add default long press globe key action `GLOBE_KEY_ACTION_SHOW_MENU` +* Removed the following AndroidManifest.xml permissions + * INTERNET + * ACCESS_NETWORK_STATE + * READ_EXTERNAL_STORAGE + + If your application needs INTERNET access, you'll need to add this line to AndroidManifest.xml +```xml + +``` + +## See Also +* [Keyman Engine for Android Documentation](index) \ No newline at end of file