未验证 提交 cfd4bd27 编写于 作者: O openharmony_ci 提交者: Gitee

!13823 翻译完成:12543 faqs更新

Merge pull request !13823 from wusongqing/TR12543
...@@ -212,5 +212,3 @@ The following conditions must be met: ...@@ -212,5 +212,3 @@ The following conditions must be met:
1. Before the redirection to the previous page, a confirm dialog box will be displayed. Note that **router.disableAlertBeforeBackPage** is used to disable the display of a confirm dialog box before returning to the previous page (default), and **router.enableAlertBeforeBackPage** is used to enable the display. 1. Before the redirection to the previous page, a confirm dialog box will be displayed. Note that **router.disableAlertBeforeBackPage** is used to disable the display of a confirm dialog box before returning to the previous page (default), and **router.enableAlertBeforeBackPage** is used to enable the display.
2. The system return key is used. 2. The system return key is used.
<!--no_check-->
\ No newline at end of file
...@@ -18,10 +18,10 @@ Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9 ...@@ -18,10 +18,10 @@ Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9
1. Use the **onWindowStageCreate** to obtain a **windowClass** object. 1. Use the **onWindowStageCreate** to obtain a **windowClass** object.
``` ```ts
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
// When the main window is created, set the main page for this ability. // When the main window is created, set the main page for this ability.
console.log("[Demo] MainAbility onWindowStageCreate") console.log("[Demo] EntryAbility onWindowStageCreate")
windowStage.getMainWindow((err, data) => { windowStage.getMainWindow((err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to obtain the main window.') console.error('Failed to obtain the main window.')
...@@ -35,7 +35,7 @@ Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9 ...@@ -35,7 +35,7 @@ Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9
2. Enable the full-screen mode for the window and hide the status bar. 2. Enable the full-screen mode for the window and hide the status bar.
``` ```ts
globalThis.windowClass.setFullScreen(isFullScreen, (err, data) => { globalThis.windowClass.setFullScreen(isFullScreen, (err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to enable the full-screen mode. Cause:' + JSON.stringify(err)); console.error('Failed to enable the full-screen mode. Cause:' + JSON.stringify(err));
...@@ -54,7 +54,7 @@ Use **window.getProperties()** to obtain the window properties. The **windowRect ...@@ -54,7 +54,7 @@ Use **window.getProperties()** to obtain the window properties. The **windowRect
Example: Example:
``` ```ts
let promise = windowClass.getProperties(); let promise = windowClass.getProperties();
promise.then((data)=> { promise.then((data)=> {
console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data.windowRect)); console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data.windowRect));
...@@ -70,7 +70,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 ...@@ -70,7 +70,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
Refer to the following code: Refer to the following code:
``` ```ts
window.getTopWindow(globalThis.mainContext).then(win => { window.getTopWindow(globalThis.mainContext).then(win => {
var systemBarProperties = { var systemBarProperties = {
statusBarColor: '#19B6FF', // Set the background color of the status bar. statusBarColor: '#19B6FF', // Set the background color of the status bar.
......
...@@ -42,7 +42,7 @@ cameraInput = await this.cameraManager.createCameraInput(cameraId) ...@@ -42,7 +42,7 @@ cameraInput = await this.cameraManager.createCameraInput(cameraId)
Applicable to: OpenHarmony SDK 3.2.5.6, stage model of API version 9 Applicable to: OpenHarmony SDK 3.2.5.6, stage model of API version 9
1. Create an **ImageSource** instance based on the input URI. 1. Create an **ImageSource** instance based on the input URI.
``` ```
let path = this.context.getApplicationContext().fileDirs + "test.jpg"; let path = this.context.getApplicationContext().fileDirs + "test.jpg";
const imageSourceApi = image.createImageSource(path); const imageSourceApi = image.createImageSource(path);
...@@ -52,7 +52,7 @@ Applicable to: OpenHarmony SDK 3.2.5.6, stage model of API version 9 ...@@ -52,7 +52,7 @@ Applicable to: OpenHarmony SDK 3.2.5.6, stage model of API version 9
- Set **desiredSize** to specify the target size after scaling. If the values are all set to **0**, scaling will not be performed. - Set **desiredSize** to specify the target size after scaling. If the values are all set to **0**, scaling will not be performed.
- Set **desiredRegion** to specify the target rectangular area after cropping. If the values are all set to **0**, cropping will not be performed. - Set **desiredRegion** to specify the target rectangular area after cropping. If the values are all set to **0**, cropping will not be performed.
- Set **rotateDegrees** to specify the rotation angle. The image will be rotated clockwise at the center. - Set **rotateDegrees** to specify the rotation angle. The image will be rotated clockwise at the center.
``` ```
const decodingOptions = { const decodingOptions = {
desiredSize: { desiredSize: {
...@@ -85,7 +85,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 ...@@ -85,7 +85,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
1. Configure the permissions **ohos.permission.READ_MEDIA** and **ohos.permission.WRITE_MEDIA** in the **module.json5** file. 1. Configure the permissions **ohos.permission.READ_MEDIA** and **ohos.permission.WRITE_MEDIA** in the **module.json5** file.
Example: Example:
``` ```
{ {
"module" : { "module" : {
...@@ -104,10 +104,14 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 ...@@ -104,10 +104,14 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
``` ```
2. Call **requestPermissionsFromUser** to request the permissions from end users in the form of a dialog box. This operation is required because the grant mode of both permissions is **user_grant**. 2. Call **requestPermissionsFromUser** to request the permissions from end users in the form of a dialog box. This operation is required because the grant mode of both permissions is **user_grant**.
``` ```
import abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts';
let permissions: Array<string> = ['ohos.permission.READ_MEDIA','ohos.permission.WRITE_MEDIA'] let permissions: Array<string> = ['ohos.permission.READ_MEDIA','ohos.permission.WRITE_MEDIA']
context.requestPermissionsFromUser(permissions).then((data) => { let atManager = abilityAccessCtrl.createAtManager();
// context is the ability-level context of the initiator UIAbility.
atManager.requestPermissionsFromUser(context, permissions).then((data) => {
console.log("Succeed to request permission from user with data: " + JSON.stringify(data)) console.log("Succeed to request permission from user with data: " + JSON.stringify(data))
}).catch((error) => { }).catch((error) => {
console.log("Failed to request permission from user with error: " + JSON.stringify(error)) console.log("Failed to request permission from user with error: " + JSON.stringify(error))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册