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

!9554 翻译完成:9282+9457+9306+9477

Merge pull request !9554 from wusongqing/TR9282
...@@ -26,7 +26,7 @@ Callback of the common event of a static subscriber. ...@@ -26,7 +26,7 @@ Callback of the common event of a static subscriber.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| event | CommonEventData | Yes| Common event of a static subscriber.| | event | [CommonEventData](js-apis-commonEvent.md#commoneventdata) | Yes| Common event of a static subscriber.|
**Example** **Example**
......
...@@ -9,10 +9,10 @@ The **EventHub** module provides APIs to subscribe to, unsubscribe from, and tri ...@@ -9,10 +9,10 @@ The **EventHub** module provides APIs to subscribe to, unsubscribe from, and tri
## Usage ## Usage
Before using any APIs in the **EventHub**, you must obtain an **EventHub** instance through the member variable **context** of the **Ability** instance. Before using any APIs in the **EventHub**, you must obtain an **EventHub** instance through the member variable **context** of the **Ability** instance.
```js ```js
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability';
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
func1(){ func1(){
console.log("func1 is called"); console.log("func1 is called");
...@@ -34,15 +34,15 @@ Subscribes to an event. ...@@ -34,15 +34,15 @@ Subscribes to an event.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| event | string | Yes| Event name.| | event | string | Yes| Event name.|
| callback | Function | Yes| Callback invoked when the event is triggered.| | callback | Function | Yes| Callback invoked when the event is triggered.|
**Example** **Example**
```js ```js
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability';
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
onForeground() { onForeground() {
...@@ -72,15 +72,15 @@ Unsubscribes from an event. If **callback** is specified, this API unsubscribes ...@@ -72,15 +72,15 @@ Unsubscribes from an event. If **callback** is specified, this API unsubscribes
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| event | string | Yes| Event name.| | event | string | Yes| Event name.|
| callback | Function | No| Callback for the event. If **callback** is unspecified, all callbacks of the event are unsubscribed.| | callback | Function | No| Callback for the event. If **callback** is unspecified, all callbacks of the event are unsubscribed.|
**Example** **Example**
```js ```js
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability';
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
onForeground() { onForeground() {
...@@ -110,15 +110,15 @@ Triggers an event. ...@@ -110,15 +110,15 @@ Triggers an event.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| event | string | Yes| Event name.| | event | string | Yes| Event name.|
| ...args | Object[] | Yes| Variable parameters, which are passed to the callback when the event is triggered.| | ...args | Object[] | Yes| Variable parameters, which are passed to the callback when the event is triggered.|
**Example** **Example**
```js ```js
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability';
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
onForeground() { onForeground() {
......
...@@ -17,7 +17,9 @@ import windowAnimationManager from '@ohos.animation.windowAnimationManager' ...@@ -17,7 +17,9 @@ import windowAnimationManager from '@ohos.animation.windowAnimationManager'
setController(controller: WindowAnimationController): void setController(controller: WindowAnimationController): void
Sets a window animation controller. Sets a window animation controller. For details about the controller, see [WindowAnimationController](#windowanimationcontroller).
Before using other APIs of **windowAnimationManager**, you must call this API to set a window animation controller.
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
...@@ -31,22 +33,38 @@ Sets a window animation controller. ...@@ -31,22 +33,38 @@ Sets a window animation controller.
```js ```js
var controller = { var controller = {
onStartAppFromLauncher(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromLauncher', startingWindowTarget); console.log('onStartAppFromLauncher, the startingWindowTarget is: ' + startingWindowTarget);
}, finishCallback.onAnimationFinish();
onStartAppFromRecent(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { },
console.log('onStartAppFromRecent', startingWindowTarget); onStartAppFromRecent(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromRecent, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
},
onStartAppFromOther(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromOther, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
}, },
onStartAppFromOther(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { onAppTransition(fromWindowTarget: windowAnimationManager.WindowAnimationTarget, toWindowTarget: WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromOther', startingWindowTarget); console.log('onAppTransition, the fromWindowTarget is: ' + fromWindowTarget);
console.log('onAppTransition, the toWindowTarget is: ' + toWindowTarget);
finishCallback.onAnimationFinish();
}, },
onAppTransition(fromWindowTarget: WindowAnimationTarget, toWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { onMinimizeWindow(minimizingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onMinimizeWindow, the minimizingWindowTarget is: ' + minimizingWindowTarget);
finishCallback.onAnimationFinish();
}, },
onMinimizeWindow(minimizingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { onCloseWindow(closingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onCloseWindow, the closingWindowTarget is: ' + closingWindowTarget);
finishCallback.onAnimationFinish();
}, },
onCloseWindow(closingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { onScreenUnlock(finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onScreenUnlock called');
finishCallback.onAnimationFinish();
}, },
onScreenUnlock(finishCallback: WindowAnimationFinishedCallback): void { onWindowAnimationTargetsUpdate(fullScreenWindowTarget: windowAnimationManager.WindowAnimationTarget, floatingWindowTargets: Array<windowAnimationManager.WindowAnimationTarget>): void{
console.log('onWindowAnimationTargetsUpdate, the fullScreenWindowTarget is: ' + fullScreenWindowTarget);
console.log('onWindowAnimationTargetsUpdate, the floatingWindowTargets are: ' + floatingWindowTargets);
} }
} }
...@@ -73,9 +91,39 @@ Minimizes the window that displays the animation. This API uses an asynchronous ...@@ -73,9 +91,39 @@ Minimizes the window that displays the animation. This API uses an asynchronous
```js ```js
var target: WindowAnimationTarget = undefined; var target: WindowAnimationTarget = undefined;
var controller = { var controller = {
onWindowAnimationTargetsUpdate(fullScreenWindowTarget: WindowAnimationTarget, floatingWindowTargets: Array<WindowAnimationTarget>): void { onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
target = fullScreenWindowTarget; console.log('onStartAppFromLauncher, the startingWindowTarget is: ' + startingWindowTarget);
}, finishCallback.onAnimationFinish();
},
onStartAppFromRecent(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromRecent, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
},
onStartAppFromOther(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromOther, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
},
onAppTransition(fromWindowTarget: windowAnimationManager.WindowAnimationTarget, toWindowTarget: WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onAppTransition, the fromWindowTarget is: ' + fromWindowTarget);
console.log('onAppTransition, the toWindowTarget is: ' + toWindowTarget);
finishCallback.onAnimationFinish();
},
onMinimizeWindow(minimizingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onMinimizeWindow, the minimizingWindowTarget is: ' + minimizingWindowTarget);
finishCallback.onAnimationFinish();
},
onCloseWindow(closingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onCloseWindow, the closingWindowTarget is: ' + closingWindowTarget);
finishCallback.onAnimationFinish();
},
onScreenUnlock(finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onScreenUnlock called');
finishCallback.onAnimationFinish();
},
onWindowAnimationTargetsUpdate(fullScreenWindowTarget: windowAnimationManager.WindowAnimationTarget, floatingWindowTargets: Array<windowAnimationManager.WindowAnimationTarget>): void{
console.log('onWindowAnimationTargetsUpdate, the fullScreenWindowTarget is: ' + fullScreenWindowTarget);
console.log('onWindowAnimationTargetsUpdate, the floatingWindowTargets are: ' + floatingWindowTargets);
}
} }
windowAnimationManager.setController(controller) windowAnimationManager.setController(controller)
...@@ -119,9 +167,39 @@ Minimizes the window that displays the animation. This API uses a promise to ret ...@@ -119,9 +167,39 @@ Minimizes the window that displays the animation. This API uses a promise to ret
```js ```js
var target: WindowAnimationTarget = undefined; var target: WindowAnimationTarget = undefined;
var controller = { var controller = {
onWindowAnimationTargetsUpdate(fullScreenWindowTarget: WindowAnimationTarget, floatingWindowTargets: Array<WindowAnimationTarget>): void { onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
target = fullScreenWindowTarget; console.log('onStartAppFromLauncher, the startingWindowTarget is: ' + startingWindowTarget);
}, finishCallback.onAnimationFinish();
},
onStartAppFromRecent(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromRecent, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
},
onStartAppFromOther(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromOther, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
},
onAppTransition(fromWindowTarget: windowAnimationManager.WindowAnimationTarget, toWindowTarget: WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onAppTransition, the fromWindowTarget is: ' + fromWindowTarget);
console.log('onAppTransition, the toWindowTarget is: ' + toWindowTarget);
finishCallback.onAnimationFinish();
},
onMinimizeWindow(minimizingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onMinimizeWindow, the minimizingWindowTarget is: ' + minimizingWindowTarget);
finishCallback.onAnimationFinish();
},
onCloseWindow(closingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onCloseWindow, the closingWindowTarget is: ' + closingWindowTarget);
finishCallback.onAnimationFinish();
},
onScreenUnlock(finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onScreenUnlock called');
finishCallback.onAnimationFinish();
},
onWindowAnimationTargetsUpdate(fullScreenWindowTarget: windowAnimationManager.WindowAnimationTarget, floatingWindowTargets: Array<windowAnimationManager.WindowAnimationTarget>): void{
console.log('onWindowAnimationTargetsUpdate, the fullScreenWindowTarget is: ' + fullScreenWindowTarget);
console.log('onWindowAnimationTargetsUpdate, the floatingWindowTargets are: ' + floatingWindowTargets);
}
} }
windowAnimationManager.setController(controller) windowAnimationManager.setController(controller)
...@@ -137,7 +215,7 @@ promise.then((data) => { ...@@ -137,7 +215,7 @@ promise.then((data) => {
## WindowAnimationController ## WindowAnimationController
Implements the window animation controller. Implements the window animation controller. When creating a **WindowAnimationController** object, you must implement all callbacks in the object.
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
...@@ -156,13 +234,7 @@ Called when an application is started from the home screen. ...@@ -156,13 +234,7 @@ Called when an application is started from the home screen.
**Example** **Example**
```js For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
var controller = {
onStartAppFromLauncher(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
console.log('onStartAppFromLauncher', startingWindowTarget);
}
}
```
### onStartAppFromRecent ### onStartAppFromRecent
...@@ -179,13 +251,7 @@ Called when an application is started from the recent task list. ...@@ -179,13 +251,7 @@ Called when an application is started from the recent task list.
**Example** **Example**
```js For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
var controller = {
onStartAppFromRecent(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
console.log('onStartAppFromRecent', startingWindowTarget);
}
}
```
### onStartAppFromOther ### onStartAppFromOther
...@@ -202,13 +268,7 @@ Called when an application is started from a place other than the home screen an ...@@ -202,13 +268,7 @@ Called when an application is started from a place other than the home screen an
**Example** **Example**
```js For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
var controller = {
onStartAppFromOther(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
console.log('onStartAppFromOther', startingWindowTarget);
}
}
```
### onAppTransition ### onAppTransition
...@@ -226,14 +286,7 @@ Called during application transition. ...@@ -226,14 +286,7 @@ Called during application transition.
**Example** **Example**
```js For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
var controller = {
onAppTransition(fromWindowTarget: WindowAnimationTarget, toWindowTarget: WindowAnimationTarget,
finishCallback: WindowAnimationFinishedCallback): void {
console.log('onAppTransition', fromWindowTarget);
}
}
```
### onMinimizeWindow ### onMinimizeWindow
...@@ -250,13 +303,7 @@ Called when a window is minimized. ...@@ -250,13 +303,7 @@ Called when a window is minimized.
**Example** **Example**
```js For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
var controller = {
onMinimizeWindow(minimizingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
console.log('onMinimizeWindow', minimizingWindowTarget);
}
}
```
### onCloseWindow ### onCloseWindow
...@@ -273,13 +320,7 @@ Called when a window is closed. ...@@ -273,13 +320,7 @@ Called when a window is closed.
**Example** **Example**
```js For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
var controller = {
onCloseWindow(closingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
console.log('onCloseWindow', closingWindowTarget);
}
}
```
### onScreenUnlock ### onScreenUnlock
...@@ -295,13 +336,7 @@ Called when the screen is unlocked. ...@@ -295,13 +336,7 @@ Called when the screen is unlocked.
**Example** **Example**
```js For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
var controller = {
onScreenUnlock(finishCallback: WindowAnimationFinishedCallback): void {
console.log('onScreenUnlock'.);
}
}
```
### onWindowAnimationTargetsUpdate ### onWindowAnimationTargetsUpdate
...@@ -318,15 +353,7 @@ Called when the window that displays the animation is updated. ...@@ -318,15 +353,7 @@ Called when the window that displays the animation is updated.
**Example** **Example**
```js For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
var controller = {
onWindowAnimationTargetsUpdate(fullScreenWindowTarget: WindowAnimationTarget, floatingWindowTargets: Array<WindowAnimationTarget>): void {
console.log('onWindowAnimationTargetsUpdate'.);
}
}
windowAnimationManager.setController(controller)
```
## WindowAnimationFinishedCallback ## WindowAnimationFinishedCallback
Implements a callback that is invoked when the animation is finished. Implements a callback that is invoked when the animation is finished.
...@@ -341,13 +368,7 @@ Called when the animation is finished. ...@@ -341,13 +368,7 @@ Called when the animation is finished.
**Example** **Example**
```js For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
var controller = {
onCloseWindow(closingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
finishCallback.onAnimationFinish();
}
}
```
## WindowAnimationTarget ## WindowAnimationTarget
Defines a window to display animation. Defines a window to display animation.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册