diff --git a/developer/engine/android/17.0/KMManager/copyHTMLBannerAssets.md b/developer/engine/android/17.0/KMManager/copyHTMLBannerAssets.md new file mode 100644 index 000000000..733a368d5 --- /dev/null +++ b/developer/engine/android/17.0/KMManager/copyHTMLBannerAssets.md @@ -0,0 +1,44 @@ +--- +title: copyHTMLBannerAssets +--- + +## Summary +The **copyHTMLBannerAssets()** method copies a folder of HTML banner assets so it's available for your keyboard app's resources. + +## Syntax + +```javascript +KMManager.copyHTMLBannerAssets(Context context, String path) +``` + +### Parameters + +`context` +: The context. + +`path` +: Relative to the /assets folder, the folder which contains the HTML assets to display when suggestions aren't available. + +### Returns +Returns `true` if HTML assets were copied, `false` otherwise. + +## Description +When suggestions aren't available for a keyboard, an HTML banner is displayed instead. +Use this method to specify any HTML assets the banner will use to theme your keyboard app. Some examples of assets would be .svg images or .css files used in your banner. + +This can be called towards the end of `SystemKeyboard.onCreate()`. + +You still need to call [setHTMLBanner()](setHTMLBanner) for Keyman Engine to assign the HTML banner for in-app and system keyboards. + +## Examples + +### Example: Using `copyHTMLBannerAssets()` + +The following script illustrates the use of `copyHTMLBannerAssets()`: +```javascript + // Copies HTML banner assets located in /assets/banner/ + KMManager.copyHTMLBannerAssets(this, "banner"); +``` + +## See also +* [setHTMLBanner()](setHTMLBanner) diff --git a/developer/engine/android/17.0/KMManager/index.php b/developer/engine/android/17.0/KMManager/index.php index 449f7005f..4d1c94dd8 100644 --- a/developer/engine/android/17.0/KMManager/index.php +++ b/developer/engine/android/17.0/KMManager/index.php @@ -52,6 +52,9 @@
canRemoveKeyboard()
returns whether removing a keyboard is enabled, like in the keyboard picker menu
+
copyHTMLBannerAssets()
+
copies a folder of HTML banner assets so it's available for your keyboard app's resources
+
createInputView()
creates the input view to be used in InputMethodService
@@ -220,6 +223,9 @@
setHelpBubbleEnabled() (deprecated)
enables or disables the help bubble
+
setHTMLBanner()
+
sets the contents of an HTML banner for Keyman Engine to display when suggestions aren't available
+
setKeyboard()
sets the keyboard to be used
diff --git a/developer/engine/android/17.0/KMManager/setHTMLBanner.md b/developer/engine/android/17.0/KMManager/setHTMLBanner.md new file mode 100644 index 000000000..5990945c5 --- /dev/null +++ b/developer/engine/android/17.0/KMManager/setHTMLBanner.md @@ -0,0 +1,45 @@ +--- +title: setHTMLBanner +--- + +## Summary +The **setHTMLBanner()** method sets the HTML banner content for Keyman Engine to display when suggestions aren't available. + +## Syntax + +```javascript +KMManager.setHTMLBanner(KeyboardType keyboardType, String content) +``` + +### Parameters + +`keyboardType` +: KeyboardType to be used. `KEYBOARD_TYPE_INAPP` or `KEYBOARD_TYPE_SYSTEM`. + +`content` +: HTML content formatted as a string. + +### Returns +Returns `true` if HTML banner is set, `false` otherwise. + +## Description +When suggestions aren't available for a keyboard, an HTML banner is displayed instead. +Use this method to specify the HTML content to display in the banner to theme your keyboard app. + +If the banner theme references assets (like .svg or .css files), ensure you've also called [copyHTMLBannerAssets()](copyHTMLBannerAssets). + +Note: The HTML banner needs to be updated whenever the keyboard is reloaded, so call this in `SystemKeyboard.onInitializeInterface(()`. + +## Examples + +### Example: Using `setHTMLBanner()` + +The following script illustrates the use of `setHTMLBanner()`: +```javascript + String KMGRAY_BANNER = "
"; + // Sets the HTML banner content + KMManager.setHTMLBanner(KeyboardType.KEYBOARD_TYPE_SYSTEM, KMGRAY_BANNER); +``` + +## See also +* [copyHTMLBannerAssets()](copyHTMLBannerAssets)