From 303270b081e6ef5e202fbdac8cc81d85ea66d47f Mon Sep 17 00:00:00 2001 From: huangjie Date: Wed, 20 Apr 2022 11:16:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B5=84=E6=BA=90=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huangjie --- api/@ohos.resourceManager.d.ts | 157 ++++++++++++++++++++++++++++++++- 1 file changed, 154 insertions(+), 3 deletions(-) diff --git a/api/@ohos.resourceManager.d.ts b/api/@ohos.resourceManager.d.ts index 270ff4875f..7f2a2105f9 100644 --- a/api/@ohos.resourceManager.d.ts +++ b/api/@ohos.resourceManager.d.ts @@ -269,7 +269,7 @@ export interface ResourceManager { * @return Returns the array of character strings corresponding to the specified resource ID. * @since 6 */ - getStringArray(resId: number): Promise>; + getStringArray(resId: number): Promise>; /** * Obtains the content of the media file corresponding to a specified resource ID in callback mode. @@ -297,7 +297,7 @@ export interface ResourceManager { * resource. * @since 6 */ - getMediaBase64(resId: number, callback: AsyncCallback): void; + getMediaBase64(resId: number, callback: AsyncCallback): void; /** * Obtains the Base64 code of the image resource corresponding to the specified resource ID in Promise mode. @@ -417,7 +417,158 @@ export interface ResourceManager { * @return Returns result close raw file resource descriptor corresponding to the specified resource path. * @since 8 */ - closeRawFileDescriptor(path: string): Promise; + closeRawFileDescriptor(path: string): Promise; + + /** + * Obtains the character string corresponding to a specified resource name in callback mode. + * + * @param resName Indicates the resource name. + * @param callback Indicates the asynchronous callback used to return the obtained character string. + * @since 9 + */ + getStringByName(resName: string, callback: AsyncCallback): void; + + /** + * Obtains string resources associated with a specified resource name in Promise mode. + * + * @param resName Indicates the resource name. + * @return Returns the character string corresponding to the resource name. + * @since 9 + */ + getStringByName(resName: string): Promise; + + /** + * Obtains the array of character strings corresponding to a specified resource name in callback mode. + * + * @param resName Indicates the resource name. + * @param callback Indicates the asynchronous callback used to return the obtained array of character strings. + * @since 9 + */ + getStringArrayByName(resName: string, callback: AsyncCallback>): void; + + /** + * Obtains the array of character strings corresponding to a specified resource name in Promise mode. + * + * @param resName Indicates the resource name. + * @return Returns the array of character strings corresponding to the specified resource name. + * @since 9 + */ + getStringArrayByName(resName: string): Promise>; + + /** + * Obtains the content of the media file corresponding to a specified resource name in callback mode. + * + * @param resName Indicates the resource name. + * @param callback Indicates the asynchronous callback used to return the obtained media file content. + * @since 9 + */ + getMediaByName(resName: string, callback: AsyncCallback): void; + + /** + * Obtains the content of the media file corresponding to a specified resource name in Promise mode. + * + * @param resName Indicates the resource name. + * @return Returns the content of the media file corresponding to the specified resource name. + * @since 9 + */ + getMediaByName(resName: string): Promise; + + /** + * Obtains the Base64 code of the image resource corresponding to the specified resource name in callback mode. + * + * @param resName Indicates the resource name. + * @param callback Indicates the asynchronous callback used to return the obtained Base64 code of the image + * resource. + * @since 9 + */ + getMediaBase64ByName(resName: string, callback: AsyncCallback): void; + + /** + * Obtains the Base64 code of the image resource corresponding to the specified resource name in Promise mode. + * + * @param resName Indicates the resource name. + * @return Returns the Base64 code of the image resource corresponding to the specified resource name. + * @since 9 + */ + getMediaBase64ByName(resName: string): Promise; + + /** + * Obtains the singular-plural character string represented by the name string corresponding to the + * specified number in callback mode. + * + * @param resName Indicates the resource name. + * @param num Indicates the number. + * @param callback Indicates the asynchronous callback used to return the singular-plural character + * string represented by the name string corresponding to the specified number. + * @since 9 + */ + getPluralStringByName(resName: string, num: number, callback: AsyncCallback): void; + + /** + * Obtains the singular-plural character string represented by the name string corresponding to + * the specified number in Promise mode. + * + * @param resName Indicates the resource name. + * @param num Indicates the number. + * @return Returns the singular-plural character string represented by the name string + * corresponding to the specified number. + * @since 9 + */ + getPluralStringByName(resName: string, num: number): Promise; + + /** + * Obtains string resources associated with a specified resource ID. + * + * @param resId Indicates the resource ID. + * @return Returns the character string corresponding to the resource ID. + * @since 9 + */ + getStringSync(resId: number): string; + + /** + * Obtains string resources associated with a specified resource name. + * + * @param resName Indicates the resource name. + * @return Returns the character string corresponding to the resource name. + * @since 9 + */ + getStringByNameSync(resName: string): string; + + /** + * Obtains the boolean result with a specified resource ID. + * + * @param resId Indicates the resource ID. + * @return Returns the boolean resource corresponding to the resource ID. + * @since 9 + */ + getBoolean(resId: number): boolean; + + /** + * Obtains the boolean result with a specified resource name. + * + * @param resName Indicates the resource name. + * @return Returns the boolean resource corresponding to the resource name. + * @since 9 + */ + getBooleanByName(resName: string): boolean; + + /** + * Obtains the number result with a specified resource ID. + * + * @param resId Indicates the resource ID. + * @return Returns the number resource corresponding to the resource ID. + * @since 9 + */ + getNumber(resId: number): number; + + /** + * Obtains the number result with a specified resource name. + * + * @param resName Indicates the resource name. + * @return Returns the number resource corresponding to the resource name. + * @since 9 + */ + getNumberByName(resName: string): number; /** * Obtains release resourceManager. -- Gitee