From 32ee7219e6601d8043b0a125fee1bd9963272ae5 Mon Sep 17 00:00:00 2001 From: l00574490 Date: Wed, 26 Mar 2025 11:08:26 +0800 Subject: [PATCH] add keyboard will show or hide notification Change-Id: I3f82b8ee166b19b522edac45237a6ed9b24c1963 --- api/@ohos.window.d.ts | 92 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 89 insertions(+), 3 deletions(-) diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 5943c70607..1ee30690fd 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -3730,7 +3730,7 @@ declare namespace window { */ interface KeyboardInfo { /** - * The position and size of the keyboard + * The position and size after keyboard animation completed * * @type { Rect } * @syscap SystemCapability.Window.SessionManager @@ -3738,6 +3738,33 @@ declare namespace window { * @since 18 */ rect: Rect; + /** + * The position and size before keyboard animation + * + * @type { Rect } + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 20 + */ + beginRect?: Rect; + /** + * Indicates whether animation exists. + * + * @type { Boolean } + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 20 + */ + animated?: Boolean; + /** + * The configuration of keyboard animation + * + * @type { WindowAnimatioConfig } + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 20 + */ + config?: WindowAnimatioConfig; } /** @@ -5717,6 +5744,36 @@ declare namespace window { */ off(type: 'keyboardHeightChange', callback?: Callback): void; + /** + * Register the callback of keyboardWillShow + * + * @param { 'keyboardWillShow' } type - The value is fixed at 'keyboardWillShow', indicating the start of the keyboard show animation event. + * @param { Callback } callback - Callback invoked before the keyboard show animation start. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Function keyboardWillShow can not work correctly due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 20 + */ + on(type: 'keyboardWillShow', callback: Callback): void; + /** + * Unregister the callback of keyboardWillShow + * + * @param { 'keyboardWillShow' } type - The value is fixed at 'keyboardWillShow', indicating the start of the keyboard show animation event. + * @param { Callback } callback - Callback invoked before the keyboard show animation start. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; + * 2. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Function keyboardWillShow can not work correctly due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 20 + */ + off(type: 'keyboardWillShow', callback?: Callback): void; + /** * Register the callback of keyboardDidShow * @@ -5732,7 +5789,6 @@ declare namespace window { * @since 18 */ on(type: 'keyboardDidShow', callback: Callback): void; - /** * Unregister the callback of keyboardDidShow * @@ -5748,6 +5804,37 @@ declare namespace window { */ off(type: 'keyboardDidShow', callback?: Callback): void; + /** + * Register the callback of keyboardWillHide + * + * @param { 'keyboardWillHide' } type - The value is fixed at 'keyboardWillHide', indicating the start of the keyboard hide animation event. + * @param { Callback } callback - Callback invoked before the keyboard hide animation start. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Function keyboardWillHide can not work correctly due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 20 + */ + on(type: 'keyboardWillHide', callback: Callback): void; + + /** + * Unregister the callback of keyboardWillHide + * + * @param { 'keyboardWillHide' } type - The value is fixed at 'keyboardWillHide', indicating the start of the keyboard hide animation event. + * @param { Callback } callback - Callback invoked before the keyboard hide animation start. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; + * 2. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Function keyboardWillHide can not work correctly due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 20 + */ + off(type: 'keyboardWillHide', callback?: Callback): void; + /** * Register the callback of keyboardDidHide * @@ -5763,7 +5850,6 @@ declare namespace window { * @since 18 */ on(type: 'keyboardDidHide', callback: Callback): void; - /** * Unregister the callback of keyboardDidHide * -- Gitee