diff --git a/api/@ohos.inputmethod.d.ts b/api/@ohos.inputmethod.d.ts index fb1d97ce7d50fad4645d10c162eb39d3cf6da050..7a47e7b3c78875c1cddc6f816403de0c477d8554 100644 --- a/api/@ohos.inputmethod.d.ts +++ b/api/@ohos.inputmethod.d.ts @@ -39,12 +39,70 @@ declare namespace inputMethod { */ function getInputMethodController(): InputMethodController; + /** + * Switch input method + * @since 9 + * @param target Indicates the input method which will replace the current one + * @return - + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + */ + function switchInputMethod(target: InputMethodProperty, callback: AsyncCallback): void; + + /** + * Switch input method + * @since 9 + * @param target Indicates the input method which will replace the current one + * @return - + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + */ + function switchInputMethod(target: InputMethodProperty): Promise; + + /** + * Get current input method + * @since 9 + * @return The InputMethodProperty object of the current input method + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + */ + function getCurrentInputMethod(): InputMethodProperty; + /** * @since 8 */ interface InputMethodSetting { - listInputMethod(callback: AsyncCallback>): void; + /** + * List input methods + * @since 9 + * @param enable : + * if true, collect enabled input methods. + * if false, collect disabled input methods. + * @return - + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + */ + listInputMethod(enable: boolean, callback: AsyncCallback>): void; + + /** + * List input methods + * @since 9 + * @param enable : + * if true, collect enabled input methods. + * if false, collect disabled input methods. + * @return - + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + */ + listInputMethod(enable: boolean): Promise>; + /** + * @since 8 + */ + listInputMethod(callback: AsyncCallback>): void; + /** + * @since 8 + */ listInputMethod(): Promise>; displayOptionalInputMethod(callback: AsyncCallback): void; diff --git a/api/@ohos.inputmethodengine.d.ts b/api/@ohos.inputmethodengine.d.ts index 332c396c47aef608d08cf72af2d690f25c9a0d08..51f2366f931b501d6349d5f4cc04a4f883efb97f 100644 --- a/api/@ohos.inputmethodengine.d.ts +++ b/api/@ohos.inputmethodengine.d.ts @@ -14,6 +14,11 @@ */ import {AsyncCallback} from './basic'; +import Want from './@ohos.application.Want'; +import StartOptions from "./@ohos.application.StartOptions"; +import { ConnectOptions } from "./ability/connectOptions"; +import ExtensionContext from './application/ExtensionContext'; +import { ExtensionAbilityInfo } from "./bundle/extensionAbilityInfo"; /** * inputmethodengine @@ -53,6 +58,13 @@ declare namespace inputMethodEngine { const OPTION_MULTI_LINE: number; const OPTION_NO_FULLSCREEN: number; + /** + * The window styles for inputmethod ability. + * @since 9 + * @syscap SystemCapability.MiscServices.InputMethodFramework + */ + const WINDOW_TYPE_INPUT_METHOD_FLOAT: number; + function getInputMethodEngine(): InputMethodEngine; function createKeyboardDelegate(): KeyboardDelegate; @@ -101,6 +113,28 @@ declare namespace inputMethodEngine { getEditorAttribute(callback: AsyncCallback): void; getEditorAttribute(): Promise; + + /** + * Move curosr from input method. + * + * @since 9 + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @param direction Indicates the distance of cursor to be moved. + * @return - + * @StageModelOnly + */ + moveCursor(direction: number, callback: AsyncCallback): void; + + /** + * Move curosr from input method. + * + * @since 9 + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @param direction Indicates the distance of cursor to be moved. + * @return - + * @StageModelOnly + */ + moveCursor(direction: number): Promise; } interface KeyboardDelegate { @@ -130,6 +164,83 @@ declare namespace inputMethodEngine { readonly keyCode: number; readonly keyAction: number; } + + /** + * The extension context class of input method. + * + * @since 9 + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + */ + class InputMethodExtensionContext extends ExtensionContext { + + /** + * Input method extension uses this method to start a specific ability. + * + * @since 9 + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @param want Indicates the ability to start. + * @param options Indicates the start options. + * @return - + * @StageModelOnly + */ + startAbility(want: Want, callback: AsyncCallback): void; + startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + startAbility(want: Want, options?: StartOptions): Promise; + + /** + * Destroy the input method extension. + * + * @since 9 + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @return - + * @StageModelOnly + */ + terminateSelf(callback: AsyncCallback): void; + terminateSelf(): Promise; + + } + + /** + * The extension ability class of input method. + * + * @since 9 + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + */ + class InputMethodExtensionAbility { + + /** + * Indicates input method extension ability context. + * + * @since 9 + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + */ + context: InputMethodExtensionContext; + + /** + * Called back when a input method extension is started for initialization. + * + * @since 9 + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @param want Indicates the want of created service extension. + * @return - + * @StageModelOnly + */ + onCreate(want: Want): void; + + /** + * Called back before a input method extension is destroyed. + * + * @since 9 + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @return - + * @StageModelOnly + */ + onDestroy(): void; + + } } export default inputMethodEngine;