Skip to content

Commit

Permalink
Merge pull request #617 from keymanapp/chore/android/deprecate-help-b…
Browse files Browse the repository at this point in the history
…ubble

chore: Deprecate developer/android/engine/16.0 help bubble API methods
  • Loading branch information
darcywong00 authored Oct 20, 2022
2 parents 9d07e22 + b30ce56 commit 0b9c980
Show file tree
Hide file tree
Showing 91 changed files with 4,336 additions and 0 deletions.
87 changes: 87 additions & 0 deletions developer/engine/android/16.0/KMManager/addKeyboard.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php
require_once('includes/template.php');
$class = 'KMManager';
$method = 'addKeyboard';
$param1 = 'context';
$param2 = 'keyboardInfo';
$methodSyntax1 = sprintf('<var>%s</var>.%s(<var>Context %s</var>, <var>Keyboard %s</var>)', $class, $method, $param1, $param2);
$methodSyntax2 = sprintf('<var>%s</var>.%s(<var>Context %s</var>, <var>HashMap&lt;String, String&gt; %s</var>)', $class, $method, $param1, $param2);
head(['title' => $class.'.'.$method.'()']);
?>

<h1>KMManager.addKeyboard()</h1>

<h2 id="Summary" name="Summary">Summary</h2>
<p>The <code><strong><?php echo $method.'()' ?></strong></code> method adds a keyboard into the keyboards list.</p>

<h2 id="Syntax" name="Syntax">Syntax</h2>
<pre class="language-javascript"><code><?php echo $methodSyntax1 ?></code></pre>

<h3 id="Parameters" name="Parameters">Parameters</h3>
<dl>
<dt><code><?php echo $param1 ?></code></dt>
<dd>The context.</dd>
<dt><code><?php echo $param2 ?></code></dt>
<dd>A <code>Keyboard</code> type of keyboard information.</dd>
</dl>

<h3 id="Returns" name="Returns">Returns</h3>
<p>Returns <code>true</code> if the keyboard was added successfully, <code>false</code> otherwise.</p>

<h2 id="Description" name="Description">Description</h2>
<p>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.</p>

<br><hr>

<h2 id="Syntax" name="Syntax">Syntax (Deprecated)</h2>
<pre class="language-javascript"><code><?php echo $methodSyntax2 ?></code></pre>

<h3 id="Parameters" name="Parameters">Parameters</h3>
<dl>
<dt><code><?php echo $param1 ?></code></dt>
<dd>The context.</dd>
<dt><code><?php echo $param2 ?></code></dt>
<dd>A dictionary of keyboard information with keys and values defined as <code>HashMap&lt;String key, String value&gt;</code>.</dd>
</dl>

<h3 id="Returns" name="Returns">Returns</h3>
<p>Returns <code>true</code> if the keyboard was added successfully, <code>false</code> otherwise.</p>

<h2 id="Description" name="Description">Description</h2>
<p>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.</p>

<br><hr>

<h2 id="Examples">Examples</h2>

<h3 id="Example:_Using_method" name="Example:_Using_method">Example: Using <code><?php echo $method.'()' ?></code></h3>
<p>The following script illustrate the use of <code><?php echo $method.'()' ?></code>:</p>
<pre class="language-javascript line-numbers"><code> // 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);
</code></pre>

<h2 id="History" name="History">History</h2>
<p>Added syntax using Keyboard type parameter in Keyman Engine for Android 14.0.</p>
<p>Deprecated syntax using the HashMap&lt;String key, String value&gt; parameter in Keyman Engine for Android 14.0</p>

<h2 id="See_also" name="See_also">See also</h2>
<ul>
<li><a href="removeKeyboard.php"><code>removeKeyboard()</code></a></li>
</ul>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
require_once('includes/template.php');
$class = 'KMManager';
$method = 'addKeyboardDownloadEventListener';
$param1 = 'listener';
$methodSyntax = sprintf('<var>%s</var>.%s(<var>OnKeyboardDownloadEventListener %s</var>)', $class, $method, $param1);
head(['title' => $class.'.'.$method.'()']);
?>

<h1>KMManager.addKeyboardDownloadEventListener()</h1>

<h2 id="Summary" name="Summary">Summary</h2>
<p>The <code><strong><?php echo $method.'()' ?></strong></code> method adds the specified listener into the list of keyboard download event listeners.</p>

<h2 id="Syntax" name="Syntax">Syntax</h2>
<pre class="language-javascript"><code><?php echo $methodSyntax ?></code></pre>

<h3 id="Parameters" name="Parameters">Parameters</h3>
<dl>
<dt><code><?php echo $param1 ?></code></dt>
<dd>The listener to receive keyboard download event notifications.</dd>
</dl>

<h2 id="Description" name="Description">Description</h2>
<p>Use this method to add a listener to receive keyboard download event notifications. The listener must implement <code>KMManager.OnKeyboardDownloadEventListener</code> interface.</p>

<h2 id="Examples">Examples</h2>

<h3 id="Example:_Using_method" name="Example:_Using_method">Example: Using <code><?php echo $method.'()' ?></code></h3>
<p>The following script illustrate the use of <code><?php echo $method.'()' ?></code>:</p>
<pre class="language-javascript line-numbers"><code> @Override
protected void onResume() {
super.onResume();
// ...
KMManager.addKeyboardDownloadEventListener(this);
// ...
}
</code></pre>

<h2 id="See_also" name="See_also">See also</h2>
<ul>
<li><a href="removeKeyboardDownloadEventListener.php" title="Title."><code>removeKeyboardDownloadEventListener()</code></a></li>
</ul>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
require_once('includes/template.php');
$class = 'KMManager';
$method = 'addKeyboardEventListener';
$param1 = 'listener';
$methodSyntax = sprintf('<var>%s</var>.%s(<var>OnKeyboardEventListener %s</var>)', $class, $method, $param1);
head(['title' => $class.'.'.$method.'()']);
?>

<h1>KMManager.addKeyboardEventListener()</h1>

<h2 id="Summary" name="Summary">Summary</h2>
<p>The <code><strong><?php echo $method.'()' ?></strong></code> method adds the specified listener into the list of keyboard event listeners.</p>

<h2 id="Syntax" name="Syntax">Syntax</h2>
<pre class="language-javascript"><code><?php echo $methodSyntax ?></code></pre>

<h3 id="Parameters" name="Parameters">Parameters</h3>
<dl>
<dt><code><?php echo $param1 ?></code></dt>
<dd>The listener to receive keyboard event notifications.</dd>
</dl>

<h2 id="Description" name="Description">Description</h2>
<p>Use this method to add a listener to receive keyboard event notifications. The listener must implement KMManager.OnKeyboardEventListener interface.</p>

<h2 id="Examples">Examples</h2>

<h3 id="Example:_Using_method" name="Example:_Using_method">Example: Using <code><?php echo $method.'()' ?></code></h3>
<p>The following script illustrate the use of <code><?php echo $method.'()' ?></code>:</p>
<pre class="language-javascript line-numbers"><code> @Override
protected void onResume() {
super.onResume();
// ...
KMManager.addKeyboardEventListener(this);
// ...
}
</code></pre>

<h2 id="See_also" name="See_also">See also</h2>
<ul>
<li><a href="removeKeyboardEventListener.php" title="Title."><code>removeKeyboardEventListener()</code></a></li>
</ul>
49 changes: 49 additions & 0 deletions developer/engine/android/16.0/KMManager/addLexicalModel.md
Original file line number Diff line number Diff line change
@@ -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<String, String> lexicalModelInfo)
```

### Parameters

`context`
: The context.

`lexicalModelInfo`
: A dictionary of lexical model information with keys and values defined as `HashMap<String key, String value)`.

### Returns
Returns `true` if the lexical model was added successfully, `false` otherwise.

## Description
Use this method to include a lexical model in the lexical models list. If the lexical model with the same
package ID, language ID, and lexical model ID exists, it updates the existing lexical model info.

After a lexical model has been added, call [registerLexicalModel()](registerLexicalModel) when you want the lexical model
to generate suggestions with an associated keyboard of a matching language.

## Examples

### Example: Using `addLexicalModel()`

The following script illustrates the use of `addLexicalModel()`:
```java
HashMap<String, String>lexicalModelInfo = new HashMap<String, String>();
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)
31 changes: 31 additions & 0 deletions developer/engine/android/16.0/KMManager/advanceToNextInputMode.md
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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)
54 changes: 54 additions & 0 deletions developer/engine/android/16.0/KMManager/applyKeyboardHeight.md
Original file line number Diff line number Diff line change
@@ -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)
37 changes: 37 additions & 0 deletions developer/engine/android/16.0/KMManager/canAddNewKeyboard.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
require_once('includes/template.php');
$class = 'KMManager';
$method = 'canAddNewKeyboard';
$methodSyntax = sprintf('<var>%s</var>.%s()', $class, $method);
head(['title' => $class.'.'.$method.'()']);
?>

<h1>KMManager.canAddNewKeyboard()</h1>

<h2 id="Summary" name="Summary">Summary</h2>
<p>The <code><strong><?php echo $method.'()' ?></strong></code> method returns whether adding a new keyboard is enabled.</p>

<h2 id="Syntax" name="Syntax">Syntax</h2>
<pre class="language-javascript"><code><?php echo $methodSyntax ?></code></pre>

<h3 id="Returns" name="Returns">Returns</h3>
<p>Returns <code>true</code> if adding a new keyboard is enabled, <code>false</code> otherwise.</p>

<h2 id="Description" name="Description">Description</h2>
<p>Use this method to check if additional keyboards can be added.</p>

<h2 id="Examples">Examples</h2>

<h3 id="Example:_Using_method" name="Example:_Using_method">Example: Using <code><?php echo $method.'()' ?></code></h3>
<p>The following script illustrate the use of <code><?php echo $method.'()' ?></code>:</p>
<pre class="language-javascript line-numbers"><code> Keyboard kbInfo = ...; // Keyboard information
if (KMManager.canAddNewKeyboard()) {
KMManager.addKeyboard(this, kbInfo);
}
</code></pre>

<h2 id="See_also" name="See_also">See also</h2>
<ul>
<li><a href="canRemoveKeyboard"><code>canRemoveKeyboard</code></a></li>
<li><a href="setCanAddNewKeyboard.php"><code>setCanAddNewKeyboard</code></a></li>
</ul>
Loading

0 comments on commit 0b9c980

Please sign in to comment.