提交 36526f54 编写于 作者: H HelloCrease

Merge branch 'OpenHarmony-3.2-Release' of https://gitee.com/HelloCrease/docs...

Merge branch 'OpenHarmony-3.2-Release' of https://gitee.com/HelloCrease/docs into OpenHarmony-3.2-Release
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
## IDL Overview ## IDL Overview
To ensure successful communications between the client and server, interfaces recognized by both parties must be defined. The OpenHarmony Interface Definition Language (IDL) is a tool for defining such interfaces. OpenHarmony IDL decomposes objects to be transferred into primitives that can be understood by the operating system and encapsulates cross-boundary objects based on developers' requirements. To ensure successful communications between the client and server, interfaces recognized by both parties must be defined. The OpenHarmony Interface Definition Language (IDL) is a tool for defining such interfaces. OpenHarmony IDL decomposes objects to be transferred into primitives that can be understood by the operating system and encapsulates cross-boundary objects based on developers' requirements.
**Figure 1** IDL interface description **Figure 1** IDL interface description
![IDL-interface-description](./figures/IDL-interface-description.png) ![IDL-interface-description](./figures/IDL-interface-description.png)
...@@ -156,9 +156,11 @@ On DevEco Studio, choose **Tools > SDK Manager** to view the local installation ...@@ -156,9 +156,11 @@ On DevEco Studio, choose **Tools > SDK Manager** to view the local installation
Go to the local installation path, choose **toolchains > 3.x.x.x** (the folder named after the version number), and check whether the executable file of IDL exists. Go to the local installation path, choose **toolchains > 3.x.x.x** (the folder named after the version number), and check whether the executable file of IDL exists.
> **NOTE**: Use the SDK of the latest version. The use of an earlier version may cause errors in some statements. > **NOTE**
>
> Use the SDK of the latest version. The use of an earlier version may cause errors in some statements.
If the executable file does not exist, download the SDK package from the mirror as instructed in the [Release Notes](../../release-notes). The following uses the [3.2 Beta5]((../../release-notes/OpenHarmony-v3.2-beta5.md#acquiring-source-code-from-mirrors) as an example. If the executable file does not exist, download the SDK package from the mirror as instructed in the [Release Notes](../../release-notes). The following uses [3.2 Beta5](../../release-notes/OpenHarmony-v3.2-beta5.md#acquiring-source-code-from-mirrors) as an example.
For details about how to replace the SDK package, see [Guide to Switching to Full SDK](../quick-start/full-sdk-switch-guide.md). For details about how to replace the SDK package, see [Guide to Switching to Full SDK](../quick-start/full-sdk-switch-guide.md).
...@@ -176,6 +178,8 @@ You can use TS to create IDL files. ...@@ -176,6 +178,8 @@ You can use TS to create IDL files.
interface OHOS.IIdlTestService { interface OHOS.IIdlTestService {
int TestIntTransaction([in] int data); int TestIntTransaction([in] int data);
void TestStringTransaction([in] String data); void TestStringTransaction([in] String data);
void TestMapTransaction([in] Map<int, int> data);
int TestArrayTransaction([in] String[] data);
} }
``` ```
...@@ -183,7 +187,9 @@ Run the **idl -gen-ts -d *dir* -c dir/IIdlTestService.idl** command in the folde ...@@ -183,7 +187,9 @@ Run the **idl -gen-ts -d *dir* -c dir/IIdlTestService.idl** command in the folde
-*dir* next to **d** is the target output folder. For example, if the target output folder is **IIdlTestServiceTs**, run the **idl -gen-ts -d IIdlTestServiceTs -c IIdlTestServiceTs/IIdlTestService.idl** command in the folder where the executable file is located. The interface file, stub file, and proxy file are generated in the *dir* directory (**IIdlTestServiceTs** directory in this example) in the execution environment. -*dir* next to **d** is the target output folder. For example, if the target output folder is **IIdlTestServiceTs**, run the **idl -gen-ts -d IIdlTestServiceTs -c IIdlTestServiceTs/IIdlTestService.idl** command in the folder where the executable file is located. The interface file, stub file, and proxy file are generated in the *dir* directory (**IIdlTestServiceTs** directory in this example) in the execution environment.
> **NOTE**: The generated interface class file name must be the same as that of the .idl file. Otherwise, an error occurs during code generation. > **NOTE**
>
> The generated interface class file name must be the same as that of the .idl file. Otherwise, an error occurs during code generation.
For example, for an .idl file named **IIdlTestService.idl** and target output directory named **IIdlTestServiceTs**, the directory structure is similar to the following: For example, for an .idl file named **IIdlTestService.idl** and target output directory named **IIdlTestServiceTs**, the directory structure is similar to the following:
...@@ -203,6 +209,8 @@ The stub class generated by IDL is an abstract implementation of the interface c ...@@ -203,6 +209,8 @@ The stub class generated by IDL is an abstract implementation of the interface c
```ts ```ts
import {testIntTransactionCallback} from "./i_idl_test_service"; import {testIntTransactionCallback} from "./i_idl_test_service";
import {testStringTransactionCallback} from "./i_idl_test_service"; import {testStringTransactionCallback} from "./i_idl_test_service";
import {testMapTransactionCallback} from "./i_idl_test_service";
import {testArrayTransactionCallback} from "./i_idl_test_service";
import IIdlTestService from "./i_idl_test_service"; import IIdlTestService from "./i_idl_test_service";
import rpc from "@ohos.rpc"; import rpc from "@ohos.rpc";
...@@ -211,8 +219,8 @@ export default class IdlTestServiceStub extends rpc.RemoteObject implements IIdl ...@@ -211,8 +219,8 @@ export default class IdlTestServiceStub extends rpc.RemoteObject implements IIdl
super(des); super(des);
} }
async onRemoteRequestEx(code: number, data, reply, option): Promise<boolean> { async onRemoteMessageRequest(code: number, data, reply, option): Promise<boolean> {
console.log("onRemoteRequestEx called, code = " + code); console.log("onRemoteMessageRequest called, code = " + code);
switch(code) { switch(code) {
case IdlTestServiceStub.COMMAND_TEST_INT_TRANSACTION: { case IdlTestServiceStub.COMMAND_TEST_INT_TRANSACTION: {
let _data = data.readInt(); let _data = data.readInt();
...@@ -231,6 +239,29 @@ export default class IdlTestServiceStub extends rpc.RemoteObject implements IIdl ...@@ -231,6 +239,29 @@ export default class IdlTestServiceStub extends rpc.RemoteObject implements IIdl
}); });
return true; return true;
} }
case IdlTestServiceStub.COMMAND_TEST_MAP_TRANSACTION: {
let _data = new Map();
let _dataSize = data.readInt();
for (let i = 0; i < _dataSize; ++i) {
let key = data.readInt();
let value = data.readInt();
_data.set(key, value);
}
this.testMapTransaction(_data, (errCode) => {
reply.writeInt(errCode);
});
return true;
}
case IdlTestServiceStub.COMMAND_TEST_ARRAY_TRANSACTION: {
let _data = data.readStringArray();
this.testArrayTransaction(_data, (errCode, returnValue) => {
reply.writeInt(errCode);
if (errCode == 0) {
reply.writeInt(returnValue);
}
});
return true;
}
default: { default: {
console.log("invalid request code" + code); console.log("invalid request code" + code);
break; break;
...@@ -241,17 +272,23 @@ export default class IdlTestServiceStub extends rpc.RemoteObject implements IIdl ...@@ -241,17 +272,23 @@ export default class IdlTestServiceStub extends rpc.RemoteObject implements IIdl
testIntTransaction(data: number, callback: testIntTransactionCallback): void{} testIntTransaction(data: number, callback: testIntTransactionCallback): void{}
testStringTransaction(data: string, callback: testStringTransactionCallback): void{} testStringTransaction(data: string, callback: testStringTransactionCallback): void{}
testMapTransaction(data: Map<number, number>, callback: testMapTransactionCallback): void{}
testArrayTransaction(data: string[], callback: testArrayTransactionCallback): void{}
static readonly COMMAND_TEST_INT_TRANSACTION = 1; static readonly COMMAND_TEST_INT_TRANSACTION = 1;
static readonly COMMAND_TEST_STRING_TRANSACTION = 2; static readonly COMMAND_TEST_STRING_TRANSACTION = 2;
static readonly COMMAND_TEST_MAP_TRANSACTION = 3;
static readonly COMMAND_TEST_ARRAY_TRANSACTION = 4;
} }
``` ```
You need to inherit the interface class defined in the IDL file and implement the methods in the class. The following code snippet shows how to inherit the **IdlTestServiceStub** interface class and implement the **testIntTransaction** and **testStringTransaction** methods. You need to inherit the interface class defined in the IDL file and implement the methods in the class. The following code snippet shows how to inherit the **IdlTestServiceStub** interface class and implement the **testIntTransaction**, **testStringTransaction**, **testMapTransaction**, and **testArrayTransaction** methods.
```ts ```ts
import {testIntTransactionCallback} from "./i_idl_test_service" import {testIntTransactionCallback} from "./i_idl_test_service"
import {testStringTransactionCallback} from "./i_idl_test_service" import {testStringTransactionCallback} from "./i_idl_test_service"
import {testMapTransactionCallback} from "./i_idl_test_service";
import {testArrayTransactionCallback} from "./i_idl_test_service";
import IdlTestServiceStub from "./idl_test_service_stub" import IdlTestServiceStub from "./idl_test_service_stub"
...@@ -265,6 +302,14 @@ class IdlTestImp extends IdlTestServiceStub { ...@@ -265,6 +302,14 @@ class IdlTestImp extends IdlTestServiceStub {
{ {
callback(0); callback(0);
} }
testMapTransaction(data: Map<number, number>, callback: testMapTransactionCallback): void
{
callback(0);
}
testArrayTransaction(data: string[], callback: testArrayTransactionCallback): void
{
callback(0, 1);
}
} }
``` ```
...@@ -320,11 +365,28 @@ function callbackTestStringTransaction(result: number): void { ...@@ -320,11 +365,28 @@ function callbackTestStringTransaction(result: number): void {
} }
} }
function callbackTestMapTransaction(result: number): void {
if (result == 0) {
console.log('case 3 success');
}
}
function callbackTestArrayTransaction(result: number, ret: number): void {
if (result == 0 && ret == 124) {
console.log('case 4 success');
}
}
var onAbilityConnectDone = { var onAbilityConnectDone = {
onConnect:function (elementName, proxy) { onConnect:function (elementName, proxy) {
let testProxy = new IdlTestServiceProxy(proxy); let testProxy = new IdlTestServiceProxy(proxy);
let testMap = new Map();
testMap.set(1, 1);
testMap.set(1, 2);
testProxy.testIntTransaction(123, callbackTestIntTransaction); testProxy.testIntTransaction(123, callbackTestIntTransaction);
testProxy.testStringTransaction('hello', callbackTestStringTransaction); testProxy.testStringTransaction('hello', callbackTestStringTransaction);
testProxy.testMapTransaction(testMap, callbackTestMapTransaction);
testProxy.testArrayTransaction(['1','2'], callbackTestMapTransaction);
}, },
onDisconnect:function (elementName) { onDisconnect:function (elementName) {
console.log('onDisconnectService onDisconnect'); console.log('onDisconnectService onDisconnect');
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
- [ExtensionAbility Component Overview](extensionability-overview.md) - [ExtensionAbility Component Overview](extensionability-overview.md)
- [ServiceExtensionAbility](serviceextensionability.md) - [ServiceExtensionAbility](serviceextensionability.md)
- [DataShareExtensionAbility (for System Applications Only)](datashareextensionability.md) - [DataShareExtensionAbility (for System Applications Only)](datashareextensionability.md)
- [FormExtensionAbility (Widget)](widget-development-stage.md)
- [AccessibilityExtensionAbility](accessibilityextensionability.md) - [AccessibilityExtensionAbility](accessibilityextensionability.md)
- [EnterpriseAdminExtensionAbility](enterprise-extensionAbility.md) - [EnterpriseAdminExtensionAbility](enterprise-extensionAbility.md)
- [InputMethodExtensionAbility](inputmethodextentionability.md) - [InputMethodExtensionAbility](inputmethodextentionability.md)
......
# Using Explicit Want to Start an Ability # Using Explicit Want to Start an Ability
When a user touches a button in an application, the application often needs to start a UIAbility component to complete a specific task. If the **abilityName** and **bundleName** parameters are specified when starting a UIAbility, then the explicit Want is used. Using Explicit Want
When a user touches a button in an application, the application often needs to start a UIAbility component to complete a specific task. The following describes how to use explicit Want to start a UIAbility component in an application. The user touches a button in the application to start the UIAbility component to complete a specific task. To start the UIAbility component in explicit Want mode, the **abilityName** and **bundleName** parameters must be specified. For details, see [Starting UIAbility in the Same Application](uiability-intra-device-interaction.md#starting-uiability-in-the-same-application).
## How to Develop
1. In a project of the stage model, create an ability and a page, named **callerAbility** and **Index.ets**, respectively. Use the **windowStage.loadContent()** method in the **onWindowStageCreate** function in the **callerAbility.ts** file to bind the two.
```ts
// ...
// callerAbility.ts
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.info('[Demo] EntryAbility onWindowStageCreate')
// Bind callerAbility with a paged named Index
windowStage.loadContent('pages/Index')
}
// ...
```
2. Repeat the preceding operation to create another ability named **calleeAbility**.
3. Add a button to the **Index.ets** page of **callerAbility**.
```ts
// ...
build() {
Row() {
Column() {
Text('hello')
.fontSize(50)
.fontWeight(FontWeight.Bold)
// A new button with will call explicitStartAbility() when clicked.
Button("CLICKME")
.onClick(this.explicitStartAbility) // For details about explicitStartAbility, see the sample code below.
// ...
}
.width('100%')
}
.height('100%')
}
// ...
```
4. Override the **onClick** method and use explicit Want to start **calleeAbility** in the method. The **bundleName** field can be obtained from the **AppScope > app.json5** file of the project. The **abilityName** field can be obtained from the **yourModuleName &gt; src &gt; main &gt; module.json5** file of the corresponding module.
```ts
import common from '@ohos.app.ability.common';
// ...
async explicitStartAbility() {
try {
// Explicit want with abilityName specified.
let want = {
deviceId: "",
bundleName: "com.example.myapplication",
abilityName: "calleeAbility"
};
let context = getContext(this) as common.UIAbilityContext;
await context.startAbility(want);
console.info(`explicit start ability succeed`);
} catch (error) {
console.info(`explicit start ability failed with ${error.code}`);
}
}
// ...
```
5. When you touch **CLICKME**, the corresponding page is displayed.
<img src="figures/startAbilityWtExplicitWant.PNG" alt="startAbilityWtExplicitWant" style="zoom: 80%;" />
# Using Implicit Want to Open a Website # Using Implicit Want to Open a Website
This section uses the operation of using a browser to open a website as an example. It is assumed that one or more browser applications are installed on the device. To ensure that the browser application can work properly, configure the [module.json5 file](../quick-start/module-configuration-file.md) as follows:
## Prerequisites
One or more browsers are installed on your device.
The **module.json5** of a browser application is as follows:
```json ```json
"skills": [ {
{ "module": {
"entities": [ // ...
"entity.system.browsable" "abilities": [
// ...
],
"actions": [
"ohos.want.action.viewData"
// ...
],
"uris": [
{
"scheme": "https",
"host": "www.test.com",
"port": "8080",
// Prefix matching is used.
"pathStartWith": "query",
"type": "text/*"
},
{ {
"scheme": "http",
// ... // ...
"skills": [
{
"entities": [
"entity.system.home",
"entity.system.browsable"
// ...
],
"actions": [
"action.system.home",
"ohos.want.action.viewData"
// ...
],
"uris": [
{
"scheme": "https",
"host": "www.test.com",
"port": "8080",
// Prefix matching is used.
"pathStartWith": "query"
},
{
"scheme": "http",
// ...
}
// ...
]
}
]
} }
// ...
] ]
}, }
] }
``` ```
In the initiator UIAbility, use implicit Want to start the browser application.
## How to Develop ```ts
import common from '@ohos.app.ability.common';
1. Use the custom function **implicitStartAbility** to start an ability. function implicitStartAbility() {
let context = getContext(this) as common.UIAbilityContext;
```ts let wantInfo = {
async implicitStartAbility() { // Uncomment the line below if you want to implicitly query data only in the specific bundle.
try { // bundleName: 'com.example.myapplication',
let want = { 'action': 'ohos.want.action.viewData',
// Uncomment the line below if you want to implicitly query data only in the specific bundle. // entities can be omitted.
// bundleName: "com.example.myapplication", 'entities': ['entity.system.browsable'],
"action": "ohos.want.action.viewData", 'uri': 'https://www.test.com:8080/query/student'
// entities can be omitted. }
"entities": [ "entity.system.browsable" ], context.startAbility(wantInfo).then(() => {
"uri": "https://www.test.com:8080/query/student", // ...
"type": "text/plain" }).catch((err) => {
} // ...
let context = getContext(this) as common.UIAbilityContext; })
await context.startAbility(want) }
console.info(`explicit start ability succeed`) ```
} catch (error) {
console.info(`explicit start ability failed with ${error.code}`)
}
}
```
The matching process is as follows:
1. If **action** in the passed **want** parameter is specified and is included in **actions** under **skills**, the matching is successful.
2. If **entities** in the passed **want** parameter is specified and is included in **entities** under **skills**, the matching is successful.
3. If **uri** in the passed **want** parameter is included in **uris** under **skills**, which is concatenated into `https://www.test.com:8080/query*` (where \* is a wildcard), the matching is successful. The matching process is as follows:
4. If **type** in the passed **want** parameter is specified and is included in **type** under **skills**, the matching is successful. 1. If **action** in the passed **want** parameter is specified and is included in **actions** under **skills** of the ability to match, the matching is successful.
2. If **entities** in the passed **want** parameter is specified and is included in **entities** under **skills** of the ability to match, the matching is successful.
3. If **uri** in the passed **want** parameter is included in **uris** under **skills** of the ability to match, which is concatenated into https://www.test.com:8080/query* (where * is a wildcard), the matching is successful.
4. If **type** in the passed **want** parameter is specified and is included in **type** under **skills** of the ability to match, the matching is successful.
2. When there are multiple matching applications, a dialog box is displayed for you to select one of them. If there are multiple matching applications, the system displays a dialog box for you to select one of them. The following figure shows an example.
![stage-want1](figures/stage-want1.png) ![stage-want1](figures/stage-want1.png)
...@@ -30,7 +30,7 @@ In view of this, OpenHarmony formulates a set of component startup rules, as fol ...@@ -30,7 +30,7 @@ In view of this, OpenHarmony formulates a set of component startup rules, as fol
- An application is considered as a foreground application only when the application process gains focus or its UIAbility component is running in the foreground. - An application is considered as a foreground application only when the application process gains focus or its UIAbility component is running in the foreground.
- Verify the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - Verify the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission.
- **When the startAbilityByCall() method is used, verify the call permission.** For details, see [Using Ability Call to Implement UIAbility Interaction](uiability-intra-device-interaction.md#using-ability-call-to-implement-uiability-interaction) and [Using Cross-Device Ability Call](hop-multi-device-collaboration.md#using-cross-device-ability-call). - **When the startAbilityByCall() method is used, verify the call permission.** For details, see [Using Call to Implement UIAbility Interaction](uiability-intra-device-interaction.md#using-call-to-implement-uiability-interaction) and [Using Cross-Device Call](hop-multi-device-collaboration.md#using-cross-device-call).
- Verify the **ohos.permission.ABILITY_BACKGROUND_COMMUNICATION** permission. - Verify the **ohos.permission.ABILITY_BACKGROUND_COMMUNICATION** permission.
......
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
``` ```
After the PageAbility is created, its abilities-related configuration items are displayed in the **config.json** file. The following is an example **config.json** file of an ability named EntryAbility: After the PageAbility is created, its abilities-related configuration items are displayed in the **config.json** file. The following is an example **config.json** file of an ability named MainAbility:
```json ```json
{ {
...@@ -48,13 +48,13 @@ After the PageAbility is created, its abilities-related configuration items are ...@@ -48,13 +48,13 @@ After the PageAbility is created, its abilities-related configuration items are
], ],
"orientation": "unspecified", "orientation": "unspecified",
"visible": true, "visible": true,
"srcPath": "EntryAbility", "srcPath": "MainAbility",
"name": ".EntryAbility", "name": ".MainAbility",
"srcLanguage": "ets", "srcLanguage": "ets",
"icon": "$media:icon", "icon": "$media:icon",
"description": "$string:EntryAbility_desc", "description": "$string:MainAbility_desc",
"formsEnabled": false, "formsEnabled": false,
"label": "$string:EntryAbility_label", "label": "$string:MainAbility_label",
"type": "page", "type": "page",
"launchType": "singleton" "launchType": "singleton"
} }
...@@ -76,22 +76,22 @@ In the FA model, you can call **getContext** of **featureAbility** to obtain the ...@@ -76,22 +76,22 @@ In the FA model, you can call **getContext** of **featureAbility** to obtain the
The following code snippet shows how to use **getContext()** to obtain the application context and distributed directory: The following code snippet shows how to use **getContext()** to obtain the application context and distributed directory:
```ts ```ts
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility';
import fileIo from '@ohos.fileio' import fs from '@ohos.file.fs';
(async () => { (async () => {
let dir: string let dir: string;
try { try {
console.info('Begin to getOrCreateDistributedDir') console.info('Begin to getOrCreateDistributedDir');
dir = await featureAbility.getContext().getOrCreateDistributedDir() dir = await featureAbility.getContext().getOrCreateDistributedDir();
console.info('distribute dir is ' + dir) console.info('distribute dir is ' + dir)
} catch (error) { } catch (error) {
console.error('getOrCreateDistributedDir failed with ' + error) console.error('getOrCreateDistributedDir failed with ' + error);
} }
let fd: number; let fd: number;
let path = dir + "/a.txt"; let path = dir + "/a.txt";
fd = fileIo.openSync(path, 0o2 | 0o100, 0o666); fd = fs.openSync(path, fs.OpenMode.READ_WRITE).fd;
fileIo.close(fd); fs.close(fd);
})() })()
``` ```
# Using Want to Share Data Between Applications # Using Want to Share Data Between Applications
Users often need to share data (such as a text or an image) from one application to another. The following uses PDF file sharing as an example to describe how to use Want to share data between applications. Users often need to share data (such as a text or an image) from one application to another. The following uses PDF file sharing as an example to describe how to use Want to share data between applications.
Data sharing requires two UIAbility components (one for the sharing party and the other for the shared party) and one system component (used as the application sharing box). When the sharing party initiates data sharing by calling **startAbility()**, the system implicitly matches and displays all applications that support the type of data to share. After the user selects an application, the system starts the application to complete data sharing.
## Prerequisites In this section, data sharing is triggered by touching a button. You can use other ways to trigger data sharing during application development. This section focuses on how to configure Want to implement data sharing.
1. There are two UIAbility components (one for the sharing party and the other for the shared party) and one system component (used as the application selector). When the sharing party initiates data sharing through **startAbility()**, the application selector is started. The system implicitly matches and displays all applications that support the type of data to share. After the user selects an application, the system starts that application to complete data sharing. The following actions are involved for data sharing:
2. In this section, data sharing is triggered by touching a button. You can use other ways to trigger data sharing during application development. This section focuses on the Want configuration used for data sharing. - **ohos.want.action.select**: action of starting the application sharing box.
- **ohos.want.action.sendData**: action of sending a single data record, that is, transferring data to the shared party.
3. The following actions are involved in this section:
- **ACTION_SELECT (ohos.want.action.select)**: action of displaying the application selector. ## Sharing Party
- **ACTION_SEND_DATA (ohos.want.action.sendData)**: action of launching the UI for sending a single data record. It is used to transfer data to the shared party.
The sharing party starts an application sharing box and transfers the data to the shared party. Therefore, Want of the sharing party must be nested at two layers. In the first layer, implicit Want is used together with the **ohos.want.action.select** action to display the application sharing box. In the second layer, the data to share is declared
## How to Develop in the custom field **parameters**, and then the Want that includes the **ohos.want.action.sendData** action and the **parameters** field is transferred to the application sharing box. The shared party obtains the shared data from **parameters**.
- Sharing party ```ts
1. In the stage mode, the [File Descriptor (FD)](../reference/apis/js-apis-fileio.md#fileioopensync) is used for file transfer. This example assumes that the path of the file to share is obtained. import common from '@ohos.app.ability.common';
```ts let fileType = 'application/pdf';
import fileIO from '@ohos.fileio'; let fileName = 'TestFile.pdf';
let fileFd = -1; // Obtain the file descriptor (FD) of the file to share.
// let path = ... let fileSize; // Obtain the size of the file to share.
// Open the file whose path is a variable.
let fileFd = fileIO.openSync(path, 0o102, 0o666); function implicitStartAbility() {
``` let context = getContext(this) as common.UIAbilityContext;
let wantInfo = {
2. As described in the prerequisites, the sharing party starts an application selector and shares the data to the selector, and the selector transfers the data to the shared party. Want of the sharing party must be nested at two layers. At the first layer, implicit Want is used together with the **ohos.want.action.select** action to display the application selector. At the second layer, complete Want is declared in the custom field **parameters** to transfer the data to share. / This action is used to implicitly match the application sharing box.
action: 'ohos.want.action.select',
```ts // This is the custom parameter in the first layer of Want,
import wantConstant from '@ohos.app.ability.wantConstant'; / which is intended to add information to the application sharing box.
parameters: {
// let path = ... // MIME type of PDF.
// let fileFd = ... 'ability.picker.type': fileType,
// let fileSize = ... 'ability.picker.fileNames': [fileName],
let want = { 'ability.picker.fileSizes': [fileSize],
/ This action is used to implicitly match the application selector. // This is nested Want ,which will be directly sent to the selected application.
action: wantConstant.Action.ACTION_SELECT, 'ability.want.params.INTENT': {
// This is the custom parameter in the first layer of Want, 'action': 'ohos.want.action.sendData',
/ which is intended to add information to the application selector. 'type': 'application/pdf',
parameters: { 'parameters': {
// MIME type of PDF. 'keyFd': { 'type': 'FD', 'value': fileFd }
"ability.picker.type": "application/pdf", }
"ability.picker.fileNames": [path],
"ability.picker.fileSizes": [fileSize],
// This nested Want ,which will be directly sent to the selected application.
"ability.want.params.INTENT": {
"action": "ohos.want.action.sendData",
"type": "application/pdf",
"parameters": {
"keyFd": {"type": "FD", "value": fileFd}
}
}
}
} }
``` }
}
In the preceding code, the custom field **parameters** is used. The **ability.picker.\*** fields in the first-layer **parameters** are used to pass the information to be displayed on the application selector. The following fields are involved: context.startAbility(wantInfo).then(() => {
// ...
- **"ability.picker.type"**: The application selector renders the file type icon based on this field. }).catch((err) => {
- **"ability.picker.fileNames"**: The application selector displays the file name based on this field. // ...
- **"ability.picker.fileSizes"**: The application selector displays the file size based on this field. The unit is byte. })
- **"ability.picker.fileNames"** and **"ability.picker.fileSizes"** are arrays and have a one-to-one mapping. }
```
For example, when **"ability.picker.type"** is **"application/pdf"**, **"ability.picker.fileNames"** is **"["APIs.pdf"]"**, and **"ability.picker.fileSizes"** is **"[350 \* 1024]"**, the application selector is displayed as follows:
> **NOTE**
![stage-want2](figures/stage-want2.png) >
> Data sharing can be implemented only in FD format. For details about how to obtain the FD and file name, see [File Management](../reference/apis/js-apis-file-fs.md).
In the preceding code, the **ability.want.params.INTENT** field is nested Want. In this field, **action** and **type** are used for implicit matching by the application selector. For details about implicit matching, see [Matching Rules of Implicit Want](explicit-implicit-want-mappings.md#matching-rules-of-implicit-want). After the user selects an application, the nested Want of the **ability.want.params.INTENT** field is passed to that application.
In the preceding code, under the custom field **parameters**, the following **ability.picker.*** fields are used to pass the information to be displayed on the application sharing box:
- Shared party
1. As mentioned above, the application selector performs implicit matching based on the **ability.want.params.INTENT** field. Therefore, you must set **skills** in the ability configuration file (**module.json5** file in the stage model) of the shared party as follows: - **ability.picker.type**: file type icon.
- **ability.picker.fileNames**: file name.
```ts - **ability.picker.fileSizes**: file size, in bytes.
"skills": [ - **ability.picker.fileNames** and **ability.picker.fileSizes** are arrays and have a one-to-one mapping.
{
"entities": [ The following figure shows an example.
![stage-want2](figures/stage-want2.png)
## Shared Party
To enable the shared party to identify the shared content, configure **skills** in the [module.json5 file](../quick-start/module-configuration-file.md) of the UIAbility of the shared party. The **actions** and **type** fields in **uris** match the **action** and **type** fields in **ability.want.params.INTENT** of the sharing party, respectively.
```json
{
"module": {
// ...
"abilities": [
{
// ...
"skills": [
{
// ... // ...
], "actions": [
"actions": [ "action.system.home",
"ohos.want.action.sendData" "ohos.want.action.sendData"
// ... // ...
], ],
"uris": [ "uris": [
{ {
"type": "application/pdf" "type": "application/pdf"
}, },
// ... ]
] }
}, ]
]
```
The **actions** and **type** fields in **uris** match the **action** and **type** fields in **ability.want.params.INTENT**, respectively.
Files can be transferred in FD mode, but not URI mode. In implicit matching, the **type** field in Want must match the **type** field in **uris** under **skills** of the shared party. Therefore, specify only the **type** field in **uris**. If **host** and **port** are specified, the matching fails. The application selector initiates implicit matching based on **ability.want.params.INTENT**. Therefore, when the **uri** field added to **ability.want.params.INTENT** matches the **uris** field under **skills**, the matching is successful and additional data can be transferred.
2. After the application selector starts the shared party, the system calls **onCreate** and passes **ability.want.params.INTENT** to the **want** parameter.
```ts
onCreate(want, launchParam) {
// When keyFd is undefined, the application crashes.
if (want["parameters"]["keyFd"] !== undefined) {
// Receive the file descriptor.
let fd = want["parameters"]["keyFd"].value;
// ...
}
} }
``` ]
}
}
```
After the user selects an application, the Want nested in the **ability.want.params.INTENT** field is passed to that application. The UIAbility of the shared party, after being started, can call [onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate) or [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonnewwant) to obtain the passed Want.
The following is an example of the Want obtained. You can use the FD of the shared file to perform required operations.
```json
{
"deviceId": "",
"bundleName": "com.example.myapplication",
"abilityName": "EntryAbility",
"moduleName": "entry",
"uri": "",
"type": "application/pdf",
"flags": 0,
"action": "ohos.want.action.sendData",
"parameters": {
"component.startup.newRules": true,
"keyFd": {
"type": "FD",
"value": 36
},
"mime-type": "application/pdf",
"moduleName": "entry",
"ohos.aafwk.param.callerPid": 3488,
"ohos.aafwk.param.callerToken": 537379209,
"ohos.aafwk.param.callerUid": 20010014
},
"entities": []
}
```
...@@ -4,9 +4,6 @@ Both explicit Want and implicit Want can be used to match an ability to start ba ...@@ -4,9 +4,6 @@ Both explicit Want and implicit Want can be used to match an ability to start ba
## Matching Rules of Explicit Want ## Matching Rules of Explicit Want
The table below describes the matching rules of explicit Want.
| Name| Type| Matching Item| Mandatory| Rule Description| | Name| Type| Matching Item| Mandatory| Rule Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| deviceId | string | Yes| No| If this field is unspecified, only abilities on the local device are matched.| | deviceId | string | Yes| No| If this field is unspecified, only abilities on the local device are matched.|
...@@ -22,8 +19,6 @@ The table below describes the matching rules of explicit Want. ...@@ -22,8 +19,6 @@ The table below describes the matching rules of explicit Want.
## Matching Rules for Implicit Want ## Matching Rules for Implicit Want
The table below describes the matching rules of implicit Want.
| Name | Type | Matching Item| Mandatory| Rule Description | | Name | Type | Matching Item| Mandatory| Rule Description |
| ----------- | ------------------------------ | ------ | ---- | ------------------------------------------------------------ | | ----------- | ------------------------------ | ------ | ---- | ------------------------------------------------------------ |
| deviceId | string | Yes | No | Implicit invoking is not supported across devices. | | deviceId | string | Yes | No | Implicit invoking is not supported across devices. |
...@@ -37,8 +32,9 @@ The table below describes the matching rules of implicit Want. ...@@ -37,8 +32,9 @@ The table below describes the matching rules of implicit Want.
| flags | number | No | No | This field is not used for matching and is directly transferred to the system for processing. It is generally used to set runtime information, such as URI data authorization.| | flags | number | No | No | This field is not used for matching and is directly transferred to the system for processing. It is generally used to set runtime information, such as URI data authorization.|
| parameters | {[key:&nbsp;string]:&nbsp;any} | No | No | This field is not used for matching. It is passed to the target ability as a parameter. | | parameters | {[key:&nbsp;string]:&nbsp;any} | No | No | This field is not used for matching. It is passed to the target ability as a parameter. |
Get familiar with the following about implicit Want:
## Interpretation of Implicit Want Matching Rules
Get familiar with the following about implicit Want:
- The **want** parameter passed by the caller indicates the operation to be performed by the caller. It also provides data and application type restrictions. - The **want** parameter passed by the caller indicates the operation to be performed by the caller. It also provides data and application type restrictions.
...@@ -50,7 +46,7 @@ The system matches the **want** parameter (including the **action**, **entities* ...@@ -50,7 +46,7 @@ The system matches the **want** parameter (including the **action**, **entities*
### Matching Rules of action in the want Parameter ### Matching Rules of action in the want Parameter
The system matches the [action](../reference/apis/js-apis-ability-wantConstant.md#wantconstantaction) attribute in the **want** parameter passed by the caller against **actions** under **skills** of the abilities. The system matches the **action** attribute in the **want** parameter passed by the caller against **actions** under **skills** of the abilities.
- If **action** in the passed **want** parameter is specified but **actions** under **skills** of an ability is unspecified, the matching fails. - If **action** in the passed **want** parameter is specified but **actions** under **skills** of an ability is unspecified, the matching fails.
...@@ -60,14 +56,14 @@ The system matches the [action](../reference/apis/js-apis-ability-wantConstant.m ...@@ -60,14 +56,14 @@ The system matches the [action](../reference/apis/js-apis-ability-wantConstant.m
- If **action** in the passed **want** parameter is specified, and **actions** under **skills** of an ability is specified but does not contain **action** in the passed **want** parameter, the matching fails. - If **action** in the passed **want** parameter is specified, and **actions** under **skills** of an ability is specified but does not contain **action** in the passed **want** parameter, the matching fails.
**Figure 1** Matching rules of action in the want parameter **Figure 1** Matching rules of action in the want parameter
![want-action](figures/want-action.png) ![want-action](figures/want-action.png)
### Matching Rules of entities in the want Parameter ### Matching Rules of entities in the want Parameter
The system matches the [entities](../reference/apis/js-apis-ability-wantConstant.md#wantconstantentity) attribute in the **want** parameter passed by the caller against **entities** under **skills** of the abilities. The system matches the **entities** attribute in the **want** parameter passed by the caller against **entities** under **skills** of the abilities.
- If **entities** in the passed **want** parameter is unspecified but **entities** under **skills** of an ability is specified, the matching is successful. - If **entities** in the passed **want** parameter is unspecified but **entities** under **skills** of an ability is specified, the matching is successful.
...@@ -79,19 +75,15 @@ The system matches the [entities](../reference/apis/js-apis-ability-wantConstant ...@@ -79,19 +75,15 @@ The system matches the [entities](../reference/apis/js-apis-ability-wantConstant
- If **entities** in the passed **want** parameter is specified, and **entities** under **skills** of an ability is specified but does not contain **entities** in the passed **want** parameter, the matching fails. - If **entities** in the passed **want** parameter is specified, and **entities** under **skills** of an ability is specified but does not contain **entities** in the passed **want** parameter, the matching fails.
Figure 2 Matching rule of entities in the want parameter **Figure 2** Matching rule of entities in the want parameter
![want-entities](figures/want-entities.png) ![want-entities](figures/want-entities.png)
### Matching Rules of uri and type in the want Parameter ### Matching Rules of uri and type in the want Parameter
When the **uri** and **type** parameters are specified in the **want** parameter to initiate a component startup request, the system traverses the list of installed components and matches the **uris** array under **skills** of the abilities one by one. If one of the **uris** arrays under **skills** matches the **uri** and **type** in the passed **want**, the matching is successful. When the **uri** and **type** parameters are specified in the **want** parameter to initiate a component startup request, the system traverses the list of installed components and matches the **uris** array under **skills** of the abilities one by one. If one of the **uris** arrays under **skills** matches the **uri** and **type** in the passed **want**, the matching is successful.
Figure 3 Matching rules when uri and type are specified in the want parameter
![want-uri-type1](figures/want-uri-type1.png)
There are four combinations of **uri** and **type** settings. The matching rules are as follows: There are four combinations of **uri** and **type** settings. The matching rules are as follows:
- Neither **uri** or **type** is specified in the **want** parameter. - Neither **uri** or **type** is specified in the **want** parameter.
...@@ -111,13 +103,19 @@ There are four combinations of **uri** and **type** settings. The matching rules ...@@ -111,13 +103,19 @@ There are four combinations of **uri** and **type** settings. The matching rules
- If the **uris** array under **skills** of an ability is unspecified, the matching fails. - If the **uris** array under **skills** of an ability is unspecified, the matching fails.
- If the **uris** array under **skills** of an ability contains an element whose [uri is matched](#matching-rules-of-uri) and [type is matched](#matching-rules-of-type), the matching is successful. Otherwise, the matching fails. - If the **uris** array under **skills** of an ability contains an element whose [uri is matched](#matching-rules-of-uri) and [type is matched](#matching-rules-of-type), the matching is successful. Otherwise, the matching fails.
Leftmost URI matching: When only **scheme**, a combination of **scheme** and **host**, or a combination of **scheme**, **host**, and **port** is configured in the **uris** array under **skills** of the ability,
the matching is successful only if the leftmost URI in the passed **want** parameter matches **scheme**, the combination of **scheme** and **host**, or the combination of **scheme**, **host**, and **port**.
To simplify the description, **uri** and **type** passed in the **want** parameter are called **w_uri** and **w_type**, respectively; the **uris** array under **skills** of an ability to match is called **s_uris**; each element in the array is called **s_uri**. Matching is performed from top to bottom. **Figure 3** Matching rules when uri and type are specified in the want parameter
![want-uri-type1](figures/want-uri-type1.png)
Figure 4 Matching rules of uri and type in the want parameter To simplify the description, **uri** and **type** passed in the **want** parameter are called **w_uri** and **w_type**, respectively; the **uris** array under **skills** of an ability to match is called **s_uris**; each element in the array is called **s_uri**. Matching is performed from top to bottom.
**Figure 4** Matching rules of uri and type in the want parameter
![want-uri-type2](figures/want-uri-type2.png) ![want-uri-type2](figures/want-uri-type2.png)
### Matching Rules of uri ### Matching Rules of uri
...@@ -128,7 +126,9 @@ To simplify the description, **uri** in the passed **want** parameter is called ...@@ -128,7 +126,9 @@ To simplify the description, **uri** in the passed **want** parameter is called
- If **host** of **s_uri** is unspecified and **scheme** of **w_uri** and **scheme** of **s_uri** are the same, the matching is successful. Otherwise, the matching fails. - If **host** of **s_uri** is unspecified and **scheme** of **w_uri** and **scheme** of **s_uri** are the same, the matching is successful. Otherwise, the matching fails.
- If **path**, **pathStartWith**, and **pathRegex** of **s_uri** are unspecified and **w_uri** and **s_uri** are the same, the matching is successful. Otherwise, the matching fails. - If **port** of **s_uri** is unspecified and the combination of **scheme** and **host** of **w_uri** is the same as the combination of **scheme** and **host** of **s_uri**, the matching is successful. Otherwise, the matching fails.
- If **path**, **pathStartWith**, and **pathRegex** of **s_uri** are unspecified and the combination of **scheme**, **host**, and **port** of **w_uri** is the same as the combination of **scheme**, **host**, and **port** of **s_uri**, the matching is successful. Otherwise, the matching fails.
- If **path** of **s_uri** is specified and the **full path expressions** of **w_uri** and **s_uri** are the same, the matching is successful. Otherwise, the matching of **pathStartWith** continues. - If **path** of **s_uri** is specified and the **full path expressions** of **w_uri** and **s_uri** are the same, the matching is successful. Otherwise, the matching of **pathStartWith** continues.
...@@ -139,12 +139,17 @@ To simplify the description, **uri** in the passed **want** parameter is called ...@@ -139,12 +139,17 @@ To simplify the description, **uri** in the passed **want** parameter is called
> **NOTE** > **NOTE**
> >
> The **scheme**, **host**, **port**, **path**, **pathStartWith**, and **pathRegex** attributes of **uris** under **skills** of an ability are concatenated. If **path**, **pathStartWith**, and **pathRegex** are declared in sequence, **uris** can be concatenated into the following expressions: > The **scheme**, **host**, **port**, **path**, **pathStartWith**, and **pathRegex** attributes of **uris** under **skills** of an ability are concatenated. If **path**, **pathStartWith**, and **pathRegex** are declared in sequence, **uris** can be concatenated into the following expressions:
>
> - **Full path expression**: scheme://host:port/path
>
> - **Prefix expression**: scheme://host:port/pathStartWith
>
> - **Regular expression**: scheme://host:port/pathRegex
> >
> - **Full path expression**: `scheme://host:port/path` > - **Prefix URI expression**: When only **scheme**, a combination of **scheme** and **host**, or a combination of **scheme**, **host**, and **port** is configured in the configuration file, the matching is successful if a URI prefixed with the configuration file is passed in.
> > * `scheme://`
> - **Prefix expression**: `scheme://host:port/pathStartWith` > * `scheme://host`
> > * `scheme://host:port`
> - **Regular expression**: `scheme://host:port/pathRegex`
### Matching Rules of type ### Matching Rules of type
......
# Cross-Device Migration (for System Applications Only)] # Cross-Device Migration (for System Applications Only)
## When to Use ## When to Use
......
...@@ -11,7 +11,7 @@ Multi-device coordination involves the following scenarios: ...@@ -11,7 +11,7 @@ Multi-device coordination involves the following scenarios:
- [Connecting to ServiceExtensionAbility Across Devices](#connecting-to-serviceextensionability-across-devices) - [Connecting to ServiceExtensionAbility Across Devices](#connecting-to-serviceextensionability-across-devices)
- [Using Cross-Device Ability Call](#using-cross-device-ability-call) - [Using Cross-Device Call](#using-cross-device-call)
## Multi-Device Collaboration Process ## Multi-Device Collaboration Process
...@@ -102,7 +102,7 @@ On device A, touch the **Start** button provided by the initiator application to ...@@ -102,7 +102,7 @@ On device A, touch the **Start** button provided by the initiator application to
abilityName: 'FuncAbility', abilityName: 'FuncAbility',
moduleName: 'module1', // moduleName is optional. moduleName: 'module1', // moduleName is optional.
} }
// context is the ability-level context of the initiator UIAbility. // context is the AbilityContext of the initiator UIAbility.
this.context.startAbility(want).then(() => { this.context.startAbility(want).then(() => {
// ... // ...
}).catch((err) => { }).catch((err) => {
...@@ -118,7 +118,7 @@ On device A, touch the **Start** button provided by the initiator application to ...@@ -118,7 +118,7 @@ On device A, touch the **Start** button provided by the initiator application to
### Available APIs ### Available APIs
**Table 2** APIs for starting an ability across devices and returning the result data **Table 2** APIs for starting a UIAbility across devices and returning the result data
| API| Description| | API| Description|
| -------- | -------- | | -------- | -------- |
...@@ -154,7 +154,7 @@ On device A, touch the **Start** button provided by the initiator application to ...@@ -154,7 +154,7 @@ On device A, touch the **Start** button provided by the initiator application to
abilityName: 'FuncAbility', abilityName: 'FuncAbility',
moduleName: 'module1', // moduleName is optional. moduleName: 'module1', // moduleName is optional.
} }
// context is the ability-level context of the initiator UIAbility. // context is the AbilityContext of the initiator UIAbility.
this.context.startAbilityForResult(want).then((data) => { this.context.startAbilityForResult(want).then((data) => {
// ... // ...
}).catch((err) => { }).catch((err) => {
...@@ -174,7 +174,7 @@ On device A, touch the **Start** button provided by the initiator application to ...@@ -174,7 +174,7 @@ On device A, touch the **Start** button provided by the initiator application to
moduleName: 'module1', moduleName: 'module1',
}, },
} }
// context is the ability-level context of the target UIAbility. // context is the AbilityContext of the target UIAbility.
this.context.terminateSelfWithResult(abilityResult, (err) => { this.context.terminateSelfWithResult(abilityResult, (err) => {
// ... // ...
}); });
...@@ -187,7 +187,7 @@ On device A, touch the **Start** button provided by the initiator application to ...@@ -187,7 +187,7 @@ On device A, touch the **Start** button provided by the initiator application to
// ... // ...
// context is the ability-level context of the initiator UIAbility. // context is the UIAbilityContext of the initiator UIAbility.
this.context.startAbilityForResult(want).then((data) => { this.context.startAbilityForResult(want).then((data) => {
if (data?.resultCode === RESULT_CODE) { if (data?.resultCode === RESULT_CODE) {
// Parse the information returned by the target UIAbility. // Parse the information returned by the target UIAbility.
...@@ -315,24 +315,24 @@ A system application can connect to a service on another device by calling [conn ...@@ -315,24 +315,24 @@ A system application can connect to a service on another device by calling [conn
``` ```
## Using Cross-Device Ability Call ## Using Cross-Device Call
The basic principle of cross-device ability call is the same as that of intra-device ability call. For details, see [Using Ability Call to Implement UIAbility Interaction (for System Applications Only)](uiability-intra-device-interaction.md#using-ability-call-to-implement-uiability-interaction-for-system-applications-only). The basic principle of cross-device call is the same as that of intra-device call. For details, see [Using Call to Implement UIAbility Interaction (for System Applications Only)](uiability-intra-device-interaction.md#using-call-to-implement-uiability-interaction-for-system-applications-only).
The following describes how to implement multi-device collaboration through cross-device ability call. The following describes how to implement multi-device collaboration through cross-device call.
### Available APIs ### Available APIs
**Table 4** Ability call APIs **Table 4** Call APIs
| API| Description| | API| Description|
| -------- | -------- | | -------- | -------- |
| startAbilityByCall(want: Want): Promise&lt;Caller&gt;; | Starts a UIAbility in the foreground or background and obtains the caller object for communicating with the UIAbility.| | startAbilityByCall(want: Want): Promise&lt;Caller&gt;; | Starts a UIAbility in the foreground or background and obtains the caller object for communicating with the UIAbility.|
| on(method: string, callback: CalleeCallBack): void | Callback invoked when the callee ability registers a method.| | on(method: string, callback: CalleeCallBack): void | Callback invoked when the CalleeAbility registers a method.|
| off(method: string): void | Callback invoked when the callee ability deregisters a method.| | off(method: string): void | Callback invoked when the CalleeAbility deregisters a method.|
| call(method: string, data: rpc.Parcelable): Promise&lt;void&gt; | Sends agreed parcelable data to the callee ability.| | call(method: string, data: rpc.Parcelable): Promise&lt;void&gt; | Sends agreed parcelable data to the CalleeAbility.|
| callWithResult(method: string, data: rpc.Parcelable): Promise&lt;rpc.MessageSequence&gt; | Sends agreed parcelable data to the callee ability and obtains the agreed parcelable data returned by the callee ability.| | callWithResult(method: string, data: rpc.Parcelable): Promise&lt;rpc.MessageSequence&gt; | Sends agreed parcelable data to the CalleeAbility and obtains the agreed parcelable data returned by the CalleeAbility.|
| release(): void | Releases the caller object.| | release(): void | Releases the caller object.|
| on(type: "release", callback: OnReleaseCallback): void | Callback invoked when the caller object is released.| | on(type: "release", callback: OnReleaseCallback): void | Callback invoked when the caller object is released.|
...@@ -367,17 +367,17 @@ The following describes how to implement multi-device collaboration through cros ...@@ -367,17 +367,17 @@ The following describes how to implement multi-device collaboration through cros
} }
``` ```
3. Create the callee ability. 3. Create the CalleeAbility.
For the callee ability, implement the callback to receive data and the methods to marshal and unmarshal data. When data needs to be received, use **on()** to register a listener. When data does not need to be received, use **off()** to deregister the listener. For the CalleeAbility, implement the callback to receive data and the methods to marshal and unmarshal data. When data needs to be received, use **on()** to register a listener. When data does not need to be received, use **off()** to deregister the listener.
1. Configure the launch type of the UIAbility. 1. Configure the launch type of the UIAbility.
Set **launchType** of the callee ability to **singleton** in the **module.json5** file. Set **launchType** of the CalleeAbility to **singleton** in the **module.json5** file.
| JSON Field| Description| | JSON Field| Description|
| -------- | -------- | | -------- | -------- |
| "launchType"| Ability launch type. Set this parameter to **singleton**.| | "launchType"| UIAbility launch type. Set this parameter to **singleton**.|
An example of the UIAbility configuration is as follows: An example of the UIAbility configuration is as follows:
...@@ -401,7 +401,7 @@ The following describes how to implement multi-device collaboration through cros ...@@ -401,7 +401,7 @@ The following describes how to implement multi-device collaboration through cros
3. Define the agreed parcelable data. 3. Define the agreed parcelable data.
The data formats sent and received by the caller and callee abilities must be consistent. In the following example, the data formats are number and string. The data formats sent and received by the CallerAbility and CalleeAbility must be consistent. In the following example, the data formats are number and string.
```ts ```ts
export default class MyParcelable { export default class MyParcelable {
...@@ -438,13 +438,13 @@ The following describes how to implement multi-device collaboration through cros ...@@ -438,13 +438,13 @@ The following describes how to implement multi-device collaboration through cros
function sendMsgCallback(data) { function sendMsgCallback(data) {
console.info('CalleeSortFunc called') console.info('CalleeSortFunc called')
// Obtain the parcelable data sent by the caller ability. // Obtain the parcelable data sent by the CallerAbility.
let receivedData = new MyParcelable(0, '') let receivedData = new MyParcelable(0, '')
data.readParcelable(receivedData) data.readParcelable(receivedData)
console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`) console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`)
// Process the data. // Process the data.
// Return the parcelable data result to the caller ability. // Return the parcelable data result to the CallerAbility.
return new MyParcelable(receivedData.num + 1, `send ${receivedData.str} succeed`) return new MyParcelable(receivedData.num + 1, `send ${receivedData.str} succeed`)
} }
...@@ -467,7 +467,7 @@ The following describes how to implement multi-device collaboration through cros ...@@ -467,7 +467,7 @@ The following describes how to implement multi-device collaboration through cros
} }
``` ```
4. Obtain the caller object and access the callee ability. 4. Obtain the caller object and access the CalleeAbility.
1. Import the **UIAbility** module. 1. Import the **UIAbility** module.
```ts ```ts
...@@ -476,7 +476,7 @@ The following describes how to implement multi-device collaboration through cros ...@@ -476,7 +476,7 @@ The following describes how to implement multi-device collaboration through cros
2. Obtain the caller object. 2. Obtain the caller object.
The **context** attribute of the ability implements **startAbilityByCall** to obtain the caller object for communication. The following example uses **this.context** to obtain the **context** attribute of the ability, uses **startAbilityByCall** to start the callee ability, obtain the caller object, and register the **onRelease** listener of the caller ability. You need to implement processing based on service requirements. The **context** attribute of the UIAbility implements **startAbilityByCall** to obtain the caller object for communication. The following example uses **this.context** to obtain the **context** attribute of the UIAbility, uses **startAbilityByCall** to start the CalleeAbility, obtain the caller object, and register the **onRelease** listener of the CallerAbility. You need to implement processing based on service requirements.
```ts ```ts
async onButtonGetRemoteCaller() { async onButtonGetRemoteCaller() {
...@@ -491,7 +491,7 @@ The following describes how to implement multi-device collaboration through cros ...@@ -491,7 +491,7 @@ The following describes how to implement multi-device collaboration through cros
if (data != null) { if (data != null) {
caller = data caller = data
console.info('get remote caller success') console.info('get remote caller success')
// 注册caller的release监听 // Register the onRelease listener of the CallerAbility.
caller.onRelease((msg) => { caller.onRelease((msg) => {
console.info(`remote caller onRelease is called ${msg}`) console.info(`remote caller onRelease is called ${msg}`)
}) })
...@@ -505,8 +505,8 @@ The following describes how to implement multi-device collaboration through cros ...@@ -505,8 +505,8 @@ The following describes how to implement multi-device collaboration through cros
For details about how to implement **getRemoteDeviceId()**, see [Starting UIAbility and ServiceExtensionAbility Across Devices (No Data Returned)](#starting-uiability-and-serviceextensionability-across-devices-no-data-returned). For details about how to implement **getRemoteDeviceId()**, see [Starting UIAbility and ServiceExtensionAbility Across Devices (No Data Returned)](#starting-uiability-and-serviceextensionability-across-devices-no-data-returned).
5. Sends agreed parcelable data to the callee ability. 5. Sends agreed parcelable data to the CalleeAbility.
1. The parcelable data can be sent to the callee ability with or without a return value. The method and parcelable data must be consistent with those of the callee ability. The following example describes how to send data to the callee ability. 1. The parcelable data can be sent to the CalleeAbility with or without a return value. The method and parcelable data must be consistent with those of the CalleeAbility. The following example describes how to send data to the CalleeAbility.
```ts ```ts
const MSG_SEND_METHOD: string = 'CallSendMsg' const MSG_SEND_METHOD: string = 'CallSendMsg'
...@@ -520,7 +520,7 @@ The following describes how to implement multi-device collaboration through cros ...@@ -520,7 +520,7 @@ The following describes how to implement multi-device collaboration through cros
} }
``` ```
2. In the following, **CallWithResult** is used to send data **originMsg** to the callee ability and assign the data processed by the **CallSendMsg** method to **backMsg**. 2. In the following, **CallWithResult** is used to send data **originMsg** to the CalleeAbility and assign the data processed by the **CallSendMsg** method to **backMsg**.
```ts ```ts
const MSG_SEND_METHOD: string = 'CallSendMsg' const MSG_SEND_METHOD: string = 'CallSendMsg'
......
...@@ -28,10 +28,10 @@ Missions are managed by system applications (such as home screen), rather than t ...@@ -28,10 +28,10 @@ Missions are managed by system applications (such as home screen), rather than t
- Switch a mission to the foreground. - Switch a mission to the foreground.
A UIAbility instance corresponds to an independent mission. Therefore, when an application calls the **startAbility()** method to start a UIAbility, a mission is created. A UIAbility instance corresponds to an independent mission. Therefore, when an application calls **startAbility()** to start a UIAbility, a mission is created.
To call [missionManager](../reference/apis/js-apis-application-missionManager.md) to manage missions, the home screen application must request the **ohos.permission.MANAGE_MISSIONS** permission. For details about the configuration, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). To call [missionManager](../reference/apis/js-apis-application-missionManager.md) to manage missions, the home screen application must request the **ohos.permission.MANAGE_MISSIONS** permission. For details about the configuration, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file).
You can use **missionManager** to manage missions, for example, listening for mission changes, obtaining mission information or snapshots, and clearing, locking, or unlocking missions. The sample code is as follows: You can use **missionManager** to manage missions, for example, listening for mission changes, obtaining mission information or snapshots, and clearing, locking, or unlocking missions. The sample code is as follows:
......
...@@ -77,9 +77,9 @@ The **specified** mode is used in some special scenarios. For example, in a docu ...@@ -77,9 +77,9 @@ The **specified** mode is used in some special scenarios. For example, in a docu
![uiability-launch-type2](figures/uiability-launch-type2.png) ![uiability-launch-type2](figures/uiability-launch-type2.png)
For example, there are EntryAbility and SpecifiedAbility, and the launch type of SpecifiedAbility is set to **specified**. You are required to start SpecifiedAbility from EntryAbility. For example, there are two UIAbility components: EntryAbility and SpecifiedAbility (with the launch type **specified**). You are required to start SpecifiedAbility from EntryAbility.
1. In SpecifiedAbility, set the **launchType** field in the [module.json5 configuration file](../quick-start/module-configuration-file.md) to **specified**. 1. In SpecifiedAbility, set the **launchType** field in the [module.json5 file](../quick-start/module-configuration-file.md) to **specified**.
```json ```json
{ {
...@@ -95,8 +95,7 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of ...@@ -95,8 +95,7 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of
} }
``` ```
2. Before a UIAbility instance is created, you can create a unique string key for the instance. The key is bound to the UIAbility instance when it is created. Each time [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called, the application is asked which UIAbility instance is used to respond to the [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) request. 2. Create a unique string key for the instance. Each time [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called, the application, based on the key, identifies the UIAbility instance used to respond to the request. In EntryAbility, add a custom parameter, for example, **instanceKey**, to the [want](want-overview.md) parameter in [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) to distinguish the UIAbility instance.
In EntryAbility, add a custom parameter, for example, **instanceKey**, to the [want](want-overview.md) parameter in [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) to distinguish the UIAbility instances.
```ts ```ts
// Configure an independent key for each UIAbility instance. // Configure an independent key for each UIAbility instance.
...@@ -114,7 +113,7 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of ...@@ -114,7 +113,7 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of
instanceKey: getInstance(), instanceKey: getInstance(),
}, },
} }
// context is the ability-level context of the initiator UIAbility. // context is the UIAbilityContext of the initiator UIAbility.
this.context.startAbility(want).then(() => { this.context.startAbility(want).then(() => {
// ... // ...
}).catch((err) => { }).catch((err) => {
...@@ -133,7 +132,7 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of ...@@ -133,7 +132,7 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of
// In the AbilityStage instance of the callee, a key value corresponding to a UIAbility instance is returned for UIAbility whose launch type is specified. // In the AbilityStage instance of the callee, a key value corresponding to a UIAbility instance is returned for UIAbility whose launch type is specified.
// In this example, SpecifiedAbility of module1 is returned. // In this example, SpecifiedAbility of module1 is returned.
if (want.abilityName === 'SpecifiedAbility') { if (want.abilityName === 'SpecifiedAbility') {
// The returned string key is a custom string. // The returned key string is a custom string.
return `SpecifiedAbilityInstance_${want.parameters.instanceKey}`; return `SpecifiedAbilityInstance_${want.parameters.instanceKey}`;
} }
...@@ -147,16 +146,13 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of ...@@ -147,16 +146,13 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of
> 1. Assume that the application already has a UIAbility instance created, and the launch type of the UIAbility instance is set to **specified**. If [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called again to start the UIAbility instance, and the [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant) callback of [AbilityStage](../reference/apis/js-apis-app-ability-abilityStage.md) matches a created UIAbility instance, the original UIAbility instance is started, and no new UIAbility instance is created. In this case, the [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) callback is invoked, but the [onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate) and [onWindowStageCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonwindowstagecreate) callbacks are not. > 1. Assume that the application already has a UIAbility instance created, and the launch type of the UIAbility instance is set to **specified**. If [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called again to start the UIAbility instance, and the [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant) callback of [AbilityStage](../reference/apis/js-apis-app-ability-abilityStage.md) matches a created UIAbility instance, the original UIAbility instance is started, and no new UIAbility instance is created. In this case, the [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) callback is invoked, but the [onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate) and [onWindowStageCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonwindowstagecreate) callbacks are not.
> 2. AbilityStage is not automatically generated in the default project of DevEco Studio. For details about how to create an AbilityStage file, see [AbilityStage Component Container](abilitystage.md). > 2. AbilityStage is not automatically generated in the default project of DevEco Studio. For details about how to create an AbilityStage file, see [AbilityStage Component Container](abilitystage.md).
For example, in the document application, different key values are bound to different document instances. Each time a document is created, a new key value (for example, file path) is passed, and a new UIAbility instance is created when UIAbility is started in AbilityStage. However, when you open an existing document, the same UIAbility instance is started again in AbilityStage. For example, in the document application, different keys are bound to different document instances. Each time a document is created, a new key (for example, file path) is passed, and a new UIAbility instance is created when UIAbility is started in AbilityStage. However, when you open an existing document, the same UIAbility instance is started again in AbilityStage.
The following steps are used as an example.
The following steps are used as an example.
1. Open file A. A UIAbility instance, for example, UIAbility instance 1, is started. 1. Open file A. A UIAbility instance, for example, UIAbility instance 1, is started.
2. Close the process of file A in **Recents**. UIAbility instance 1 is destroyed. Return to the home screen and open file A again. A new UIAbility instance is started, for example, UIAbility instance 2. 2. Close the process of file A in **Recents**. UIAbility instance 1 is destroyed. Return to the home screen and open file A again. A new UIAbility instance is started, for example, UIAbility instance 2.
3. Return to the home screen and open file B. A new UIAbility instance is started, for example, UIAbility instance 3. 3. Return to the home screen and open file B. A new UIAbility instance is started, for example, UIAbility instance 3.
4. Return to the home screen and open file A again. UIAbility instance 2 is started. 4. Return to the home screen and open file A again. UIAbility instance 2 is started.
\ No newline at end of file
...@@ -256,7 +256,7 @@ struct MyComponent { ...@@ -256,7 +256,7 @@ struct MyComponent {
this.data.pushData('/path/image' + this.data.totalCount() + '.png') this.data.pushData('/path/image' + this.data.totalCount() + '.png')
}) })
}, item => item) }, item => item)
} }.height('100%').width('100%')
} }
} }
``` ```
......
...@@ -83,7 +83,7 @@ struct bindPopupPage { ...@@ -83,7 +83,7 @@ struct bindPopupPage {
} }
``` ```
![datePicker](../../application-dev/reference/arkui-ts/figures/datePicker.gif) ![datePicker](figures/restrictions-data-type-declarations.gif)
2. The data type declaration of the **@State**, **@Provide**, **@Link**, or **@Consume** decorated state variables can consist of only one of the primitive data types or reference data types. 2. The data type declaration of the **@State**, **@Provide**, **@Link**, or **@Consume** decorated state variables can consist of only one of the primitive data types or reference data types.
...@@ -232,3 +232,26 @@ struct Child { ...@@ -232,3 +232,26 @@ struct Child {
} }
} }
``` ```
## Restrictions on Naming Custom Components, Classes, and Functions
The name of a custom component, class, or function cannot be the same as any system component name.
Example:
```
// Rect.ets
export class Rect {
constructor(){}
}
// Index.ets
// ERROR: The module name 'Rect' can not be the same as the inner component name.
import { Rect } from './Rect';
@Entry
@Component
struct Index {
build() {
}
}
```
...@@ -11,7 +11,7 @@ Indicates that the user has finished booting and the system has been loaded. ...@@ -11,7 +11,7 @@ Indicates that the user has finished booting and the system has been loaded.
- Required subscriber permissions: ohos.permission.RECEIVER_STARTUP_COMPLETED - Required subscriber permissions: ohos.permission.RECEIVER_STARTUP_COMPLETED
## COMMON_EVENT_LOCKED_BOOT_COMPLETED ## COMMON_EVENT_LOCKED_BOOT_COMPLETED
(Reserved, not supported yet) Indicates that the user has finished booting and the system has been loaded but the screen is still locked. (Deprecated) Indicates that the user has finished booting and the system has been loaded but the screen is still locked.
- Value: **usual.event.LOCKED_BOOT_COMPLETED** - Value: **usual.event.LOCKED_BOOT_COMPLETED**
- Required subscriber permissions: ohos.permission.RECEIVER_STARTUP_COMPLETED - Required subscriber permissions: ohos.permission.RECEIVER_STARTUP_COMPLETED
...@@ -59,14 +59,14 @@ Indicates that the device screen is on and the device is in interactive state. ...@@ -59,14 +59,14 @@ Indicates that the device screen is on and the device is in interactive state.
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_THERMAL_LEVEL_CHANGED<sup>8+</sup> ## COMMON_EVENT_THERMAL_LEVEL_CHANGED
Indicates that the device's thermal level has changed. Indicates that the device's thermal level has changed.
- Value: **usual.event.THERMAL_LEVEL_CHANGED** - Value: **usual.event.THERMAL_LEVEL_CHANGED**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_USER_PRESENT ## COMMON_EVENT_USER_PRESENT
(Reserved, not supported yet) Indicates that the user unlocks the device. (Deprecated) Indicates that the user unlocks the device.
- Value: **usual.event.USER_PRESENT** - Value: **usual.event.USER_PRESENT**
- Required subscriber permissions: none - Required subscriber permissions: none
...@@ -84,7 +84,7 @@ Indicates that the system time is set. ...@@ -84,7 +84,7 @@ Indicates that the system time is set.
## COMMON_EVENT_DATE_CHANGED ## COMMON_EVENT_DATE_CHANGED
(Reserved, not supported yet) Indicates that the system date has changed. (Deprecated) Indicates that the system date has changed.
- Value: **usual.event.DATE_CHANGED** - Value: **usual.event.DATE_CHANGED**
- Required subscriber permissions: none - Required subscriber permissions: none
...@@ -96,7 +96,7 @@ Indicates that the system time zone has changed. ...@@ -96,7 +96,7 @@ Indicates that the system time zone has changed.
## COMMON_EVENT_CLOSE_SYSTEM_DIALOGS ## COMMON_EVENT_CLOSE_SYSTEM_DIALOGS
(Reserved, not supported yet) Indicates that the user closes a temporary system dialog box. (Deprecated) Indicates that the user closes a temporary system dialog box.
- Value: **usual.event.CLOSE_SYSTEM_DIALOGS** - Value: **usual.event.CLOSE_SYSTEM_DIALOGS**
- Required subscriber permissions: none - Required subscriber permissions: none
...@@ -108,13 +108,13 @@ Indicates that a new application package has been installed on the device. ...@@ -108,13 +108,13 @@ Indicates that a new application package has been installed on the device.
## COMMON_EVENT_PACKAGE_REPLACED ## COMMON_EVENT_PACKAGE_REPLACED
(Reserved, not supported yet) Indicates that a later version of an installed application package has replaced the previous one on the device. (Deprecated) Indicates that a later version of an installed application package has replaced the previous one on the device.
- Value: **usual.event.PACKAGE_REPLACED** - Value: **usual.event.PACKAGE_REPLACED**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_MY_PACKAGE_REPLACED ## COMMON_EVENT_MY_PACKAGE_REPLACED
(Reserved, not supported yet) Indicates that a later version of your application package has replaced the previous one. (Deprecated) Indicates that a later version of your application package has replaced the previous one.
- Value: **usual.event.MY_PACKAGE_REPLACED** - Value: **usual.event.MY_PACKAGE_REPLACED**
- Required subscriber permissions: none - Required subscriber permissions: none
...@@ -125,13 +125,13 @@ Indicates that an installed application has been uninstalled from the device wit ...@@ -125,13 +125,13 @@ Indicates that an installed application has been uninstalled from the device wit
## COMMON_EVENT_BUNDLE_REMOVED ## COMMON_EVENT_BUNDLE_REMOVED
(Reserved, not supported yet) Indicates that an installed bundle has been uninstalled from the device with the application data retained. (Deprecated) Indicates that an installed bundle has been uninstalled from the device with the application data retained.
- Value: **usual.event.BUNDLE_REMOVED** - Value: **usual.event.BUNDLE_REMOVED**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_FULLY_REMOVED ## COMMON_EVENT_PACKAGE_FULLY_REMOVED
(Reserved, not supported yet) Indicates that an installed application, including both the application data and code, has been completely uninstalled from the device. (Deprecated) Indicates that an installed application, including both the application data and code, has been completely uninstalled from the device.
- Value: **usual.event.PACKAGE_FULLY_REMOVED** - Value: **usual.event.PACKAGE_FULLY_REMOVED**
- Required subscriber permissions: none - Required subscriber permissions: none
...@@ -161,79 +161,79 @@ Indicates that the user cleared the application package cache. ...@@ -161,79 +161,79 @@ Indicates that the user cleared the application package cache.
## COMMON_EVENT_PACKAGES_SUSPENDED ## COMMON_EVENT_PACKAGES_SUSPENDED
(Reserved, not supported yet) Indicates that application HAP files are suspended. (Deprecated) Indicates that application HAP files are suspended.
- Value: **usual.event.PACKAGES_SUSPENDED** - Value: **usual.event.PACKAGES_SUSPENDED**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_PACKAGES_UNSUSPENDED ## COMMON_EVENT_PACKAGES_UNSUSPENDED
(Reserved, not supported yet) Indicates that application HAP files are not suspended (restored from the suspended state). (Deprecated) Indicates that application HAP files are not suspended (restored from the suspended state).
- Value: **usual.event.PACKAGES_UNSUSPENDED** - Value: **usual.event.PACKAGES_UNSUSPENDED**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_MY_PACKAGE_SUSPENDED ## COMMON_EVENT_MY_PACKAGE_SUSPENDED
Indicates that an application HAP file is suspended. (Deprecated) Indicates that an application HAP file is suspended.
- Value: **usual.event.MY_PACKAGE_SUSPENDED** - Value: **usual.event.MY_PACKAGE_SUSPENDED**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_MY_PACKAGE_UNSUSPENDED ## COMMON_EVENT_MY_PACKAGE_UNSUSPENDED
Indicates that an application HAP file is not suspended. (Deprecated) Indicates that an application HAP file is not suspended.
- Value: **usual.event.MY_PACKAGE_UNSUSPENDED** - Value: **usual.event.MY_PACKAGE_UNSUSPENDED**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_UID_REMOVED ## COMMON_EVENT_UID_REMOVED
(Reserved, not supported yet) Indicates that a user ID has been removed from the system. (Deprecated) Indicates that a user ID has been removed from the system.
- Value: **usual.event.UID_REMOVED** - Value: **usual.event.UID_REMOVED**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_FIRST_LAUNCH ## COMMON_EVENT_PACKAGE_FIRST_LAUNCH
(Reserved, not supported yet) Indicates that an installed application is started for the first time. (Deprecated) Indicates that an installed application is started for the first time.
- Value: **usual.event.PACKAGE_FIRST_LAUNCH** - Value: **usual.event.PACKAGE_FIRST_LAUNCH**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION ## COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION
(Reserved, not supported yet) Indicates that an application requires system verification. (Deprecated) Indicates that an application requires system verification.
- Value: **usual.event.PACKAGE_NEEDS_VERIFICATION** - Value: **usual.event.PACKAGE_NEEDS_VERIFICATION**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_VERIFIED ## COMMON_EVENT_PACKAGE_VERIFIED
(Reserved, not supported yet) Indicates that an application has been verified by the system. (Deprecated) Indicates that an application has been verified by the system.
- Value: **usual.event.PACKAGE_VERIFIED** - Value: **usual.event.PACKAGE_VERIFIED**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_EXTERNAL_APPLICATIONS_AVAILABLE ## COMMON_EVENT_EXTERNAL_APPLICATIONS_AVAILABLE
(Reserved, not supported yet) Indicates that applications installed on the external storage are available for the system. (Deprecated) Indicates that applications installed on the external storage are available for the system.
- Value: **usual.event.EXTERNAL_APPLICATIONS_AVAILABLE** - Value: **usual.event.EXTERNAL_APPLICATIONS_AVAILABLE**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_EXTERNAL_APPLICATIONS_UNAVAILABLE ## COMMON_EVENT_EXTERNAL_APPLICATIONS_UNAVAILABLE
(Reserved, not supported yet) Indicates that applications installed on the external storage are not available for the system. (Deprecated) Indicates that applications installed on the external storage are not available for the system.
- Value: **usual.event.EXTERNAL_APPLICATIONS_UNAVAILABLE** - Value: **usual.event.EXTERNAL_APPLICATIONS_UNAVAILABLE**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_CONFIGURATION_CHANGED ## COMMON_EVENT_CONFIGURATION_CHANGED
(Reserved, not supported yet) Indicates that the device state (for example, orientation and locale) has changed. (Deprecated) Indicates that the device state (for example, orientation and locale) has changed.
- Value: **usual.event.CONFIGURATION_CHANGED** - Value: **usual.event.CONFIGURATION_CHANGED**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_LOCALE_CHANGED ## COMMON_EVENT_LOCALE_CHANGED
(Reserved, not supported yet) Indicates that the device locale has changed. (Deprecated) Indicates that the device locale has changed.
- Value: **usual.event.LOCALE_CHANGED** - Value: **usual.event.LOCALE_CHANGED**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_MANAGE_PACKAGE_STORAGE ## COMMON_EVENT_MANAGE_PACKAGE_STORAGE
(Reserved, not supported yet) Indicates that the device storage is insufficient. (Deprecated) Indicates that the device storage is insufficient.
- Value: **usual.event.MANAGE_PACKAGE_STORAGE** - Value: **usual.event.MANAGE_PACKAGE_STORAGE**
- Required subscriber permissions: none - Required subscriber permissions: none
...@@ -245,31 +245,31 @@ Indicates that an application HAP file is not suspended. ...@@ -245,31 +245,31 @@ Indicates that an application HAP file is not suspended.
## COMMON_EVENT_HOME_MODE ## COMMON_EVENT_HOME_MODE
(Reserved, not supported yet) Indicates that the system is in home mode. (Deprecated) Indicates that the system is in home mode.
- Value: **common.event.HOME_MODE** - Value: **common.event.HOME_MODE**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_OFFICE_MODE ## COMMON_EVENT_OFFICE_MODE
(Reserved, not supported yet) Indicates that the system is in office mode. (Deprecated) Indicates that the system is in office mode.
- Value: **common.event.OFFICE_MODE** - Value: **common.event.OFFICE_MODE**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_USER_STARTED ## COMMON_EVENT_USER_STARTED
(Reserved, not supported yet) Indicates that the user has been started. (Deprecated) Indicates that the user has been started.
- Value: **usual.event.USER_STARTED** - Value: **usual.event.USER_STARTED**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_USER_BACKGROUND ## COMMON_EVENT_USER_BACKGROUND
(Reserved, not supported yet) Indicates that the user has been brought to the background. (Deprecated) Indicates that the user has been brought to the background.
- Value: **usual.event.USER_BACKGROUND** - Value: **usual.event.USER_BACKGROUND**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_USER_FOREGROUND ## COMMON_EVENT_USER_FOREGROUND
(Reserved, not supported yet) Indicates that the user has been brought to the foreground. (Deprecated) Indicates that the user has been brought to the foreground.
- Value: **usual.event.USER_FOREGROUND** - Value: **usual.event.USER_FOREGROUND**
- Required subscriber permissions: none - Required subscriber permissions: none
...@@ -281,7 +281,7 @@ Indicates that user switching is in progress. ...@@ -281,7 +281,7 @@ Indicates that user switching is in progress.
## COMMON_EVENT_USER_STARTING ## COMMON_EVENT_USER_STARTING
(Reserved, not supported yet) Indicates that the user is being started. (Deprecated) Indicates that the user is being started.
- Value: **usual.event.USER_STARTING** - Value: **usual.event.USER_STARTING**
- Required subscriber permissions: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - Required subscriber permissions: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
...@@ -293,13 +293,13 @@ Indicates that user switching is in progress. ...@@ -293,13 +293,13 @@ Indicates that user switching is in progress.
## COMMON_EVENT_USER_STOPPING ## COMMON_EVENT_USER_STOPPING
(Reserved, not supported yet) Indicates that the user is going to be stopped. (Deprecated) Indicates that the user is going to be stopped.
- Value: **usual.event.USER_STOPPING** - Value: **usual.event.USER_STOPPING**
- Required subscriber permissions: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - Required subscriber permissions: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
## COMMON_EVENT_USER_STOPPED ## COMMON_EVENT_USER_STOPPED
(Reserved, not supported yet) Indicates that the user has been stopped. (Deprecated) Indicates that the user has been stopped.
- Value: **usual.event.USER_STOPPED** - Value: **usual.event.USER_STOPPED**
- Required subscriber permissions: none - Required subscriber permissions: none
...@@ -474,7 +474,7 @@ Indicates that the Wi-Fi P2P group information has changed. ...@@ -474,7 +474,7 @@ Indicates that the Wi-Fi P2P group information has changed.
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED ## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED
(Reserved, not supported yet) Indicates that the low-ACL connection with a remote Bluetooth device has been terminated. (Deprecated) Indicates that the low-ACL connection with a remote Bluetooth device has been terminated.
- Value: **usual.event.bluetooth.remotedevice.ACL_DISCONNECTED** - Value: **usual.event.bluetooth.remotedevice.ACL_DISCONNECTED**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH - Required subscriber permissions: ohos.permission.USE_BLUETOOTH
...@@ -618,19 +618,19 @@ Indicates that the Wi-Fi P2P group information has changed. ...@@ -618,19 +618,19 @@ Indicates that the Wi-Fi P2P group information has changed.
## COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE ## COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE
(Reserved, not supported yet) Indicates that the playing state of Bluetooth A2DP Sink has changed. (Deprecated) Indicates that the playing state of Bluetooth A2DP Sink has changed.
- Value: **usual.event.bluetooth.a2dpsink.PLAYING_STATE_UPDATE** - Value: **usual.event.bluetooth.a2dpsink.PLAYING_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH - Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE ## COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE
(Reserved, not supported yet) Indicates that the audio state of Bluetooth A2DP Sink has changed. (Deprecated) Indicates that the audio state of Bluetooth A2DP Sink has changed.
- Value: **usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE** - Value: **usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH - Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED ## COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED
(Reserved, not supported yet) Indicates that the state of the device NFC adapter has changed. Indicates that the state of the device NFC adapter has changed.
- Value: **usual.event.nfc.action.ADAPTER_STATE_CHANGED** - Value: **usual.event.nfc.action.ADAPTER_STATE_CHANGED**
- Required subscriber permissions: none - Required subscriber permissions: none
...@@ -642,7 +642,7 @@ Indicates that the Wi-Fi P2P group information has changed. ...@@ -642,7 +642,7 @@ Indicates that the Wi-Fi P2P group information has changed.
## COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED ## COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED
(Reserved, not supported yet) Indicates that the NFC RF field is detected to be in the disabled state. (Deprecated) Indicates that the NFC RF field is detected to be in the disabled state.
- Value: **usual.event.nfc.action.RF_FIELD_OFF_DETECTED** - Value: **usual.event.nfc.action.RF_FIELD_OFF_DETECTED**
- Required subscriber permissions: ohos.permission.MANAGE_SECURE_SETTINGS - Required subscriber permissions: ohos.permission.MANAGE_SECURE_SETTINGS
...@@ -659,7 +659,7 @@ Indicates that the system starts charging the battery. ...@@ -659,7 +659,7 @@ Indicates that the system starts charging the battery.
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED ## COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED
(Reserved, not supported yet) Indicates that the system idle mode has changed. (Deprecated) Indicates that the system idle mode has changed.
- Value: **usual.event.DEVICE_IDLE_MODE_CHANGED** - Value: **usual.event.DEVICE_IDLE_MODE_CHANGED**
- Required subscriber permissions: none - Required subscriber permissions: none
...@@ -683,19 +683,19 @@ Indicates that a user has been removed from the system. ...@@ -683,19 +683,19 @@ Indicates that a user has been removed from the system.
## COMMON_EVENT_ABILITY_ADDED ## COMMON_EVENT_ABILITY_ADDED
(Reserved, not supported yet) Indicates that an ability has been added. (Deprecated) Indicates that an ability has been added.
- Value: **usual.event.ABILITY_ADDED** - Value: **usual.event.ABILITY_ADDED**
- Required subscriber permissions: ohos.permission.LISTEN_BUNDLE_CHANGE - Required subscriber permissions: ohos.permission.LISTEN_BUNDLE_CHANGE
## COMMON_EVENT_ABILITY_REMOVED ## COMMON_EVENT_ABILITY_REMOVED
(Reserved, not supported yet) Indicates that an ability has been removed. (Deprecated) Indicates that an ability has been removed.
- Value: **usual.event.ABILITY_REMOVED** - Value: **usual.event.ABILITY_REMOVED**
- Required subscriber permissions: ohos.permission.LISTEN_BUNDLE_CHANGE - Required subscriber permissions: ohos.permission.LISTEN_BUNDLE_CHANGE
## COMMON_EVENT_ABILITY_UPDATED ## COMMON_EVENT_ABILITY_UPDATED
(Reserved, not supported yet) Indicates that an ability has been updated. (Deprecated) Indicates that an ability has been updated.
- Value: **usual.event.ABILITY_UPDATED** - Value: **usual.event.ABILITY_UPDATED**
- Required subscriber permissions: ohos.permission.LISTEN_BUNDLE_CHANGE - Required subscriber permissions: ohos.permission.LISTEN_BUNDLE_CHANGE
...@@ -707,67 +707,67 @@ Indicates that a user has been removed from the system. ...@@ -707,67 +707,67 @@ Indicates that a user has been removed from the system.
## COMMON_EVENT_IVI_SLEEP ## COMMON_EVENT_IVI_SLEEP
(Reserved, not supported yet) Indicates that the in-vehicle infotainment (IVI) system is in sleep mode. (Deprecated) Indicates that the in-vehicle infotainment (IVI) system is in sleep mode.
- Value: **common.event.IVI_SLEEP** - Value: **common.event.IVI_SLEEP**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_IVI_PAUSE ## COMMON_EVENT_IVI_PAUSE
(Reserved, not supported yet) Indicates that the IVI system as entered sleep mode and instructs the playing application to stop playback. (Deprecated) Indicates that the IVI system as entered sleep mode and instructs the playing application to stop playback.
- Value: **common.event.IVI_PAUSE** - Value: **common.event.IVI_PAUSE**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_IVI_STANDBY ## COMMON_EVENT_IVI_STANDBY
(Reserved, not supported yet) Requests a third-party application in the IVI system to pause the current work. (Deprecated) Requests a third-party application in the IVI system to pause the current work.
- Value: **common.event.IVI_STANDBY** - Value: **common.event.IVI_STANDBY**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_IVI_LASTMODE_SAVE ## COMMON_EVENT_IVI_LASTMODE_SAVE
(Reserved, not supported yet) Requests a third-party application in the IVI system to save its last mode. (Deprecated) Requests a third-party application in the IVI system to save its last mode.
- Value: **common.event.IVI_LASTMODE_SAVE** - Value: **common.event.IVI_LASTMODE_SAVE**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_IVI_VOLTAGE_ABNORMAL ## COMMON_EVENT_IVI_VOLTAGE_ABNORMAL
(Reserved, not supported yet) Indicates that the voltage of the vehicle's power system is abnormal. (Deprecated) Indicates that the voltage of the vehicle's power system is abnormal.
- Value: **common.event.IVI_VOLTAGE_ABNORMAL** - Value: **common.event.IVI_VOLTAGE_ABNORMAL**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_IVI_HIGH_TEMPERATURE ## COMMON_EVENT_IVI_HIGH_TEMPERATURE
(Reserved, not supported yet) Indicates that the temperature of the IVI system is high. (Deprecated) Indicates that the temperature of the IVI system is high.
- Value: **common.event.IVI_HIGH_TEMPERATURE** - Value: **common.event.IVI_HIGH_TEMPERATURE**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_IVI_EXTREME_TEMPERATURE ## COMMON_EVENT_IVI_EXTREME_TEMPERATURE
(Reserved, not supported yet) Indicates that the temperature of the IVI system is extremely high. (Deprecated) Indicates that the temperature of the IVI system is extremely high.
- Value: **common.event.IVI_EXTREME_TEMPERATURE** - Value: **common.event.IVI_EXTREME_TEMPERATURE**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL ## COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL
(Reserved, not supported yet) Indicates that the IVI system is at an extreme temperature. (Deprecated) Indicates that the IVI system is at an extreme temperature.
- Value: **common.event.IVI_TEMPERATURE_ABNORMAL** - Value: **common.event.IVI_TEMPERATURE_ABNORMAL**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_IVI_VOLTAGE_RECOVERY ## COMMON_EVENT_IVI_VOLTAGE_RECOVERY
(Reserved, not supported yet) Indicates that the voltage of the vehicle's power system is restored to normal. (Deprecated) Indicates that the voltage of the vehicle's power system is restored to normal.
- Value: **common.event.IVI_VOLTAGE_RECOVERY** - Value: **common.event.IVI_VOLTAGE_RECOVERY**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_IVI_TEMPERATURE_RECOVERY ## COMMON_EVENT_IVI_TEMPERATURE_RECOVERY
(Reserved, not supported yet) Indicates that the temperature of the IVI system is restored to normal. (Deprecated) Indicates that the temperature of the IVI system is restored to normal.
- Value: **common.event.IVI_TEMPERATURE_RECOVERY** - Value: **common.event.IVI_TEMPERATURE_RECOVERY**
- Required subscriber permissions: none - Required subscriber permissions: none
## COMMON_EVENT_IVI_ACTIVE ## COMMON_EVENT_IVI_ACTIVE
(Reserved, not supported yet) Indicates that the battery service of the IVI system is active. (Deprecated) Indicates that the battery service of the IVI system is active.
- Value: **common.event.IVI_ACTIVE** - Value: **common.event.IVI_ACTIVE**
- Required subscriber permissions: none - Required subscriber permissions: none
...@@ -809,37 +809,37 @@ Indicates that a USB device has been detached from the device functioning as a U ...@@ -809,37 +809,37 @@ Indicates that a USB device has been detached from the device functioning as a U
## COMMON_EVENT_DISK_REMOVED ## COMMON_EVENT_DISK_REMOVED
(Reserved, not supported yet) Indicates that an external storage device was removed. (Deprecated) Indicates that an external storage device was removed.
- Value: **usual.event.data.DISK_BAD_REMOVAL** - Value: **usual.event.data.DISK_BAD_REMOVAL**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER - Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_DISK_UNMOUNTED ## COMMON_EVENT_DISK_UNMOUNTED
(Reserved, not supported yet) Indicates that an external storage device was unmounted. (Deprecated) Indicates that an external storage device was unmounted.
- Value: **usual.event.data.DISK_UNMOUNTABLE** - Value: **usual.event.data.DISK_UNMOUNTABLE**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER - Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_DISK_MOUNTED ## COMMON_EVENT_DISK_MOUNTED
(Reserved, not supported yet) Indicates that an external storage device was mounted. (Deprecated) Indicates that an external storage device was mounted.
- Value: **usual.event.hardware.usb.action.USB_ACCESSORY_DETACHED** - Value: **usual.event.hardware.usb.action.USB_ACCESSORY_DETACHED**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER - Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_DISK_BAD_REMOVAL ## COMMON_EVENT_DISK_BAD_REMOVAL
(Reserved, not supported yet) Indicates that an external storage device was removed without being unmounted. (Deprecated) Indicates that an external storage device was removed without being unmounted.
- Value: usual.event.data.DISK_REMOVED - Value: usual.event.data.DISK_REMOVED
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER - Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_DISK_UNMOUNTABLE ## COMMON_EVENT_DISK_UNMOUNTABLE
(Reserved, not supported yet) Indicates that an external storage device is unmountable when the card is inserted. (Deprecated) Indicates that an external storage device is unmountable when the card is inserted.
- Value: **usual.event.data.DISK_UNMOUNTED** - Value: **usual.event.data.DISK_UNMOUNTED**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER - Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_DISK_EJECT ## COMMON_EVENT_DISK_EJECT
(Reserved, not supported yet) Indicates that an external storage device was ejected (at the software level). (Deprecated) Indicates that an external storage device was ejected (at the software level).
- Value: **usual.event.data.DISK_EJECT** - Value: **usual.event.data.DISK_EJECT**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER - Required subscriber permissions: ohos.permission.STORAGE_MANAGER
...@@ -875,19 +875,19 @@ Indicates that an external storage device was ejected (at the software level). ...@@ -875,19 +875,19 @@ Indicates that an external storage device was ejected (at the software level).
## COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED ## COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED
(Reserved, not supported yet) Indicates that the account visibility changed. (Deprecated) Indicates that the account visibility changed.
- Value: **usual.event.data.VISIBLE_ACCOUNTS_UPDATED** - Value: **usual.event.data.VISIBLE_ACCOUNTS_UPDATED**
- Required subscriber permissions: ohos.permission.GET_APP_ACCOUNTS - Required subscriber permissions: ohos.permission.GET_APP_ACCOUNTS
## COMMON_EVENT_ACCOUNT_DELETED ## COMMON_EVENT_ACCOUNT_DELETED
(Reserved, not supported yet) Indicates that an account was deleted. (Deprecated) Indicates that an account was deleted.
- Value: **usual.event.data.ACCOUNT_DELETED** - Value: **usual.event.data.ACCOUNT_DELETED**
- Required subscriber permissions: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - Required subscriber permissions: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
## COMMON_EVENT_FOUNDATION_READY ## COMMON_EVENT_FOUNDATION_READY
(Reserved, not supported yet) Indicates that the foundation is ready. (Deprecated) Indicates that the foundation is ready.
- Value: **usual.event.data.FOUNDATION_READY** - Value: **usual.event.data.FOUNDATION_READY**
- Required subscriber permissions: ohos.permission.RECEIVER_STARTUP_COMPLETED - Required subscriber permissions: ohos.permission.RECEIVER_STARTUP_COMPLETED
......
...@@ -684,21 +684,19 @@ Describes the interruption event received by the application when playback is in ...@@ -684,21 +684,19 @@ Describes the interruption event received by the application when playback is in
| forceType | [InterruptForceType](#interruptforcetype9) | Yes | Whether the interruption is taken by the system or to be taken by the application.| | forceType | [InterruptForceType](#interruptforcetype9) | Yes | Whether the interruption is taken by the system or to be taken by the application.|
| hintType | [InterruptHint](#interrupthint) | Yes | Hint provided along the interruption. | | hintType | [InterruptHint](#interrupthint) | Yes | Hint provided along the interruption. |
## VolumeEvent<sup>8+</sup> ## VolumeEvent<sup>9+</sup>
Describes the event received by the application when the volume is changed. Describes the event received by the application when the volume is changed.
**System API**: This is a system API.
**System capability**: SystemCapability.Multimedia.Audio.Volume **System capability**: SystemCapability.Multimedia.Audio.Volume
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---------- | ----------------------------------- | ---- | -------------------------------------------------------- | | ---------- | ----------------------------------- | ---- | -------------------------------------------------------- |
| volumeType | [AudioVolumeType](#audiovolumetype) | Yes | Audio stream type. | | volumeType | [AudioVolumeType](#audiovolumetype) | Yes | Audio stream type. |
| volume | number | Yes | Volume to set. The value range can be obtained by calling **getMinVolume** and **getMaxVolume**.| | volume | number | Yes | Volume to set. The value range can be obtained by calling **getMinVolume** and **getMaxVolume**. |
| updateUi | boolean | Yes | Whether to show the volume change in UI. | | updateUi | boolean | Yes | Whether to show the volume change in UI. |
| volumeGroupId<sup>9+</sup> | number | Yes | Volume group ID. It can be used as an input parameter of **getGroupManager**. | | volumeGroupId | number | Yes | Volume group ID. It can be used as an input parameter of **getGroupManager**.<br>This is a system API. |
| networkId<sup>9+</sup> | string | Yes | Network ID. | | networkId | string | Yes | Network ID.<br>This is a system API. |
## MicStateChangeEvent<sup>9+</sup> ## MicStateChangeEvent<sup>9+</sup>
...@@ -1106,7 +1104,7 @@ Sets the volume for a stream. This API uses an asynchronous callback to return t ...@@ -1106,7 +1104,7 @@ Sets the volume for a stream. This API uses an asynchronous callback to return t
> **NOTE** > **NOTE**
> >
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setVolume](#setvolume9) in **AudioVolumeGroupManager**. > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setVolume](#setvolume9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications.
**Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY **Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY
...@@ -1142,7 +1140,7 @@ Sets the volume for a stream. This API uses a promise to return the result. ...@@ -1142,7 +1140,7 @@ Sets the volume for a stream. This API uses a promise to return the result.
> **NOTE** > **NOTE**
> >
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setVolume](#setvolume9) in **AudioVolumeGroupManager**. > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setVolume](#setvolume9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications.
**Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY **Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY
...@@ -1368,7 +1366,7 @@ Mutes or unmutes a stream. This API uses an asynchronous callback to return the ...@@ -1368,7 +1366,7 @@ Mutes or unmutes a stream. This API uses an asynchronous callback to return the
> **NOTE** > **NOTE**
> >
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [mute](#mute9) in **AudioVolumeGroupManager**. > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [mute](#mute9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications.
**System capability**: SystemCapability.Multimedia.Audio.Volume **System capability**: SystemCapability.Multimedia.Audio.Volume
...@@ -1400,7 +1398,7 @@ Mutes or unmutes a stream. This API uses a promise to return the result. ...@@ -1400,7 +1398,7 @@ Mutes or unmutes a stream. This API uses a promise to return the result.
> **NOTE** > **NOTE**
> >
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [mute](#mute9) in **AudioVolumeGroupManager**. > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [mute](#mute9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications.
**System capability**: SystemCapability.Multimedia.Audio.Volume **System capability**: SystemCapability.Multimedia.Audio.Volume
...@@ -1560,7 +1558,7 @@ Sets the ringer mode. This API uses an asynchronous callback to return the resul ...@@ -1560,7 +1558,7 @@ Sets the ringer mode. This API uses an asynchronous callback to return the resul
> **NOTE** > **NOTE**
> >
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setRingerMode](#setringermode9) in **AudioVolumeGroupManager**. > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setRingerMode](#setringermode9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications.
**Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY **Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY
...@@ -1595,7 +1593,8 @@ Sets the ringer mode. This API uses a promise to return the result. ...@@ -1595,7 +1593,8 @@ Sets the ringer mode. This API uses a promise to return the result.
> **NOTE** > **NOTE**
> >
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setRingerMode](#setringermode9) in **AudioVolumeGroupManager**. > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setRingerMode](#setringermode9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications.
**Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY **Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY
...@@ -1997,13 +1996,13 @@ audioManager.isMicrophoneMute().then((value) => { ...@@ -1997,13 +1996,13 @@ audioManager.isMicrophoneMute().then((value) => {
}); });
``` ```
### on('volumeChange')<sup>(deprecated)</sup> ### on('volumeChange')<sup>9+</sup>
on(type: 'volumeChange', callback: Callback\<VolumeEvent>): void on(type: 'volumeChange', callback: Callback\<VolumeEvent>): void
> **NOTE** > **NOTE**
> >
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [on](#on9) in **AudioVolumeManager**. > You are advised to use [on](#on9) in **AudioVolumeManager**.
Subscribes to system volume change events. Subscribes to system volume change events.
...@@ -2018,7 +2017,7 @@ Currently, when multiple **AudioManager** instances are used in a single process ...@@ -2018,7 +2017,7 @@ Currently, when multiple **AudioManager** instances are used in a single process
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The value **'volumeChange'** means the system volume change event, which is triggered when a system volume change is detected.| | type | string | Yes | Event type. The value **'volumeChange'** means the system volume change event, which is triggered when a system volume change is detected.|
| callback | Callback<[VolumeEvent](#volumeevent8)> | Yes | Callback used to return the system volume change event. | | callback | Callback<[VolumeEvent](#volumeevent9)> | Yes | Callback used to return the system volume change event. |
**Example** **Example**
...@@ -2116,7 +2115,7 @@ audioManager.off('deviceChange', (deviceChanged) => { ...@@ -2116,7 +2115,7 @@ audioManager.off('deviceChange', (deviceChanged) => {
}); });
``` ```
### on('interrupt')<sup>(deprecated)</sup> ### on('interrupt')
on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback\<InterruptAction>): void on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback\<InterruptAction>): void
...@@ -2124,10 +2123,6 @@ Subscribes to audio interruption events. When the application's audio is interru ...@@ -2124,10 +2123,6 @@ Subscribes to audio interruption events. When the application's audio is interru
Same as [on('audioInterrupt')](#onaudiointerrupt9), this API is used to listen for focus changes. However, this API is used in scenarios without audio streams (no **AudioRenderer** instance is created), such as frequency modulation (FM) and voice wakeup. Same as [on('audioInterrupt')](#onaudiointerrupt9), this API is used to listen for focus changes. However, this API is used in scenarios without audio streams (no **AudioRenderer** instance is created), such as frequency modulation (FM) and voice wakeup.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9.
**System capability**: SystemCapability.Multimedia.Audio.Renderer **System capability**: SystemCapability.Multimedia.Audio.Renderer
**Parameters** **Parameters**
...@@ -2158,16 +2153,12 @@ audioManager.on('interrupt', interAudioInterrupt, (InterruptAction) => { ...@@ -2158,16 +2153,12 @@ audioManager.on('interrupt', interAudioInterrupt, (InterruptAction) => {
}); });
``` ```
### off('interrupt')<sup>(deprecated)</sup> ### off('interrupt')
off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback\<InterruptAction>): void off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback\<InterruptAction>): void
Unsubscribes from audio interruption events. Unsubscribes from audio interruption events.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9.
**System capability**: SystemCapability.Multimedia.Audio.Renderer **System capability**: SystemCapability.Multimedia.Audio.Renderer
**Parameters** **Parameters**
...@@ -2332,7 +2323,7 @@ Subscribes to system volume change events. This API uses an asynchronous callbac ...@@ -2332,7 +2323,7 @@ Subscribes to system volume change events. This API uses an asynchronous callbac
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The value **'volumeChange'** means the system volume change event, which is triggered when the system volume changes.| | type | string | Yes | Event type. The value **'volumeChange'** means the system volume change event, which is triggered when the system volume changes.|
| callback | Callback<[VolumeEvent](#volumeevent8)> | Yes | Callback used to return the system volume change event. | | callback | Callback<[VolumeEvent](#volumeevent9)> | Yes | Callback used to return the system volume change event. |
**Error codes** **Error codes**
...@@ -3940,12 +3931,13 @@ Describes the audio renderer change event. ...@@ -3940,12 +3931,13 @@ Describes the audio renderer change event.
**System capability**: SystemCapability.Multimedia.Audio.Renderer **System capability**: SystemCapability.Multimedia.Audio.Renderer
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
| ------------- | ---------------------------------------- | -------- | -------- | ---------------------------------------------------------- | | ----------------- | ------------------------------------------------- | -------- | -------- | ---------------------------------------------------------- |
| streamId | number | Yes | No | Unique ID of an audio stream. | | streamId | number | Yes | No | Unique ID of an audio stream. |
| clientUid | number | Yes | No | UID of the audio renderer client.<br>This is a system API. | | clientUid | number | Yes | No | UID of the audio renderer client.<br>This is a system API. |
| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | Yes | No | Audio renderer information. | | rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | Yes | No | Audio renderer information. |
| rendererState | [AudioState](#audiostate) | Yes | No | Audio state.<br>This is a system API. | | rendererState | [AudioState](#audiostate) | Yes | No | Audio state.<br>This is a system API. |
| deviceDescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | Yes | No | Audio device description. |
**Example** **Example**
...@@ -3998,12 +3990,13 @@ Describes the audio capturer change event. ...@@ -3998,12 +3990,13 @@ Describes the audio capturer change event.
**System capability**: SystemCapability.Multimedia.Audio.Capturer **System capability**: SystemCapability.Multimedia.Audio.Capturer
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
| ------------- | ---------------------------------------- | -------- | -------- | ---------------------------------------------------------- | | ----------------- | ------------------------------------------------- | -------- | -------- | ---------------------------------------------------------- |
| streamId | number | Yes | No | Unique ID of an audio stream. | | streamId | number | Yes | No | Unique ID of an audio stream. |
| clientUid | number | Yes | No | UID of the audio capturer client.<br>This is a system API. | | clientUid | number | Yes | No | UID of the audio capturer client.<br>This is a system API. |
| capturerInfo | [AudioCapturerInfo](#audiocapturerinfo8) | Yes | No | Audio capturer information. | | capturerInfo | [AudioCapturerInfo](#audiocapturerinfo8) | Yes | No | Audio capturer information. |
| capturerState | [AudioState](#audiostate) | Yes | No | Audio state.<br>This is a system API. | | capturerState | [AudioState](#audiostate) | Yes | No | Audio state.<br>This is a system API. |
| deviceDescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | Yes | No | Audio device description. |
**Example** **Example**
...@@ -4097,7 +4090,7 @@ Implements filter criteria. Before calling **selectOutputDeviceByFilter**, you m ...@@ -4097,7 +4090,7 @@ Implements filter criteria. Before calling **selectOutputDeviceByFilter**, you m
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------------ | ---------------------------------------- | --------- | ------------------------------------------------------------ | | ------------ | ---------------------------------------- | --------- | ------------------------------------------------------------ |
| uid | number | Yes | Application ID.<br> **System capability**: SystemCapability.Multimedia.Audio.Core | | uid | number | Yes | Application ID.<br> **System capability**: SystemCapability.Multimedia.Audio.Core |
| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | No | Audio renderer information.<br> **System capability**: SystemCapability.Multimedia.Audio.Renderer | | rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | No | Audio renderer information.<br> **System capability**: SystemCapability.Multimedia.Audio.Renderer |
| rendererId | number | No | Unique ID of an audio stream.<br> **System capability**: SystemCapability.Multimedia.Audio.Renderer | | rendererId | number | No | Unique ID of an audio stream.<br> **System capability**: SystemCapability.Multimedia.Audio.Renderer |
...@@ -4950,18 +4943,18 @@ audioRenderer.setVolume(0.5, (err, data)=>{ ...@@ -4950,18 +4943,18 @@ audioRenderer.setVolume(0.5, (err, data)=>{
on(type: 'audioInterrupt', callback: Callback\<InterruptEvent>): void on(type: 'audioInterrupt', callback: Callback\<InterruptEvent>): void
Subscribes to audio interruption events. This API uses a callback to get interrupt events. Subscribes to audio interruption events. This API uses a callback to obtain interrupt events.
Same as [on('interrupt')](#oninterruptdeprecated), this API has obtained the focus before **start**, **pause**, or **stop** of **AudioRenderer** is called. Therefore, you do not need to request the focus. Same as [on('interrupt')](#oninterrupt), this API is used to listen for focus changes. The **AudioRenderer** instance proactively gains the focus when the **start** event occurs and releases the focus when the **pause** or **stop** event occurs. Therefore, you do not need to request to gain or release the focus.
**System capability**: SystemCapability.Multimedia.Audio.Interrupt **System capability**: SystemCapability.Multimedia.Audio.Interrupt
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------------------------------- | --------- | ------------------------------------------------------------ | | -------- | ---------------------------------------------- | --------- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The value **'audioInterrupt'** means the audio interruption event, which is triggered when audio playback is interrupted. | | type | string | Yes | Event type. The value **'audioInterrupt'** means the audio interruption event, which is triggered when audio playback is interrupted. |
| callback | Callback<[InterruptEvent](#interruptevent9)> | Yes | Callback used to return the audio interruption event. | | callback | Callback\<[InterruptEvent](#interruptevent9)\> | Yes | Callback used to return the audio interruption event. |
**Error codes** **Error codes**
...@@ -4969,7 +4962,7 @@ For details about the error codes, see [Audio Error Codes](../errorcodes/errorco ...@@ -4969,7 +4962,7 @@ For details about the error codes, see [Audio Error Codes](../errorcodes/errorco
| ID | Error Message | | ID | Error Message |
| ------- | ------------------------------ | | ------- | ------------------------------ |
| 6800101 | if input parameter value error | | 6800101 | if input parameter value error |
**Example** **Example**
...@@ -6111,7 +6104,7 @@ Describes the callback invoked for audio interruption or focus gain events. ...@@ -6111,7 +6104,7 @@ Describes the callback invoked for audio interruption or focus gain events.
> **NOTE** > **NOTE**
> >
> This API is supported since API version 7 and deprecated since API version 9. > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [InterruptEvent](#interruptevent9).
**System capability**: SystemCapability.Multimedia.Audio.Renderer **System capability**: SystemCapability.Multimedia.Audio.Renderer
......
...@@ -35,7 +35,6 @@ Implements initialization for the interpolation curve, which is used to create a ...@@ -35,7 +35,6 @@ Implements initialization for the interpolation curve, which is used to create a
| ---------------------------------- | ---------------- | | ---------------------------------- | ---------------- |
| [ICurve](#icurve) | Interpolation curve.| | [ICurve](#icurve) | Interpolation curve.|
**Example** **Example**
```ts ```ts
...@@ -57,7 +56,7 @@ Creates a step curve. ...@@ -57,7 +56,7 @@ Creates a step curve.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------- | ----| ------------------------------------------------------------ | | ------ | ------- | ----| ------------------------------------------------------------ |
| count | number | Yes | Number of steps. The value must be a positive integer. | | count | number | Yes | Number of steps. The value must be a positive integer.<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the value **0**.|
| end | boolean | Yes | Whether jumping occurs when the interpolation ends.<br>- **true**: Jumping occurs when the interpolation ends.<br>- **false**: Jumping occurs when the interpolation starts.| | end | boolean | Yes | Whether jumping occurs when the interpolation ends.<br>- **true**: Jumping occurs when the interpolation ends.<br>- **false**: Jumping occurs when the interpolation starts.|
**Return value** **Return value**
...@@ -66,7 +65,6 @@ Creates a step curve. ...@@ -66,7 +65,6 @@ Creates a step curve.
| ---------------------------------- | ---------------- | | ---------------------------------- | ---------------- |
| [ICurve](#icurve) | Interpolation curve.| | [ICurve](#icurve) | Interpolation curve.|
**Example** **Example**
```ts ```ts
...@@ -85,12 +83,13 @@ Creates a cubic Bezier curve. The curve values must be between 0 and 1. ...@@ -85,12 +83,13 @@ Creates a cubic Bezier curve. The curve values must be between 0 and 1.
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters** **Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | -------------- | | Name| Type | Mandatory| Description |
| x1 | number | Yes | X coordinate of the first point on the Bezier curve.| | ------ | ------ | ---- | ------------------------------------------------------------ |
| y1 | number | Yes | Y coordinate of the first point on the Bezier curve.| | x1 | number | Yes | X coordinate of the first point on the Bezier curve.<br>Value range: [0, 1]<br>**NOTE**<br>A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.|
| x2 | number | Yes | X coordinate of the second point on the Bezier curve.| | y1 | number | Yes | Y coordinate of the first point on the Bezier curve.<br>Value range: (-∞, +∞) |
| y2 | number | Yes | Y coordinate of the second point on the Bezier curve.| | x2 | number | Yes | X coordinate of the second point on the Bezier curve.<br>Value range: [0, 1]<br>**NOTE**<br>A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.|
| y2 | number | Yes | Y coordinate of the second point on the Bezier curve.<br>Value range: (-∞, +∞) |
**Return value** **Return value**
...@@ -117,12 +116,12 @@ Creates a spring curve. ...@@ -117,12 +116,12 @@ Creates a spring curve.
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| --------- | ------ | ---- | ----- | | --------- | ------ | ---- | ------------------------------------------------------------ |
| velocity | number | Yes | Initial velocity. It is applied by external factors to the elastic animation. It aims to help ensure the smooth transition from the previous motion state to the elastic animation.| | velocity | number | Yes | Initial velocity. It is applied by external factors to the spring animation, designed to help ensure the smooth transition from the previous motion state.<br>Value range: (-∞, +∞)|
| mass | number | Yes | Mass, which influences the inertia in the spring system. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position.| | mass | number | Yes | Mass, which influences the inertia in the spring system. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position.<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the value **1**.|
| stiffness | number | Yes | Stiffness. It is the degree to which an object deforms by resisting the force applied. In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position.| | stiffness | number | Yes | Stiffness. It is the degree to which an object deforms by resisting the force applied. In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position.<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the value **1**.|
| damping | number | Yes | Damping. It is a pure number and has no real physical meaning. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude.| | damping | number | Yes | Damping. It is a pure number and has no real physical meaning. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude.<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the value **1**.|
**Return value** **Return value**
...@@ -149,18 +148,19 @@ Creates a spring animation curve. If multiple spring animations are applied to t ...@@ -149,18 +148,19 @@ Creates a spring animation curve. If multiple spring animations are applied to t
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ----- | | --------- | ------ | ---- | ----- |
| response | number | No | Duration of one complete oscillation, in seconds.<br>Default value: **0.55**| | response | number | No | Duration of one complete oscillation,<br>Default value: **0.55**<br>Unit: second<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value **0.55**.|
| dampingFraction | number | No | Damping coefficient.<br>**0**: undamped. In this case, the spring oscillates forever.<br>> 0 and < 1: underdamped. In this case, the spring overshoots the equilibrium position.<br>**1**: critically damped.<br>> 1: overdamped. In this case, the spring approaches equilibrium gradually.<br>Default value: **0.825**| | dampingFraction | number | No | Damping coefficient.<br>**0**: undamped. In this case, the spring oscillates forever.<br>> 0 and < 1: underdamped. In this case, the spring overshoots the equilibrium position.<br>**1**: critically damped.<br>> 1: overdamped. In this case, the spring approaches equilibrium gradually.<br>Default value: **0.825**<br>Unit: second<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value **0.55**.|
| overlapDuration | number | No | Duration for animations to overlap, in seconds. When animations overlap, if the **response** values of the two animations are different, they will transit smoothly over this duration.<br> Default value: **0**| | overlapDuration | number | No | Duration for animations to overlap, in seconds. When animations overlap, if the **response** values of the two animations are different, they will transit smoothly over this duration.<br><br>Default value: **0**<br>Unit: second<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value **0**.<br>The spring animation curve is physics-based. Its duration depends on the **springMotion** parameters and the previous velocity, rather than the **duration** parameter in **[animation](../arkui-ts/ts-animatorproperty.md)** or **[animateTo](../arkui-ts/ts-explicit-animation.md)**. The time cannot be normalized. Therefore, the interpolation cannot be obtained by using the **[interpolate](#interpolate)** function of the curve.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------- | ---------------- | | ---------------------------------- | ---------------- |
| [ICurve](#icurve)| Curve.<br>Note: The spring animation curve is physics-based. Its duration depends on the **springMotion** parameters and the previous velocity, rather than the **duration** parameter in **animation** or **animateTo**. The time cannot be normalized. Therefore, the interpolation cannot be obtained by using the [interpolate](#interpolate) function of the curve.| | [ICurve](#icurve)| Curve.<br>**NOTE**<br>The spring animation curve is physics-based. Its duration depends on the **springMotion** parameters and the previous velocity, rather than the **duration** parameter in **animation** or **animateTo**. The time cannot be normalized. Therefore, the interpolation cannot be obtained by using the **[interpolate](#interpolate)** function of the curve.|
**Example** **Example**
...@@ -182,17 +182,18 @@ Creates a responsive spring animation curve. It is a special case of [springMoti ...@@ -182,17 +182,18 @@ Creates a responsive spring animation curve. It is a special case of [springMoti
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ----- | | --------- | ------ | ---- | ----- |
| response | number | No | See **response** in **springMotion**. Default value: **0.15**| | response | number | No | See **response** in **springMotion**.<br>Default value: **0.15**<br>Unit: second<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value **0.15**.|
| dampingFraction | number | No | See **dampingFraction** in **springMotion**. Default value: **0.86**| | dampingFraction | number | No | See **dampingFraction** in **springMotion**.<br>Default value: **0.86**<br>Unit: second<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value **0.86**.|
| overlapDuration | number | No | See **overlapDuration** in **springMotion**. Default value: **0.25**| | overlapDuration | number | No | See **overlapDuration** in **springMotion**.<br>Default value: **0.25**<br>Unit: second<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value **0.25**.<br> To apply custom settings for a spring animation, you are advised to use **springMotion**. When using **responsiveSpringMotion**, you are advised to retain the default settings.<br>The duration of the responsive spring animation depends on the **responsiveSpringMotion** parameters and the previous velocity, rather than the **duration** parameter in **[animation](../arkui-ts/ts-animatorproperty.md)** or **[animateTo](../arkui-ts/ts-explicit-animation.md)**. In addition, the interpolation cannot be obtained by using the **[interpolate](#interpolate)** function of the curve.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------- | ---------------- | | ---------------------------------- | ---------------- |
| [ICurve](#icurve)| Curve.<br>**NOTE**<br>1. To apply custom settings for a spring animation, you are advised to use **springMotion**. When using **responsiveSpringMotion**, you are advised to retain the default settings.<br>2. The duration of the responsive spring animation depends on the **responsiveSpringMotion** parameters and the previous velocity, rather than the **duration** parameter in **animation** or **animateTo**. In addition, the interpolation cannot be obtained by using the [interpolate](#interpolate) function of the curve.| | [ICurve](#icurve)| Curve.<br>**NOTE**<br>1. To apply custom settings for a spring animation, you are advised to use **springMotion**. When using **responsiveSpringMotion**, you are advised to retain the default settings.<br>2. The duration of the responsive spring animation depends on the **responsiveSpringMotion** parameters and the previous velocity, rather than the **duration** parameter in **animation** or **animateTo**. In addition, the interpolation cannot be obtained by using the **interpolate** function of the curve.|
**Example** **Example**
...@@ -217,9 +218,9 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -217,9 +218,9 @@ Since API version 9, this API is supported in ArkTS widgets.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------ | ---- | -------------------------------------------- | | -------- | ------ | ---- | ------------------------------------------------------------ |
| fraction | number | Yes | Current normalized time. The value ranges from 0 to 1.| | fraction | number | Yes | Current normalized time.<br>Value range: [0, 1]<br>**NOTE**<br>A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.|
**Return value** **Return value**
...@@ -300,7 +301,7 @@ Creates a spring curve. This API is deprecated since API version 9. You are advi ...@@ -300,7 +301,7 @@ Creates a spring curve. This API is deprecated since API version 9. You are advi
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ----- | | --------- | ------ | ---- | ----- |
| velocity | number | Yes | Initial velocity. It is applied by external factors to the elastic animation. It aims to help ensure the smooth transition from the previous motion state to the elastic animation.| | velocity | number | Yes | Initial velocity. It is applied by external factors to the spring animation, designed to help ensure the smooth transition from the previous motion state.|
| mass | number | Yes | Mass, which influences the inertia in the spring system. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position.| | mass | number | Yes | Mass, which influences the inertia in the spring system. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position.|
| stiffness | number | Yes | Stiffness. It is the degree to which an object deforms by resisting the force applied. In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position.| | stiffness | number | Yes | Stiffness. It is the degree to which an object deforms by resisting the force applied. In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position.|
| damping | number | Yes | Damping. It is a pure number and has no real physical meaning. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude.| | damping | number | Yes | Damping. It is a pure number and has no real physical meaning. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude.|
......
...@@ -281,11 +281,11 @@ Translates this matrix object along the x, y, and z axes. ...@@ -281,11 +281,11 @@ Translates this matrix object along the x, y, and z axes.
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------- | | ------ | ------ | ---- | ----------------------------------------------------------- |
| x | number | No | Translation distance along the x-axis, in px.<br>Default value: **0**| | x | number | No | Translation distance along the x-axis, in px.<br>Default value: **0**<br>Value range: (-∞, +∞)|
| y | number | No | Translation distance along the y-axis, in px.<br>Default value: **0**| | y | number | No | Translation distance along the y-axis, in px.<br>Default value: **0**<br>Value range: (-∞, +∞)|
| z | number | No | Translation distance along the z-axis, in px.<br>Default value: **0**| | z | number | No | Translation distance along the z-axis, in px.<br>Default value: **0**<br>Value range: (-∞, +∞)|
**Return value** **Return value**
...@@ -328,13 +328,13 @@ Scales this matrix object along the x, y, and z axes. ...@@ -328,13 +328,13 @@ Scales this matrix object along the x, y, and z axes.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------ | ---- | --------------------------------- | | ------- | ------ | ---- | ------------------------------------------------------------ |
| x | number | No | Scaling multiple along the x-axis.<br>Default value: **1** | | x | number | No | Scaling multiple along the x-axis. If the value is greater than 1, the image is scaled up along the x-axis. If the value is less than 1, the image is scaled down along the x-axis.<br>Default value: **1**<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value.|
| y | number | No | Scaling multiple along the y-axis.<br>Default value: **1** | | y | number | No | Scaling multiple along the y-axis. If the value is greater than 1, the image is scaled up along the y-axis. If the value is less than 1, the image is scaled down along the y-axis.<br>Default value: **1**<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value.|
| z | number | No | Scaling multiple along the z-axis.<br>Default value: **1** | | z | number | No | Scaling multiple along the z-axis. If the value is greater than 1, the image is scaled up along the z-axis. If the value is less than 1, the image is scaled down along the z-axis.<br>Default value: **1**<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value.|
| centerX | number | No | X coordinate of the center point.<br>Default value: **0**| | centerX | number | No | X coordinate of the center point.<br>Default value: **0**<br>Value range: (-∞, +∞) |
| centerY | number | No | Y coordinate of the center point.<br>Default value: **0**| | centerY | number | No | Y coordinate of the center point.<br>Default value: **0**<br>Value range: (-∞, +∞) |
**Return value** **Return value**
...@@ -376,14 +376,14 @@ Rotates this matrix object along the x, y, and z axes. ...@@ -376,14 +376,14 @@ Rotates this matrix object along the x, y, and z axes.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------ | ---- | --------------------------------- | | ------- | ------ | ---- | ------------------------------------------------------- |
| x | number | No | X coordinate of the rotation axis vector.<br>Default value: **1** | | x | number | No | X coordinate of the rotation axis vector.<br>Default value: **1**<br>Value range: (-∞, +∞)|
| y | number | No | Y coordinate of the rotation axis vector.<br>Default value: **1** | | y | number | No | Y coordinate of the rotation axis vector.<br>Default value: **1**<br>Value range: (-∞, +∞)|
| z | number | No | Z coordinate of the rotation axis vector.<br>Default value: **1** | | z | number | No | Z coordinate of the rotation axis vector.<br>Default value: **1**<br>Value range: (-∞, +∞)|
| angle | number | No | Rotation angle.<br>Default value: **0** | | angle | number | No | Rotation angle.<br>Default value: **0** |
| centerX | number | No | X coordinate of the center point.<br>Default value: **0**| | centerX | number | No | X coordinate of the center point.<br>Default value: **0** |
| centerY | number | No | Y coordinate of the center point.<br>Default value: **0**| | centerY | number | No | Y coordinate of the center point.<br>Default value: **0** |
**Return value** **Return value**
......
...@@ -14,13 +14,13 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -14,13 +14,13 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---------- | ------------------------------------------| ---- | ------------------------------------------------------------ | | ---------- | ------------------------------------------| ---- | ------------------------------------------------------------ |
| duration | number | No | Animation duration, in ms.<br>Default value: **1000**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The maximum animation duration on an ArkTS widget is 1000 ms. If the set value exceeds the limit, the value **1000** will be used. | | duration | number | No | Animation duration, in ms.<br>Default value: **1000**<br>Unit: ms<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>- The maximum animation duration on an ArkTS widget is 1000 ms.<br>- A value less than 1 evaluates to the value **0**.<br>- If the value is of the floating point type, the value is rounded down. If the value is 1.2, the value **1** is used.|
| tempo | number | No | Animation playback speed. A greater value indicates a higher animation playback speed.<br>The value **0** indicates that no animation is applied.<br>Default value: **1**| | tempo | number | No | Animation playback speed. A larger value indicates a higher animation playback speed.<br>The value **0** indicates that no animation is applied.<br>Default value: **1**<br>**NOTE**<br>A value less than 1 evaluates to the value **1**.|
| curve | string \| [Curve](ts-appendix-enums.md#curve) \| ICurve<sup>9+</sup> | No | Animation curve.<br>Default value: **Curve.Linear**<br>Since API version 9, this API is supported in ArkTS widgets. | | curve | string \| [Curve](ts-appendix-enums.md#curve) \| ICurve<sup>9+</sup> | No | Animation curve. The default curve is linear.<br>Default value: **Curve.Linear**<br>Since API version 9, this API is supported in ArkTS widgets.|
| delay | number | No | Delay of animation playback, in ms. The value **0** indicates that the playback is not delayed.<br>Default value: **0** | | delay | number | No | Delay of animation playback, in ms. The value **0** indicates that the playback is not delayed.<br>Default value: **0**<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 1 evaluates to the value **0**. If the value is of the floating point type, the value is rounded down. If the value is 1.2, the value **1** is used.|
| iterations | number | No | Number of times that the animation is played. The value **-1** indicates that the animation is played for an unlimited number of times.<br>Default value: **1**| | iterations | number | No | Number of times that the animation is played.<br>Default value: **1**<br>Value range: [-1, +∞)<br>**NOTE**<br>The value **-1** indicates that the animation is played for an unlimited number of times. The value **0** indicates that no animation is applied.|
| playMode | [PlayMode](ts-appendix-enums.md#playmode) | No | Animation playback mode. By default, the animation is played from the beginning after the playback is complete.<br>Default value: **PlayMode.Normal**<br>Since API version 9, this API is supported in ArkTS widgets.| | playMode | [PlayMode](ts-appendix-enums.md#playmode) | No | Animation playback mode. By default, the animation is played from the beginning after the playback is complete.<br>Default value: **PlayMode.Normal**<br>Since API version 9, this API is supported in ArkTS widgets.|
| onFinish | () => void | No | Callback invoked when the animation playback is complete.<br>Since API version 9, this API is supported in ArkTS widgets.| | onFinish | () => void | No | Callback invoked when the animation playback is complete.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This callback is not invoked when **iterations** is set to **-1**.|
## Example ## Example
...@@ -37,11 +37,11 @@ struct AttrAnimationExample { ...@@ -37,11 +37,11 @@ struct AttrAnimationExample {
build() { build() {
Column() { Column() {
Button('change width and height') Button('change size')
.onClick(() => { .onClick(() => {
if (this.flag) { if (this.flag) {
this.widthSize = 100 this.widthSize = 150
this.heightSize = 50 this.heightSize = 60
} else { } else {
this.widthSize = 250 this.widthSize = 250
this.heightSize = 100 this.heightSize = 100
...@@ -67,8 +67,8 @@ struct AttrAnimationExample { ...@@ -67,8 +67,8 @@ struct AttrAnimationExample {
duration: 1200, duration: 1200,
curve: Curve.Friction, curve: Curve.Friction,
delay: 500, delay: 500,
iterations: -1, // The value -1 indicates that the animation is played for an unlimited number of times. iterations: -1, // The value -1 indicates that the animation is played for an unlimited number of times.
playMode: PlayMode.AlternateReverse playMode: PlayMode.Alternate
}) })
}.width('100%').margin({ top: 20 }) }.width('100%').margin({ top: 20 })
} }
......
...@@ -237,8 +237,8 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -237,8 +237,8 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name | Description | | Name | Description |
| ------ | -------------------------------------------------- | | ------ | -------------------------------------------------- |
| All | The transition takes effect in all scenarios.| | All | The transition takes effect in all scenarios.|
| Insert | The transition takes effect when a component is inserted. | | Insert | The transition takes effect when a component is inserted or displayed.|
| Delete | The transition takes effect when a component is deleted. | | Delete | The transition takes effect when a component is deleted or hidden.|
## RelateType ## RelateType
...@@ -307,12 +307,12 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -307,12 +307,12 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name | Description | | Name | Description |
| -------- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ |
| Auto | The default configuration in the flex container is used. | | Auto | The default configuration of the flex container is used. |
| Start | The elements are in the flex container, top-aligned in the cross-axis direction. | | Start | The items in the flex container are aligned with the cross-start edge. |
| Center | The elements are in the flex container, centered in the cross-axis direction. | | Center | The items in the flex container are centered along the cross axis. |
| End | The elements are in the flex container, bottom-aligned in the cross-axis direction. | | End | The items in the flex container are aligned with the cross-end edge. |
| Stretch | The elements are in the flex container, stretched and padded in the cross-axis direction. If the size is not set, the elements are stretched to the container size.| | Stretch | The items in the flex container are stretched and padded along the cross axis. If the flex container has the **Wrap** attribute set to **FlexWrap.Wrap** or **FlexWrap.WrapReverse**, the items are stretched to the cross size of the widest element on the current row or column. In other cases, the items with no size set are stretched to the container size.|
| Baseline | The elements are in the flex container, text baseline aligned in the cross-axis direction. | | Baseline | The items in the flex container are aligned in such a manner that their text baselines are aligned along the cross axis. |
## FlexDirection ## FlexDirection
...@@ -417,21 +417,21 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -417,21 +417,21 @@ Since API version 9, this API is supported in ArkTS widgets.
Since API version 9, this API is supported in ArkTS widgets. Since API version 9, this API is supported in ArkTS widgets.
| Name | Description | | Name | Description |
| ------ | -------------- | | --------------------- | -------------- |
| Start | Aligned with the start.| | Start | Aligned with the start.|
| Center | Horizontally centered.| | Center | Horizontally centered.|
| End | Aligned with the end.| | End | Aligned with the end.|
## TextOverflow ## TextOverflow
Since API version 9, this API is supported in ArkTS widgets. Since API version 9, this API is supported in ArkTS widgets.
| Name | Description | | Name | Description |
| -------- | -------------------------------------- | | --------------------- | -------------------------------------- |
| Clip | Extra-long text is clipped. | | Clip | Extra-long text is clipped. |
| Ellipsis | An ellipsis (...) is used to represent clipped text.| | Ellipsis | An ellipsis (...) is used to represent text overflow.|
| None | No clipping or ellipsis is used for extra-long text. | | None | No clipping or ellipsis is used for text overflow. |
## TextDecorationType ## TextDecorationType
......
...@@ -25,10 +25,9 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -25,10 +25,9 @@ Since API version 9, this API is supported in ArkTS widgets.
| type | ButtonType | No | Button type.<br>Default value: **ButtonType.Capsule** | | type | ButtonType | No | Button type.<br>Default value: **ButtonType.Capsule** |
| stateEffect | boolean | No | Whether to enable the pressed effect on the click of the button. The value **false** means to disable the pressed effect.<br>Default value: **true**| | stateEffect | boolean | No | Whether to enable the pressed effect on the click of the button. The value **false** means to disable the pressed effect.<br>Default value: **true**|
**API 2:** Button(label?: ResourceStr, options?: { type?: ButtonType, stateEffect?: boolean }) **API 2:** Button(label?: ResourceStr, options?: { type?: ButtonType, stateEffect?: boolean })
Creates a button component based on text content. In this case, the component cannot contain child components. Creates a button component based on text content. In this case, the component cannot contain child components.
Since API version 9, this API is supported in ArkTS widgets. Since API version 9, this API is supported in ArkTS widgets.
...@@ -39,15 +38,16 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -39,15 +38,16 @@ Since API version 9, this API is supported in ArkTS widgets.
| label | [ResourceStr](ts-types.md#resourcestr) | No | Button text. | | label | [ResourceStr](ts-types.md#resourcestr) | No | Button text. |
| options | { type?: ButtonType, stateEffect?: boolean } | No | See parameters of API 1.| | options | { type?: ButtonType, stateEffect?: boolean } | No | See parameters of API 1.|
## Attributes ## Attributes
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name | Type | Description | | Name | Type | Description |
| ----------- | ----------- | --------------------------------- | | ----------- | ----------- | --------------------------------- |
| type | ButtonType | Button type.<br>Default value: **ButtonType.Capsule**<br>Since API version 9, this API is supported in ArkTS widgets.| | type | ButtonType | Button type.<br>Default value: **ButtonType.Capsule**<br>Since API version 9, this API is supported in ArkTS widgets.|
| stateEffect | boolean | Whether to enable the pressed effect on the click of the button. The value **false** means to disable the pressed effect.<br>Default value: **true**<br>Since API version 9, this API is supported in ArkTS widgets.| | stateEffect | boolean | Whether to enable the pressed effect on the click of the button. The value **false** means to disable the pressed effect.<br>Default value: **true**<br>Since API version 9, this API is supported in ArkTS widgets.|
## ButtonType enums ## ButtonType
Since API version 9, this API is supported in ArkTS widgets. Since API version 9, this API is supported in ArkTS widgets.
...@@ -58,11 +58,14 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -58,11 +58,14 @@ Since API version 9, this API is supported in ArkTS widgets.
| Normal | Normal button (without rounded corners by default). | | Normal | Normal button (without rounded corners by default). |
> **NOTE** > **NOTE**
> - The rounded corner of a button is set by using [borderRadius](ts-universal-attributes-border.md), rather than by using the **border** API. Only a button-wide rounded corner setting is supported. > - The rounded corner of a button is set by using [borderRadius](ts-universal-attributes-border.md), rather than by using the **border** API. Only a rounded corner whose parameter is [Length](ts-types.md#length) is supported.
> - For a button of the **Capsule** type, the **borderRadius** settings do not take effect, and its rounded corner is always half of the button height. > - For a button of the **Capsule** type, the **borderRadius** settings do not take effect, and the radius of its rounded corner is always half of the button height or width, whichever is smaller.
> - For a button of the **Circle** type, its radius is the value of **borderRadius** (if set) or the width or height (whichever is smaller). > - For a button of the **Circle** type, its radius is the value of **borderRadius** (if set) or the width or height (whichever is smaller).
> - The button text is set using the [text style attributes](ts-universal-attributes-text-style.md). > - The button text is set using the [text style attributes](ts-universal-attributes-text-style.md).
> - Before setting the [gradient color](ts-universal-attributes-gradient-color.md), you need to set [backgroundColor](ts-universal-attributes-background.md) to transparent.
The [universal events](ts-universal-events-click.md) are supported.
## Example ## Example
......
...@@ -24,10 +24,20 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -24,10 +24,20 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name | Type | Mandatory | Description| | Name | Type | Mandatory | Description|
| ----------------- | -------- | ----- | -------- | | ----------------- | -------- | ----- | -------- |
| values | number[] | Yes | Data value list. A maximum of nine values are supported. If more than nine values are set, only the first nine ones are used. If the value is less than 0, the value 0 is used.| | values | number[] | Yes | Data value list. A maximum of nine values are supported. If more than nine values are set, only the first nine ones are used. A value less than 0 evaluates to the value **0**. |
| max | number | No | - When set to a value greater than 0, this parameter indicates the maximum value in the **values** list.<br>- When set to a value equal to or smaller than 0, this parameter indicates the sum of values in the **values** list. The values are displayed in proportion.<br>Default value: **100**| | max | number | No | - When set to a value greater than 0, this parameter indicates the maximum value in the **values** list.<br>- When set to a value equal to or smaller than 0, this parameter indicates the sum of values in the **values** list. The values are displayed in proportion.<br>Default value: **100**|
| type<sup>8+</sup> | [DataPanelType](#datapaneltype) | No| Type of the data panel (dynamic modification is not supported).<br>Default value: **DataPanelType.Circle**| | type<sup>8+</sup> | [DataPanelType](#datapaneltype) | No| Type of the data panel (dynamic modification is not supported).<br>Default value: **DataPanelType.Circle**|
## Attributes
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name | Type | Description |
| ----------- | ------- | -------------------------------------------- |
| closeEffect | boolean | Whether to disable the rotation effect for the component.<br>Default value: **false**|
## DataPanelType ## DataPanelType
Since API version 9, this API is supported in ArkTS widgets. Since API version 9, this API is supported in ArkTS widgets.
......
...@@ -25,16 +25,11 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -25,16 +25,11 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name | Type | Description | | Name | Type | Description |
| ----------- | ---------- | ------------------ | | ----------- | ---------- | ------------------ |
| vertical | boolean | Whether a vertical divider is used. **false**: A horizontal divider is used.<br>**true**: A vertical divider is used.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.| | vertical | boolean | Whether a vertical divider is used. **false**: A horizontal divider is used.<br>**true**: A vertical divider is used.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.|
| color | [ResourceColor](ts-types.md#resourcecolor) | Color of the divider.<br>Since API version 9, this API is supported in ArkTS widgets.| | color | [ResourceColor](ts-types.md#resourcecolor) | Color of the divider.<br>Default value: **'\#33182431'**<br>Since API version 9, this API is supported in ArkTS widgets. |
| strokeWidth | number \| string | Width of the divider.<br>Default value: **1**<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeWidth | number \| string | Width of the divider.<br>Default value: **1**<br>Unit: vp<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute cannot be set to a percentage. |
| lineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | Cap style of the divider.<br>Default value: **LineCapStyle.Butt**<br>Since API version 9, this API is supported in ArkTS widgets.| | lineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | Cap style of the divider.<br>Default value: **LineCapStyle.Butt**<br>Since API version 9, this API is supported in ArkTS widgets.|
## Events
The universal events are not supported.
## Example ## Example
```ts ```ts
......
...@@ -80,11 +80,11 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -80,11 +80,11 @@ Since API version 9, this API is supported in ArkTS widgets.
In addition to the [universal events](ts-universal-events-click.md), the following events are supported. In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
| Name | Description | | Name | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------------------------------------ | ------------------------------------------------------------ |
| onComplete(callback: (event?: { width: number, height: number, componentWidth: number,<br> componentHeight: number, loadingStatus: number }) =&gt; void) | Triggered when an image is successfully loaded. The size of the loaded image is returned.<br>- **width**: width of the image, in pixels.<br>- **height**: height of the image, in pixels.<br>- **componentWidth**: width of the container component, in pixels.<br>- **componentHeight**: height of the container component, in pixels.<br>- **loadingStatus**: image loading status.<br>Since API version 9, this API is supported in ArkTS widgets.| | onComplete(callback: (event?: { width: number, height: number, componentWidth: number,<br> componentHeight: number, loadingStatus: number }) =&gt; void) | Triggered when an image is successfully loaded. The size of the loaded image is returned.<br>- **width**: width of the image, in pixels.<br>- **height**: height of the image, in pixels.<br>- **componentWidth**: width of the container component, in pixels.<br>- **componentHeight**: height of the container component, in pixels.<br>- **loadingStatus**: image loading status. The value **1** means that the image is successfully loaded, and **0** means the opposite.<br>Since API version 9, this API is supported in ArkTS widgets. |
| onError(callback: (event?: { componentWidth: number, componentHeight: number , message<sup>9+</sup>: string }) =&gt; void) | Triggered when an exception occurs during image loading.<br>- **componentWidth**: width of the container component, in pixels.<br>- **componentHeight**: height of the container component, in pixels.<br>Since API version 9, this API is supported in ArkTS widgets.| | onError(callback: (event?: { componentWidth: number, componentHeight: number , message<sup>9+</sup>: string }) =&gt; void) | Triggered when an exception occurs during image loading.<br>- **componentWidth**: width of the container component, in pixels.<br>- **componentHeight**: height of the container component, in pixels.<br>Since API version 9, this API is supported in ArkTS widgets. |
| onFinish(event: () =&gt; void) | Triggered when the animation playback in the loaded SVG image is complete. If the animation is an infinite loop, this callback is not triggered.<br>Since API version 9, this API is supported in ArkTS widgets.| | onFinish(event: () =&gt; void) | Triggered when the animation playback in the loaded SVG image is complete. If the animation is an infinite loop, this callback is not triggered.<br>Since API version 9, this API is supported in ArkTS widgets. |
## Example ## Example
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
The **\<QRCode>** component is used to display a QR code. The **\<QRCode>** component is used to display a QR code.
> **NOTE** > **NOTE**
> >
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
...@@ -36,7 +36,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -36,7 +36,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
## Events ## Events
Among all the universal events, only the [click event](ts-universal-events-click.md) is supported. Among the universal events, the [click event](ts-universal-events-click.md), [touch event](ts-universal-events-touch.md), and [show/hide event](ts-universal-events-show-hide.md) are supported.
## Example ## Example
......
...@@ -32,7 +32,7 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -32,7 +32,7 @@ Since API version 9, this API is supported in ArkTS widgets.
| -------- | -------- | -------- | | -------- | -------- | -------- |
| stars | number | Total number of stars.<br>Default value: **5**<br>Since API version 9, this API is supported in ArkTS widgets.| | stars | number | Total number of stars.<br>Default value: **5**<br>Since API version 9, this API is supported in ArkTS widgets.|
| stepSize | number | Step of an operation.<br>Default value: **0.5**<br>Since API version 9, this API is supported in ArkTS widgets.| | stepSize | number | Step of an operation.<br>Default value: **0.5**<br>Since API version 9, this API is supported in ArkTS widgets.|
| starStyle | {<br>backgroundUri: string,<br>foregroundUri: string,<br>secondaryUri?: string<br>} | **backgroundUri**: image link of the unselected star. You can use the default image or a custom local image.<br>**foregroundUri**: image path of the selected star. You can use the default image or a custom local image.<br>**secondaryUir**: image path of the partially selected star. You can use the default image or a custom local image.<br>Since API version 9, this API is supported in ArkTS widgets.| | starStyle | {<br>backgroundUri: string,<br>foregroundUri: string,<br>secondaryUri?: string<br>} | Star style.<br>**backgroundUri**: image path for the unselected star. You can use the default system image or a custom image.<br>**foregroundUri**: image path for the selected star. You can use the default system image or a custom image.<br>**secondaryUir**: image path for the partially selected star. You can use the default system image or a custom image.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>For details about the image types supported by the **startStyle** attribute, see [Image](ts-basic-components-image.md).<br>Local and online images are supported, but not **PixelMap** and **Resource** objects.<br>By default, the image is loaded in asynchronous mode. Synchronous loading is not supported.|
## Events ## Events
......
...@@ -50,7 +50,7 @@ Except touch target attributes, the universal attributes are supported. ...@@ -50,7 +50,7 @@ Except touch target attributes, the universal attributes are supported.
| trackColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the slider.<br>Since API version 9, this API is supported in ArkTS widgets.| | trackColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the slider.<br>Since API version 9, this API is supported in ArkTS widgets.|
| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the selected part of the slider track.<br>Since API version 9, this API is supported in ArkTS widgets.| | selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the selected part of the slider track.<br>Since API version 9, this API is supported in ArkTS widgets.|
| showSteps | boolean | Whether to display the current step.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.| | showSteps | boolean | Whether to display the current step.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.|
| showTips | boolean | Whether to display a bubble to indicate the percentage when the user drags the slider.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.| | showTips | boolean | Whether to display a bubble to indicate the percentage when the user drags the slider.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>When **direction** is set to **Axis.Horizontal**, the bubble is displayed right above the slider. When **direction** is set to **Axis.Vertical**, the bubble is displayed on the left of the slider.<br>The drawing area of the bubble is the overlay of the slider.<br>If no margin is set for the slider or the margin is not large enough, the bubble will be clipped.|
| trackThickness | [Length](ts-types.md#length) | Track thickness of the slider.<br>Since API version 9, this API is supported in ArkTS widgets.| | trackThickness | [Length](ts-types.md#length) | Track thickness of the slider.<br>Since API version 9, this API is supported in ArkTS widgets.|
...@@ -60,7 +60,7 @@ In addition to the **OnAppear** and **OnDisAppear** universal events, the follow ...@@ -60,7 +60,7 @@ In addition to the **OnAppear** and **OnDisAppear** universal events, the follow
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| onChange(callback: (value: number, mode: SliderChangeMode) =&gt; void) | Invoked when the slider slides.<br>**value**: current slider value. If the return value contains decimals, you can use **Math.toFixed()** to process the data to the desired precision.<br>**mode**: dragging state.<br>Since API version 9, this API is supported in ArkTS widgets.| | onChange(callback: (value: number, mode: SliderChangeMode) =&gt; void) | Invoked when the slider is dragged or clicked.<br>**value**: current slider value. If the return value contains decimals, you can use **Math.toFixed()** to process the data to the desired precision.<br>**mode**: state triggered by the event.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The **Begin** and **End** states are triggered when the slider is clicked with a gesture. The **Moving** and **Click** states are triggered when the value of **value** changes.<br>If the coherent action is a drag action, the **Click** state will not be triggered.<br>The value range of **value** is the **steps** value array.|
## SliderChangeMode ## SliderChangeMode
...@@ -68,9 +68,9 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -68,9 +68,9 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name| Value| Description| | Name| Value| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| Begin | 0 | The user starts to drag the slider.| | Begin | 0 | The user touches or presses the slider with a gesture or mouse.|
| Moving | 1 | The user is dragging the slider.| | Moving | 1 | The user is dragging the slider.|
| End | 2 | The user stops dragging the slider.| | End | 2 | The user stops dragging the slider by lifting their finger or releasing the mouse.|
| Click | 3 | The user moves the slider by touching the slider track.| | Click | 3 | The user moves the slider by touching the slider track.|
......
...@@ -38,6 +38,10 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -38,6 +38,10 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| inputFilter<sup>8+</sup> | {<br>value: [ResourceStr](ts-types.md#resourcestr),<br>error?: (value: string) => void<br>} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.<br>- **value**: regular expression to set.<br>- **error**: filtered-out content to return when regular expression matching fails.| | inputFilter<sup>8+</sup> | {<br>value: [ResourceStr](ts-types.md#resourcestr),<br>error?: (value: string) => void<br>} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.<br>- **value**: regular expression to set.<br>- **error**: filtered-out content to return when regular expression matching fails.|
| copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.<br>If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.| | copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.<br>If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.|
> **NOTE**
>
> The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows: { top: 8 vp, right: 16 vp, bottom: 8 vp, left: 16 vp }
## Events ## Events
...@@ -72,7 +76,6 @@ Sets the position of the caret. ...@@ -72,7 +76,6 @@ Sets the position of the caret.
| ------ | -------- | ---- | -------------------------------------- | | ------ | -------- | ---- | -------------------------------------- |
| value | number | Yes | Length from the start of the string to the position where the caret is located.| | value | number | Yes | Length from the start of the string to the position where the caret is located.|
## Example ## Example
```ts ```ts
...@@ -86,6 +89,7 @@ struct TextAreaExample { ...@@ -86,6 +89,7 @@ struct TextAreaExample {
build() { build() {
Column() { Column() {
TextArea({ TextArea({
text: this.text,
placeholder: 'The text area can hold an unlimited amount of text. input your word...', placeholder: 'The text area can hold an unlimited amount of text. input your word...',
controller: this.controller controller: this.controller
}) })
......
...@@ -31,18 +31,22 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -31,18 +31,22 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name | Type | Description | | Name | Type | Description |
| ------------------------ | ---------------------------------------- | ---------------------------------------- | | ------------------------ | ---------------------------------------- | ---------------------------------------- |
| type | InputType | Input box type.<br>Default value: **InputType.Normal** | | type | InputType | Input box type.<br>Default value: **InputType.Normal** |
| placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | Placeholder text color.| | placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | Placeholder text color.|
| placeholderFont | [Font](ts-types.md#font) | Placeholder text font.| | placeholderFont | [Font](ts-types.md#font) | Placeholder text font.|
| enterKeyType | EnterKeyType | Type of the Enter key. Currently, only the default value is supported.<br>Default value: **EnterKeyType.Done**| | enterKeyType | EnterKeyType | Type of the Enter key. Only the default value is supported.<br>Default value: **EnterKeyType.Done**|
| caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. | | caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. |
| maxLength | number | Maximum number of characters in the text input. | | maxLength | number | Maximum number of characters in the text input. |
| inputFilter<sup>8+</sup> | {<br>value: [ResourceStr](ts-types.md#resourcestr),<br>error?: (value: string) =&gt; void<br>} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.<br>- **value**: regular expression to set.<br>- **error**: filtered-out content to return when regular expression matching fails.| | inputFilter<sup>8+</sup> | {<br>value: [ResourceStr](ts-types.md#resourcestr),<br>error?: (value: string) =&gt; void<br>} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The regular expression can match single characters, but not strings.<br>- **value**: regular expression to set.<br>- **error**: filtered-out content to return when regular expression matching fails.|
| copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.<br>If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.| | copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.<br>If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.|
| showPasswordIcon<sup>9+</sup> | boolean | Whether to display the show password icon at the end of the password text box.<br>Default value: **true**| | showPasswordIcon<sup>9+</sup> | boolean | Whether to display the show password icon at the end of the password text box.<br>Default value: **true**|
| style<sup>9+</sup> | TextInputStyle | Text input style.<br>Default value: **TextInputStyle.Default**| | style<sup>9+</sup> | TextInputStyle | Text input style.<br>Default value: **TextInputStyle.Default**|
| textAlign<sup>9+</sup> | [TextAlign](ts-appendix-enums.md#textalign) | Alignment mode of the text in the text box.<br>Default value: **TextAlign.Start** | | textAlign<sup>9+</sup> | [TextAlign](ts-appendix-enums.md#textalign) | Alignment mode of the text in the text box.<br>Default value: **TextAlign.Start** |
> **NOTE**
>
> The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows: <br>{<br> top: 8 vp,<br> right: 16 vp,<br> bottom: 16 vp,<br> left: 8 vp<br> }
## EnterKeyType ## EnterKeyType
| Name | Description | | Name | Description |
...@@ -74,12 +78,12 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -74,12 +78,12 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
In addition to the [universal events](ts-universal-events-click.md), the following events are supported. In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
| Name | Description | | Name | Description |
| ---------------------------------------- | ---------------------------------------- | | ------------------------------------------------------------ | ------------------------------------------------------------ |
| onChange(callback: (value: string) =&gt; void) | Triggered when the input changes. | | onChange(callback: (value: string) =&gt; void) | Triggered when the input changes.<br>**value**: text content.|
| onSubmit(callback: (enterKey: EnterKeyType) =&gt; void) | Triggered when the Enter key on the keyboard is pressed. The return value is the current type of the Enter key. | | onSubmit(callback: (enterKey: EnterKeyType) =&gt; void) | Triggered when the Enter key on the keyboard is pressed. The return value is the current type of the Enter key.<br>**enterKeyType**: type of the Enter key. For details, see [EnterKeyType](#enterkeytype).|
| onEditChanged(callback: (isEditing: boolean) =&gt; void)<sup>(deprecated)</sup> | Triggered when the input status changes. Sicne API version 8, **onEditChange** is recommended. | | onEditChanged(callback: (isEditing: boolean) =&gt; void)<sup>(deprecated)</sup> | Triggered when the input status changes. Since API version 8, **onEditChange** is recommended.|
| onEditChange(callback: (isEditing: boolean) =&gt; void)<sup>8+</sup> | Triggered when the input status changes. If the value of **isEditing** is **true**, text input is in progress. | | onEditChange(callback: (isEditing: boolean) =&gt; void)<sup>8+</sup> | Triggered when the input status changes. If the value of **isEditing** is **true**, text input is in progress. |
| onCopy(callback:(value: string) =&gt; void)<sup>8+</sup> | Triggered when the copy button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>**value**: text to be copied.| | onCopy(callback:(value: string) =&gt; void)<sup>8+</sup> | Triggered when the copy button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>**value**: text to be copied.|
| onCut(callback:(value: string) =&gt; void)<sup>8+</sup> | Triggered when the cut button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>**value**: text to be cut.| | onCut(callback:(value: string) =&gt; void)<sup>8+</sup> | Triggered when the cut button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>**value**: text to be cut.|
| onPaste(callback:(value: string) =&gt; void)<sup>8+</sup> | Triggered when the paste button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>**value**: text to be pasted.| | onPaste(callback:(value: string) =&gt; void)<sup>8+</sup> | Triggered when the paste button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>**value**: text to be pasted.|
...@@ -104,7 +108,6 @@ Sets the position of the caret. ...@@ -104,7 +108,6 @@ Sets the position of the caret.
| ------ | -------- | ---- | -------------------------------------- | | ------ | -------- | ---- | -------------------------------------- |
| value | number | Yes | Length from the start of the string to the position where the caret is located.| | value | number | Yes | Length from the start of the string to the position where the caret is located.|
## Example ## Example
```ts ```ts
...@@ -117,7 +120,7 @@ struct TextInputExample { ...@@ -117,7 +120,7 @@ struct TextInputExample {
build() { build() {
Column() { Column() {
TextInput({ placeholder: 'input your word...', controller: this.controller }) TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller })
.placeholderColor(Color.Grey) .placeholderColor(Color.Grey)
.placeholderFont({ size: 14, weight: 400 }) .placeholderFont({ size: 14, weight: 400 })
.caretColor(Color.Blue) .caretColor(Color.Blue)
......
...@@ -35,21 +35,23 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -35,21 +35,23 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name | Description | | Name | Description |
| -------- | ---------------- | | -------- | ---------------- |
| Checkbox | Check box type.<br>**NOTE**<br>The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows:<br>{<br> top: 14 vp,<br> right: 6 vp,<br> bottom: 14 vp,<br> left: 6 vp<br> } | | Checkbox | Check box type.<br>**NOTE**<br>The default value of the universal attribute [margin](ts-universal-attributes-size.md) is as follows:<br>{<br> top: 12 vp,<br> right: 12 vp,<br> bottom: 12 vp,<br> left: 12 vp<br> } |
| Button | Button type. The set string, if any, will be displayed inside the button. | | Button | Button type. The set string, if any, will be displayed inside the button. |
| Switch | Switch type.<br>**NOTE**<br>The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows:<br>{<br> top: 12 vp,<br> right: 12 vp,<br> bottom: 12 vp,<br> left: 12 vp<br> } | | Switch | Switch type.<br>**NOTE**<br>The default value of the universal attribute [margin](ts-universal-attributes-size.md) is as follows:<br>{<br> top: 14 vp,<br> right:6 vp,<br> bottom: 6 vp,<br> left: 14 vp<br> } |
## Attributes ## Attributes
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name | Parameter | Description | | Name | Parameter | Description |
| ---------------- | --------------------------- | ---------------------- | | ---------------- | --------------------------- | ---------------------- |
| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the component when it is turned on.<br>Since API version 9, this API is supported in ArkTS widgets.| | selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the component when it is turned on.<br>Since API version 9, this API is supported in ArkTS widgets.|
| switchPointColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the circular slider when the component is of the **Switch** type.<br>**NOTE**<br>This attribute is valid only when **type** is set to **ToggleType.Switch**.<br>Since API version 9, this API is supported in ArkTS widgets.| | switchPointColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the circular slider when the component is of the **Switch** type.<br>**NOTE**<br>This attribute is valid only when **type** is set to **ToggleType.Switch**.<br>Since API version 9, this API is supported in ArkTS widgets.|
## Events ## Events
In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| onChange(callback: (isOn: boolean) =&gt; void) | Triggered when the toggle status changes.<br>Since API version 9, this API is supported in ArkTS widgets.| | onChange(callback: (isOn: boolean) =&gt; void) | Triggered when the toggle status changes.<br>Since API version 9, this API is supported in ArkTS widgets.|
......
...@@ -17,7 +17,7 @@ PanGesture(value?: { fingers?: number; direction?: PanDirection; distance?: numb ...@@ -17,7 +17,7 @@ PanGesture(value?: { fingers?: number; direction?: PanDirection; distance?: numb
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| fingers | number | No| Minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10.<br>Default value: **1**| | fingers | number | No| Minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10.<br>Default value: **1**<br>Value range: 1 to 10<br>**NOTE**<br>If the value is less than 1 or is not set, the default value is used.|
| direction | PanDirection | No| Pan direction. The enumerated value supports the AND (&amp;) and OR (\|) operations.<br>Default value: **PanDirection.All**| | direction | PanDirection | No| Pan direction. The enumerated value supports the AND (&amp;) and OR (\|) operations.<br>Default value: **PanDirection.All**|
| distance | number | No| Minimum pan distance to trigger the gesture, in vp.<br>Default value: **5**<br>**NOTE**<br>If a pan gesture and [tab](ts-container-tabs.md) swipe occur at the same time, set **distance** to **1** so that the gesture can be more easily recognized.| | distance | number | No| Minimum pan distance to trigger the gesture, in vp.<br>Default value: **5**<br>**NOTE**<br>If a pan gesture and [tab](ts-container-tabs.md) swipe occur at the same time, set **distance** to **1** so that the gesture can be more easily recognized.|
......
# TapGesture # TapGesture
**TapGesture** is used to trigger a tap gesture with one or more taps. **TapGesture** is used to trigger a tap gesture with one, two, or more taps.
> **NOTE** > **NOTE**
> >
...@@ -15,8 +15,8 @@ TapGesture(value?: { count?: number, fingers?: number }) ...@@ -15,8 +15,8 @@ TapGesture(value?: { count?: number, fingers?: number })
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| count | number | No| Number of consecutive taps. If this parameter is set to a value less than **1**, the default value will be used.<br>Default value: **1**<br>> **NOTE**<br>> If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms.| | count | number | No| Number of consecutive taps. If the value is less than 1 or is not set, the default value is used.<br>Default value: **1**<br>**NOTE**<br>If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms.|
| fingers | number | No| Number of fingers required to trigger a tap. The value ranges from 1 to 10.<br>Default value: **1**<br>> **NOTE**<br>> 1. When multi-finger is configured, the gesture will fail to be recognized if the number of fingers used for tapping is less than the configured number within 300 ms of tapping by the first finger.<br>> 2. The gesture will fail to be recognized if the number of fingers used for tapping exceeds the configured number.| | fingers | number | No| Number of fingers required to trigger a tap. The value ranges from 1 to 10. If the value is less than 1 or is not set, the default value is used.<br>Default value: **1**<br>**NOTE**<br>1. When multi-finger is configured, if the number of fingers used for tap does not reach the specified number within 300 ms after the first finger is tapped, the gesture fails to be recognized.<br>2. Gesture recognition fails if the number of fingers used for tap exceeds the configured number.|
## Events ## Events
......
...@@ -6,6 +6,7 @@ The **\<Flex>** component allows for flexible layout of child components. ...@@ -6,6 +6,7 @@ The **\<Flex>** component allows for flexible layout of child components.
> >
> - This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > - This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
> - The **\<Flex>** component adapts the layout of flex items during rendering. This may affect the performance. Therefore, you are advised to use **[\<Column>](ts-container-column.md)** or **[\<Row>](ts-container-row.md)** instead under scenarios where consistently high performance is required. > - The **\<Flex>** component adapts the layout of flex items during rendering. This may affect the performance. Therefore, you are advised to use **[\<Column>](ts-container-column.md)** or **[\<Row>](ts-container-row.md)** instead under scenarios where consistently high performance is required.
> - If the main axis of the **\<Flex>** component is not set, it follows the size of the parent container. On the contrary, if the main axis of the [\<Column>](ts-container-column.md) or [\<Row>](ts-container-row.md) component is not set, it follows the size of their child component.
## Child Components ## Child Components
......
...@@ -42,7 +42,7 @@ struct AnimateToExample { ...@@ -42,7 +42,7 @@ struct AnimateToExample {
build() { build() {
Column() { Column() {
Button('change width and height') Button('change size')
.width(this.widthSize) .width(this.widthSize)
.height(this.heightSize) .height(this.heightSize)
.margin(30) .margin(30)
...@@ -57,8 +57,8 @@ struct AnimateToExample { ...@@ -57,8 +57,8 @@ struct AnimateToExample {
console.info('play end') console.info('play end')
} }
}, () => { }, () => {
this.widthSize = 100 this.widthSize = 150
this.heightSize = 50 this.heightSize = 60
}) })
} else { } else {
animateTo({}, () => { animateTo({}, () => {
...@@ -77,7 +77,7 @@ struct AnimateToExample { ...@@ -77,7 +77,7 @@ struct AnimateToExample {
curve: Curve.Friction, curve: Curve.Friction,
delay: 500, delay: 500,
iterations: -1, // The value -1 indicates that the animation is played for an unlimited number of times. iterations: -1, // The value -1 indicates that the animation is played for an unlimited number of times.
playMode: PlayMode.AlternateReverse, playMode: PlayMode.Alternate,
onFinish: () => { onFinish: () => {
console.info('play end') console.info('play end')
} }
...@@ -90,10 +90,4 @@ struct AnimateToExample { ...@@ -90,10 +90,4 @@ struct AnimateToExample {
} }
``` ```
The figure below shows two buttons in their initial state. ![animation1](figures/animation1.gif)
![animation](figures/animation.PNG)
Clicking the first button plays the animation of resizing the button, and clicking the second button plays the animation of rotating the button clockwise by 90 degrees. The figure below shows the two buttons when the animations have finished.
![animation1](figures/animation1.PNG)
...@@ -118,9 +118,9 @@ Requests full-screen mode. ...@@ -118,9 +118,9 @@ Requests full-screen mode.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description |
| ----- | ------- | ---- | --------------------- | | ------ | -------- | ---- | -------------------------------------------------- |
| value | boolean | Yes | Whether the playback is in full-screen mode.<br>Default value: **false**| | value | boolean | Yes | Whether to play the video in full screen mode within the application window.<br>Default value: **false**|
### exitFullscreen ### exitFullscreen
...@@ -173,7 +173,7 @@ struct VideoCreateComponent { ...@@ -173,7 +173,7 @@ struct VideoCreateComponent {
previewUri: this.previewUri, previewUri: this.previewUri,
currentProgressRate: this.curRate, currentProgressRate: this.curRate,
controller: this.controller controller: this.controller
}).width(800).height(600) }).width('100%').height(600)
.autoPlay(this.isAutoPlay) .autoPlay(this.isAutoPlay)
.controls(this.showControls) .controls(this.showControls)
.onStart(() => { .onStart(() => {
...@@ -186,7 +186,7 @@ struct VideoCreateComponent { ...@@ -186,7 +186,7 @@ struct VideoCreateComponent {
console.info('onFinish') console.info('onFinish')
}) })
.onError(() => { .onError(() => {
console.info('onFinish') console.info('onError')
}) })
.onPrepared((e) => { .onPrepared((e) => {
console.info('onPrepared is ' + e.duration) console.info('onPrepared is ' + e.duration)
......
...@@ -11,7 +11,7 @@ The motion path animation is used to animate a component along a custom path. ...@@ -11,7 +11,7 @@ The motion path animation is used to animate a component along a custom path.
| Name| Type| Default Value| Description| | Name| Type| Default Value| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| motionPath | {<br>path: string,<br>from?: number,<br>to?: number,<br>rotatable?: boolean<br>}<br>**NOTE**<br>In a path, **start** and **end** can be used to replace the start point and end point. Example:<br>'Mstart.x start.y L50 50 Lend.x end.y Z'<br>For more information, see [Path Drawing](../../ui/ui-js-components-svg-path.md).| {<br>'',<br>0.0,<br>1.0,<br>false<br>} | Motion path of the component.<br>- **path**: motion path of the translation animation. The value is an SVG path string.<br>- **from**: start point of the motion path. The default value is **0.0**.<br>- **to**: end point of the motion path. The default value is **1.0**.<br>- **rotatable**: whether to rotate along the path. | | motionPath | {<br>path:&nbsp;string,<br>from?:&nbsp;number,<br>to?:&nbsp;number,<br>rotatable?:&nbsp;boolean<br>}<br>**NOTE**<br>In a path, **start** and **end** can be used to replace the start point and end point. Example:<br>'Mstart.x&nbsp;start.y&nbsp;L50&nbsp;50&nbsp;Lend.x&nbsp;end.y&nbsp;Z'<br>For more information, see [Path Drawing](../../ui/ui-js-components-svg-path.md).| {<br>'',<br>0.0,<br>1.0,<br>false<br>} | Motion path of the component.<br>- **path**: motion path of the translation animation. The value is an SVG path string.<br>- **from**: start point of the motion path.<br>Default value: **0.0**<br>Value range: [0, 1]<br>A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.<br>- **to**: end point of the motion path.<br>Default value: **1.0**<br>Value range: [0, 1]<br>A value less than 0 evaluates to the value **0**. A value larger than 1 evaluates to the value **1**.<br>- **rotatable**: whether to rotate along the path. |
## Example ## Example
...@@ -25,7 +25,7 @@ struct MotionPathExample { ...@@ -25,7 +25,7 @@ struct MotionPathExample {
build() { build() {
Column() { Column() {
Button('click me') Button('click me').margin(50)
// Execute the animation: Move from the start point to (300,200), then to (300,500), and finally to the end point. // Execute the animation: Move from the start point to (300,200), then to (300,500), and finally to the end point.
.motionPath({ path: 'Mstart.x start.y L300 200 L300 500 Lend.x end.y', from: 0.0, to: 1.0, rotatable: true }) .motionPath({ path: 'Mstart.x start.y L300 200 L300 500 Lend.x end.y', from: 0.0, to: 1.0, rotatable: true })
.onClick(() => { .onClick(() => {
...@@ -38,4 +38,4 @@ struct MotionPathExample { ...@@ -38,4 +38,4 @@ struct MotionPathExample {
} }
``` ```
![en-us_image_0000001212378420](figures/en-us_image_0000001212378420.gif) ![en-us_image_0000001174104400](figures/en-us_image_0000001174104400.gif)
# Page Transition # Page Transition
The page transition navigates users between pages. You can customize page transitions by configuring the page entrance and exit components in the global **pageTransition** API. The page transition navigates users between pages. You can customize page transitions by configuring the page entrance and exit components in the **pageTransition** API.
> **NOTE** > **NOTE**
> >
...@@ -8,12 +8,12 @@ The page transition navigates users between pages. You can customize page transi ...@@ -8,12 +8,12 @@ The page transition navigates users between pages. You can customize page transi
> >
| Name | Parameter | Description | | Name | Parameter | Mandatory| Description |
| ------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| PageTransitionEnter | {<br>type?: RouteType,<br>duration?: number,<br>curve?: [Curve](ts-appendix-enums.md#curve) \| string,<br>delay?: number<br>} | Page entrance animation.<br>- **type**: route type for the page transition effect to take effect.<br>Default value: **RouteType.None**<br>**Note**: If no match is found, the default page transition effect is used (which may vary according to the device). To disable the default page transition effect, set **duration** to **0**.<br>- **duration**: animation duration, in milliseconds.<br>- **curve**: animation curve. The value of the string type can be any of the following: "ease", "ease-in", "ease-out", "ease-in-out", "extreme-deceleration", "fast-out-linear-in", "fast-out-slow-in", "friction", "linear", "linear-out-slow-in", "rhythm", "sharp", "smooth".<br>Default value: **Curve.Linear**<br>- **delay**: animation delay, in milliseconds. By default, the animation is played without delay.| | PageTransitionEnter | {<br>type?: RouteType,<br>duration?: number,<br>curve?: [Curve](ts-appendix-enums.md#curve) \| string,<br>delay?: number<br>} | No | Page entrance animation.<br>- **type**: route type for the page transition effect to take effect.<br>Default value: **RouteType.None**<br>**NOTE**<br>If no match is found, the default page transition effect is used (which may vary according to the device). To disable the default page transition effect, set **duration** to **0**.<br>- **duration**: animation duration.<br>Unit: ms<br>- **curve**: animation curve. The value of the string type can be any of the following: "ease", "ease-in", "ease-out", "ease-in-out", "extreme-deceleration", "fast-out-linear-in", "fast-out-slow-in", "friction", "linear", "linear-out-slow-in", "rhythm", "sharp", "smooth".<br>Default value: **Curve.Linear**<br>- **delay**: animation delay.<br>Default value: **0**<br>Unit: ms|
| PageTransitionExit | {<br>type?: RouteType,<br>duration?: number,<br>curve?: [Curve](ts-appendix-enums.md#curve) \| string,<br>delay?: number<br>} | Page exit animation.<br>- **type**: route type for the page transition effect to take effect.<br>Default value: **RouteType.None**<br>**Note**: If no match is found, the default page transition effect is used (which may vary according to the device). To disable the default page transition effect, set **duration** to **0**.<br>- **duration**: animation duration, in milliseconds.<br>- **curve**: animation curve. The value range of the string type is the same as that of **PageTransitionEnter**.<br>Default value: **Curve.Linear**<br>- **delay**: animation delay, in milliseconds. By default, the animation is played without delay.| | PageTransitionExit | {<br>type?: RouteType,<br>duration?: number,<br>curve?: [Curve](ts-appendix-enums.md#curve) \| string,<br>delay?: number<br>} | No | Page exit animation.<br>- **type**: route type for the page transition effect to take effect.<br>Default value: **RouteType.None**<br>**NOTE**<br>If no match is found, the default page transition effect is used (which may vary according to the device). To disable the default page transition effect, set **duration** to **0**.<br>- **duration**: animation duration, in milliseconds.<br>- **curve**: animation curve. The value range of the string type is the same as that of **PageTransitionEnter**.<br>Default value: **Curve.Linear**<br>- **delay**: animation delay.<br>Default value: **0**<br>Unit: ms|
## RouteType enums ## RouteType
| Name| Description | | Name| Description |
| ---- | ------------------------------------------------------------ | | ---- | ------------------------------------------------------------ |
...@@ -28,7 +28,7 @@ The page transition navigates users between pages. You can customize page transi ...@@ -28,7 +28,7 @@ The page transition navigates users between pages. You can customize page transi
| --------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | --------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| slide | [SlideEffect](#slideeffect) | No | Slide effect during page transition.<br>Default value: **SlideEffect.Right**| | slide | [SlideEffect](#slideeffect) | No | Slide effect during page transition.<br>Default value: **SlideEffect.Right**|
| translate | {<br>x? : number \| string,<br>y? : number \| string,<br>z? : number \| string<br>} | No | Translation effect during page transition, which is the value of the start point of entrance and the end point of exit. When this parameter is set together with **slide**, the latter takes effect by default.<br>- **x**: translation distance along the x-axis.<br>- **y**: translation distance along the y-axis.<br>- **z**: translation distance along the y-axis.| | translate | {<br>x? : number \| string,<br>y? : number \| string,<br>z? : number \| string<br>} | No | Translation effect during page transition, which is the value of the start point of entrance and the end point of exit. When this parameter is set together with **slide**, the latter takes effect by default.<br>- **x**: translation distance along the x-axis.<br>- **y**: translation distance along the y-axis.<br>- **z**: translation distance along the y-axis.|
| scale | {<br>x? : number,<br>y? : number,<br>z? : number,<br>centerX? : number \| string,<br>centerY? : number \| string<br>} | No | Scaling effect during page transition, which is the value of the start point of entrance and the end point of exit.<br>- **x**: scale ratio along the x-axis.<br>- **y**: scale ratio along the y-axis.<br>- **z**: scale ratio along the z-axis.<br>- **centerX** and **centerY**: scale center point.<br>- If the center point is 0, it refers to the upper left corner of the component.<br>| | scale | {<br>x? : number,<br>y? : number,<br>z? : number,<br>centerX? : number \| string,<br>centerY? : number \| string<br>} | No | Scaling effect during page transition, which is the value of the start point of entrance and the end point of exit.<br>- **x**: scale ratio along the x-axis.<br>- **y**: scale ratio along the y-axis.<br>- **z**: scale ratio along the z-axis.<br>- **centerX** and **centerY**: scale center point.<br>- If the center point is 0, it refers to the upper left corner of the component. |
| opacity | number | No | Opacity, which is the opacity value of the start point of entrance or the end point of exit.<br>Default value: **1**| | opacity | number | No | Opacity, which is the opacity value of the start point of entrance or the end point of exit.<br>Default value: **1**|
## SlideEffect ## SlideEffect
...@@ -43,10 +43,10 @@ The page transition navigates users between pages. You can customize page transi ...@@ -43,10 +43,10 @@ The page transition navigates users between pages. You can customize page transi
## Events ## Events
| Name | Description | | Name | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------------------------------------ | ------------------------------------------------------------ |
| onEnter(event: (type?: RouteType, progress?: number) =&gt; void) | The callback input parameter is the normalized progress of the current entrance animation. The value range is 0–1.<br>- **type**: route type.<br>- **progress**: current progress.| | onEnter(event: (type?: RouteType, progress?: number) =&gt; void) | Invoked once every animation frame until the entrance animation ends, when the value of **progress** changes from 0 to 1. The input parameter is the normalized progress of the current entrance animation. The value range is 0–1.<br>- **type**: route type.<br>- **progress**: current progress. |
| onExit(event: (type?: RouteType, progress?: number) =&gt; void) | The callback input parameter is the normalized progress of the current exit animation. The value range is 0–1.<br>- **type**: route type.<br>- **progress**: current progress.| | onExit(event: (type?: RouteType, progress?: number) =&gt; void) | Invoked once every animation frame until the exit animation ends, when the value of **progress** changes from 0 to 1. The input parameter is the normalized progress of the current exit animation. The value range is 0–1.<br>- **type**: route type.<br>- **progress**: current progress. |
## Example ## Example
......
...@@ -12,17 +12,17 @@ Configure the component transition animations for when a component is inserted o ...@@ -12,17 +12,17 @@ Configure the component transition animations for when a component is inserted o
| Name| Type| Description| | Name| Type| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| transition | TransitionOptions | Transition parameters, which are all optional. For details, see **TransitionOptions**.| | transition | TransitionOptions | Transition effects when the component is inserted, displayed, deleted, or hidden.<br>If no transition effect is set, an opacity transition from 0 to 1 is applied. <br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>Transition parameters, which are all optional. For details, see **TransitionOptions**.|
## TransitionOptions ## TransitionOptions
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | [TransitionType](ts-appendix-enums.md#transitiontype) | No| Transition type, which includes component addition and deletion by default.<br>Default value: **TransitionType.All**<br>**NOTE**<br>If **type** is not specified, insertion and deletion use the same transition type.| | type | [TransitionType](ts-appendix-enums.md#transitiontype) | No| Transition type, which includes component addition and deletion by default.<br>Default value: **TransitionType.All**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>If **type** is not specified, insertion and deletion use the same transition type.|
| opacity | number | No| Opacity of the component during transition, which is the value of the start point of insertion and the end point of deletion.<br>Default value: **1**| | opacity | number | No| Opacity of the component during transition, which is the value of the start point of insertion and the end point of deletion.<br>Default value: **1**<br>Value range: [0, 1]<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.|
| translate | {<br>x? : number \| string,<br>y? : number \| string,<br>z? : number \| string<br>} | No| Translation of the component during transition, which is the value of the start point of insertion and the end point of deletion.<br>-**x**: distance to translate along the x-axis.<br>-**y**: distance to translate along the y-axis.<br>-**z**: distance to translate along the z-axis.| | translate | {<br>x? : number \| string,<br>y? : number \| string,<br>z? : number \| string<br>} | No| Translation of the component during transition, which is the value of the start point of insertion and the end point of deletion.<br>-**x**: distance to translate along the x-axis.<br>-**y**: distance to translate along the y-axis.<br>-**z**: distance to translate along the z-axis.<br>Since API version 9, this API is supported in ArkTS widgets.|
| scale | {<br>x? : number,<br>y? : number,<br>z? : number,<br>centerX? : number \| string,<br>centerY? : number \| string<br>} | No| Scaling of the component during transition, which is the value of the start point of insertion and the end point of deletion.<br>- **x**: scale factor along the x-axis.<br>- **y**: scale factor along the y-axis.<br>- **z**: scale factor along the z-axis.<br>- **centerX** and **centerY**: x coordinate and y coordinate of the scale center, respectively. The default values are both **"50%"**.<br>- If the center point is 0, it indicates the upper left corner of the component.<br>| | scale | {<br>x? : number,<br>y? : number,<br>z? : number,<br>centerX? : number \| string,<br>centerY? : number \| string<br>} | No| Scaling of the component during transition, which is the value of the start point of insertion and the end point of deletion.<br>- **x**: scale factor along the x-axis.<br>- **y**: scale factor along the y-axis.<br>- **z**: scale factor along the z-axis.<br>- **centerX** and **centerY**: x coordinate and y coordinate of the scale center, respectively. The default values are both **"50%"**.<br>- If the center point is 0, it indicates the upper left corner of the component.<br>Since API version 9, this API is supported in ArkTS widgets.|
| rotate | {<br>x?: number,<br>y?: number,<br>z?: number,<br>angle?: number \| string,<br>centerX?: number \| string,<br>centerY?: number \| string<br>} | No| Rotation of the component during transition, which is the value of the start point of insertion and the end point of deletion.<br>- **x**: rotation vector along the x-axis.<br>- **y**: rotation vector along the y-axis.<br>- **z**: rotation vector along the z-axis.<br>- **centerX** and **centerY**: x coordinate and y coordinate of the rotation center, respectively. The default values are both **"50%"**.<br>- If the center point is (0, 0), it indicates the upper left corner of the component.| | rotate | {<br>x?: number,<br>y?: number,<br>z?: number,<br>angle?: number \| string,<br>centerX?: number \| string,<br>centerY?: number \| string<br>} | No| Rotation of the component during transition, which is the value of the start point of insertion and the end point of deletion.<br>- **x**: rotation vector along the x-axis.<br>- **y**: rotation vector along the y-axis.<br>- **z**: rotation vector along the z-axis.<br>- **centerX** and **centerY**: x coordinate and y coordinate of the rotation center, respectively. The default values are both **"50%"**.<br>- If the center point is (0, 0), it indicates the upper left corner of the component.<br>Since API version 9, this API is supported in ArkTS widgets.|
## Example ## Example
......
# Transition of Shared Elements # Shared Element Transition
Shared element transition can be used for transition between pages, for example, transition from an image on the current page to the next page. A shared element transition is a transition animation applied to a component that is present on two pages. This component is called the shared element and can be set in the **sharedTransition** attribute.
> **NOTE** > **NOTE**
> >
...@@ -10,14 +10,14 @@ Shared element transition can be used for transition between pages, for example, ...@@ -10,14 +10,14 @@ Shared element transition can be used for transition between pages, for example,
## Attributes ## Attributes
| Name | Parameters | Description | | Name | Parameter | Description |
| ---------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | ---------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| sharedTransition | id: string,<br>{<br> duration?: number,<br> curve?: Curve \| string,<br> delay?: number,<br> motionPath?: <br>{<br> path: string,<br> form?: number,<br> to?: number,<br> rotatable?: boolean<br>},<br>zIndex?: number,<br>type?: [SharedTransitionEffectType](ts-appendix-enums.md#sharedtransitioneffecttype)<br>} | Transition of the shared element. If the same **id** value is configured for a component on the two pages, this component is considered as a shared element of the pages. If the **id** value is an empty string, no transition will be applied to the component.<br>- **id**: component ID.<br>- **duration**: animation duration, in ms. The default duration is 1000 ms.<br>- **curve**: animation curve. The default curve is **Linear**. For details about the valid values, see [Curve](ts-animatorproperty.md).<br>- **delay**: Delay of animation playback, in ms. By default, the playback is not delayed.<br>- **motionPath**: motion path information. For details, see [Motion Path Animation](ts-motion-path-animation.md).<br>- **path**: path.<br>- **from**: start value.<br>- **to**: end value.<br>- **rotatable**: whether to rotate.<br>- **zIndex**: z-axis.<br>- **type**: animation type.| | sharedTransition | id: string,<br>{<br> duration?: number,<br> curve?: Curve \| string,<br> delay?: number,<br> motionPath?: <br>{<br> path: string,<br> form?: number,<br> to?: number,<br> rotatable?: boolean<br>},<br>zIndex?: number,<br>type?: [SharedTransitionEffectType](ts-appendix-enums.md#sharedtransitioneffecttype)<br>} | Transition of the shared element. If the same **id** value is configured for a component on the two pages, this component is considered as a shared element of the pages. If the **id** value is an empty string, no transition will be applied to the component.<br>- **id**: component ID.<br>- **duration**: animation duration.<br>Default value: **1000**<br>Unit: ms<br>Value range: [0, +∞)<br>The value **0** indicates that no animation is applied. A value less than 0 evaluates to the value **0**.<br>- **curve**: animation curve. The default curve is **Linear**. For details about the valid values, see [Curve](ts-animatorproperty.md).<br>- **delay**: animation delay.<br>Default value: **0**<br>Unit: ms<br>Value range: [0, +∞)<br>A value less than 0 evaluates to the value **0**.<br>- **motionPath**: motion path information. For details, see [Motion Path Animation](ts-motion-path-animation.md).<br>- **path**: path.<br>- **from**: start value.<br>- **to**: end value.<br>- **rotatable**: whether to rotate.<br>- **zIndex**: z-axis.<br>- **type**: animation type.|
## Example ## Example
The example implements the custom transition of a shared image during redirection from one page to another, which is triggered by a click on the image. This example implements the custom transition of a shared image during redirection from one page to another, which is triggered by a click on the image.
```ts ```ts
// xxx.ets // xxx.ets
......
...@@ -14,7 +14,7 @@ The location attributes set the alignment mode, layout direction, and position o ...@@ -14,7 +14,7 @@ The location attributes set the alignment mode, layout direction, and position o
| -------- | -------- | -------- | | -------- | -------- | -------- |
| align | [Alignment](ts-appendix-enums.md#alignment) | Alignment mode of the component content in the drawing area.<br>Default value: **Alignment.Center**<br>Since API version 9, this API is supported in ArkTS widgets.| | align | [Alignment](ts-appendix-enums.md#alignment) | Alignment mode of the component content in the drawing area.<br>Default value: **Alignment.Center**<br>Since API version 9, this API is supported in ArkTS widgets.|
| direction | [Direction](ts-appendix-enums.md#direction) | Horizontal layout of the component.<br>Default value: **Direction.Auto**<br>Since API version 9, this API is supported in ArkTS widgets.| | direction | [Direction](ts-appendix-enums.md#direction) | Horizontal layout of the component.<br>Default value: **Direction.Auto**<br>Since API version 9, this API is supported in ArkTS widgets.|
| position | [Position](ts-types.md#position8) | Offset of the component's upper left corner relative to the parent component's upper left corner. This offset is expressed using absolute values. When laying out components, this attribute does not affect the layout of the parent component. It only adjusts the component position during drawing.<br>Since API version 9, this API is supported in ArkTS widgets.| | position | [Position](ts-types.md#position8) | Offset of the component's upper left corner relative to the parent component's upper left corner. This offset is expressed using absolute values. When laying out components, this attribute does not affect the layout of the parent component. It only adjusts the component position during drawing.<br>This attribute is applicable to scenarios where the component is fixed at a position in the parent container, for example, where it is pinned to top or floating above the UI.<br>Since API version 9, this API is supported in ArkTS widgets.|
| markAnchor | [Position](ts-types.md#position8) | Anchor point of the component for positioning. The upper left corner of the component is used as the reference point for offset. Generally, this attribute is used together with the **position** and **offset** attributes. When used independently, this attribute is similar to **offset**.<br>Default value:<br>{<br>x: 0,<br>y: 0<br>}<br>Since API version 9, this API is supported in ArkTS widgets.| | markAnchor | [Position](ts-types.md#position8) | Anchor point of the component for positioning. The upper left corner of the component is used as the reference point for offset. Generally, this attribute is used together with the **position** and **offset** attributes. When used independently, this attribute is similar to **offset**.<br>Default value:<br>{<br>x: 0,<br>y: 0<br>}<br>Since API version 9, this API is supported in ArkTS widgets.|
| offset | [Position](ts-types.md#position8) | Offset of the component relative to itself. This offset is expressed using relative values. This attribute does not affect the layout of the parent component. It only adjusts the component position during drawing.<br>Default value:<br>{<br>x: 0,<br>y: 0<br>}<br>Since API version 9, this API is supported in ArkTS widgets.| | offset | [Position](ts-types.md#position8) | Offset of the component relative to itself. This offset is expressed using relative values. This attribute does not affect the layout of the parent component. It only adjusts the component position during drawing.<br>Default value:<br>{<br>x: 0,<br>y: 0<br>}<br>Since API version 9, this API is supported in ArkTS widgets.|
| alignRules<sup>9+</sup> | {<br>left?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };<br>right?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };<br>middle?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };<br>top?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };<br>bottom?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };<br>center?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) }<br>} | Alignment rules relative to the container.<br>- **left**: left-aligned.<br>- **right**: right-aligned.<br>- **middle**: center-aligned.<br>- **top**: top-aligned.<br>- **bottom**: bottom-aligned.<br>- **center**: center-aligned.<br>This API is supported in ArkTS widgets.<br>**NOTE**<br>- **anchor**: ID of the component that functions as the anchor point.<br>- **align**: alignment mode relative to the anchor component. | | alignRules<sup>9+</sup> | {<br>left?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };<br>right?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };<br>middle?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };<br>top?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };<br>bottom?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };<br>center?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) }<br>} | Alignment rules relative to the container.<br>- **left**: left-aligned.<br>- **right**: right-aligned.<br>- **middle**: center-aligned.<br>- **top**: top-aligned.<br>- **bottom**: bottom-aligned.<br>- **center**: center-aligned.<br>This API is supported in ArkTS widgets.<br>**NOTE**<br>- **anchor**: ID of the component that functions as the anchor point.<br>- **align**: alignment mode relative to the anchor component. |
...@@ -32,19 +32,15 @@ struct PositionExample1 { ...@@ -32,19 +32,15 @@ struct PositionExample1 {
Column({ space: 10 }) { Column({ space: 10 }) {
// When the component content is within the area specified by the component width and height, set the alignment mode of the content in the component. // When the component content is within the area specified by the component width and height, set the alignment mode of the content in the component.
Text('align').fontSize(9).fontColor(0xCCCCCC).width('90%') Text('align').fontSize(9).fontColor(0xCCCCCC).width('90%')
Text('top start') Stack() {
.align(Alignment.TopStart) Text('First show in bottom end').height('65%').backgroundColor(0xD2B48C)
.height(50) Text('Second show in bottom end').backgroundColor(0xF5DEB3).opacity(0.9)
.width('90%') }.width('90%').height(50).margin({ top: 5 }).backgroundColor(0xFFE4C4)
.fontSize(16) .align(Alignment.BottomEnd)
.backgroundColor(0xFFE4C4) Stack() {
Text('top start')
Text('Bottom end') }.width('90%').height(50).margin({ top: 5 }).backgroundColor(0xFFE4C4)
.align(Alignment.BottomEnd) .align(Alignment.TopStart)
.height(50)
.width('90%')
.fontSize(16)
.backgroundColor(0xFFE4C4)
// To arrange the child components from left to right, set direction of the parent container to Direction.Ltr. // To arrange the child components from left to right, set direction of the parent container to Direction.Ltr.
Text('direction').fontSize(9).fontColor(0xCCCCCC).width('90%') Text('direction').fontSize(9).fontColor(0xCCCCCC).width('90%')
...@@ -86,6 +82,7 @@ struct PositionExample2 { ...@@ -86,6 +82,7 @@ struct PositionExample2 {
Text('position').fontSize(12).fontColor(0xCCCCCC).width('90%') Text('position').fontSize(12).fontColor(0xCCCCCC).width('90%')
Row() { Row() {
Text('1').size({ width: '30%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) Text('1').size({ width: '30%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16)
.textAlign(TextAlign.Center)
Text('2 position(30, 10)') Text('2 position(30, 10)')
.size({ width: '60%', height: '30' }) .size({ width: '60%', height: '30' })
.backgroundColor(0xbbb2cb) .backgroundColor(0xbbb2cb)
...@@ -94,6 +91,7 @@ struct PositionExample2 { ...@@ -94,6 +91,7 @@ struct PositionExample2 {
.align(Alignment.Start) .align(Alignment.Start)
.position({ x: 30, y: 10 }) .position({ x: 30, y: 10 })
Text('3').size({ width: '45%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) Text('3').size({ width: '45%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16)
.textAlign(TextAlign.Center)
Text('4 position(50%, 70%)') Text('4 position(50%, 70%)')
.size({ width: '50%', height: '50' }) .size({ width: '50%', height: '50' })
.backgroundColor(0xbbb2cb) .backgroundColor(0xbbb2cb)
...@@ -110,14 +108,20 @@ struct PositionExample2 { ...@@ -110,14 +108,20 @@ struct PositionExample2 {
.size({ width: '100', height: '100' }) .size({ width: '100', height: '100' })
.backgroundColor(0xdeb887) .backgroundColor(0xdeb887)
Text('text') Text('text')
.fontSize('30px')
.textAlign(TextAlign.Center)
.size({ width: 25, height: 25 }) .size({ width: 25, height: 25 })
.backgroundColor(Color.Green) .backgroundColor(Color.Green)
.markAnchor({ x: 25, y: 25 }) .markAnchor({ x: 25, y: 25 })
Text('text') Text('text')
.fontSize('30px')
.textAlign(TextAlign.Center)
.size({ width: 25, height: 25 }) .size({ width: 25, height: 25 })
.backgroundColor(Color.Green) .backgroundColor(Color.Green)
.markAnchor({ x: -100, y: -25 }) .markAnchor({ x: -100, y: -25 })
Text('text') Text('text')
.fontSize('30px')
.textAlign(TextAlign.Center)
.size({ width: 25, height: 25 }) .size({ width: 25, height: 25 })
.backgroundColor(Color.Green) .backgroundColor(Color.Green)
.markAnchor({ x: 25, y: -25 }) .markAnchor({ x: 25, y: -25 })
...@@ -127,6 +131,7 @@ struct PositionExample2 { ...@@ -127,6 +131,7 @@ struct PositionExample2 {
Text('offset').fontSize(12).fontColor(0xCCCCCC).width('90%') Text('offset').fontSize(12).fontColor(0xCCCCCC).width('90%')
Row() { Row() {
Text('1').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) Text('1').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16)
.textAlign(TextAlign.Center)
Text('2 offset(15, 30)') Text('2 offset(15, 30)')
.size({ width: 120, height: '50' }) .size({ width: 120, height: '50' })
.backgroundColor(0xbbb2cb) .backgroundColor(0xbbb2cb)
...@@ -135,6 +140,7 @@ struct PositionExample2 { ...@@ -135,6 +140,7 @@ struct PositionExample2 {
.align(Alignment.Start) .align(Alignment.Start)
.offset({ x: 15, y: 30 }) .offset({ x: 15, y: 30 })
Text('3').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) Text('3').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16)
.textAlign(TextAlign.Center)
Text('4 offset(-10%, 20%)') Text('4 offset(-10%, 20%)')
.size({ width: 100, height: '50' }) .size({ width: 100, height: '50' })
.backgroundColor(0xbbb2cb) .backgroundColor(0xbbb2cb)
......
...@@ -18,13 +18,14 @@ You can bind a popup to a component, specifying its content, interaction logic, ...@@ -18,13 +18,14 @@ You can bind a popup to a component, specifying its content, interaction logic,
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------------------| ------------------------------------------------| -----| ----------------------------------------- | | -------------------------| ------------------------------------------------| -----| ----------------------------------------- |
| message | string | Yes | Content of the popup message. | | message | string | Yes | Content of the popup message. |
| placementOnTop | boolean | No | Whether to display the popup above the component.<br/>Default value: **false** | | placementOnTop | boolean | No | Whether to display the popup above the component.<br/>Default value: **false** |
| primaryButton | {<br>value: string,<br>action: () =&gt; void<br>} | No | Primary button.<br>**value**: text of the primary button in the popup.<br>**action**: callback for clicking the primary button.| | primaryButton | {<br>value: string,<br>action: () =&gt; void<br>} | No | Primary button.<br>**value**: text of the primary button in the popup.<br>**action**: callback for clicking the primary button.|
| secondaryButton | {<br>value: string,<br>action: () =&gt; void<br>} | No | Secondary button.<br>**value**: text of the secondary button in the popup.<br>**action**: callback for clicking the secondary button.| | secondaryButton | {<br>value: string,<br>action: () =&gt; void<br>} | No | Secondary button.<br>**value**: text of the secondary button in the popup.<br>**action**: callback for clicking the secondary button.|
| onStateChange | (event: { isVisible: boolean }) =&gt; void | No | Callback for the popup status change event.<br/>**isVisible**: whether the popup is visible. | | onStateChange | (event: { isVisible: boolean }) =&gt; void | No | Callback for the popup status change event.<br/>**isVisible**: whether the popup is visible. |
| arrowOffset<sup>9+</sup> | [Length](ts-types.md#length) | No | Offset of the popup arrow relative to the popup. <br>When the arrow is at the top or bottom of the popup: The value **0** indicates that the arrow is located on the leftmost, and any other value indicates the distance from the arrow to the leftmost; the arrow is centered by default. <br/>When the arrow is on the left or right side of the popup: The value indicates the distance from the arrow to the top; the arrow is centered by default. <br/>When the popup is displayed on either edge of the screen, it will automatically deviate leftward or rightward to stay within the safe area. When the value is **0**, the arrow always points to the bound component. | | arrowOffset<sup>9+</sup> | [Length](ts-types.md#length) | No | Offset of the popup arrow relative to the popup. <br>When the arrow is at the top or bottom of the popup: The value **0** indicates that the arrow is located on the leftmost, and any other value indicates the distance from the arrow to the leftmost; the arrow is centered by default. <br/>When the arrow is on the left or right side of the popup: The value indicates the distance from the arrow to the top; the arrow is centered by default. <br/>When the popup is displayed on either edge of the screen, it will automatically deviate leftward or rightward to stay within the safe area. When the value is **0**, the arrow always points to the bound component. |
| showInSubWindow<sup>9+</sup> | boolean | No | Whether to show the popup in the subwindow. <br/>Default value: **false** | | showInSubWindow<sup>9+</sup> | boolean | No | Whether to show the popup in the subwindow. <br/>Default value: **false** |
## CustomPopupOptions<sup>8+</sup> ## CustomPopupOptions<sup>8+</sup>
...@@ -33,13 +34,12 @@ You can bind a popup to a component, specifying its content, interaction logic, ...@@ -33,13 +34,12 @@ You can bind a popup to a component, specifying its content, interaction logic,
| builder | [CustomBuilder](ts-types.md#custombuilder8) | Yes | Popup builder. | | builder | [CustomBuilder](ts-types.md#custombuilder8) | Yes | Popup builder. |
| placement | [Placement](ts-appendix-enums.md#placement8) | No | Preferred position of the popup. If the set position is insufficient for holding the popup, it will be automatically adjusted.<br>Default value: **Placement.Bottom** | | placement | [Placement](ts-appendix-enums.md#placement8) | No | Preferred position of the popup. If the set position is insufficient for holding the popup, it will be automatically adjusted.<br>Default value: **Placement.Bottom** |
| popupColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the popup. | | popupColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the popup. |
| enableArrow | boolean | No | Whether to display an arrow.<br>Since API version 9, if the position set for the popup is not large enough, the arrow will not be displayed. For example, if **placement** is set to **Left** but the popup height is less than twice the arrow width (64 vp), the arrow will not be displayed.<br>Default value: **true**| | enableArrow | boolean | No | Whether to display an arrow.<br>Since API version 9, if the position set for the popup is not large enough, the arrow will not be displayed. For example, if **placement** is set to **Left**, but the popup height (80 vp) is less than the sum of the arrow width (32 vp) and diameter of popup rounded corner (48 vp), the arrow will not be displayed.<br>Default value: **true**|
| autoCancel | boolean | No | Whether to automatically close the popup when an operation is performed on the page.<br>Default value: **true** | | autoCancel | boolean | No | Whether to automatically close the popup when an operation is performed on the page.<br>Default value: **true** |
| onStateChange | (event: { isVisible: boolean }) =&gt; void | No | Callback for the popup status change event.<br>**isVisible**: whether the popup is visible. | | onStateChange | (event: { isVisible: boolean }) =&gt; void | No | Callback for the popup status change event.<br>**isVisible**: whether the popup is visible. |
| arrowOffset<sup>9+</sup> | [Length](ts-types.md#length) | No | Offset of the popup arrow relative to the popup. <br/>When the arrow is at the top or bottom of the popup: The value **0** indicates that the arrow is located on the leftmost, and any other value indicates the distance from the arrow to the leftmost; the arrow is centered by default. <br/>When the arrow is on the left or right side of the popup: The value indicates the distance from the arrow to the top; the arrow is centered by default. <br/>When the popup is displayed on either edge of the screen, it will automatically deviate leftward or rightward to stay within the safe area. When the value is **0**, the arrow always points to the bound component. | | arrowOffset<sup>9+</sup> | [Length](ts-types.md#length) | No | Offset of the popup arrow relative to the popup. <br/>When the arrow is at the top or bottom of the popup: The value **0** indicates that the arrow is located on the leftmost, and any other value indicates the distance from the arrow to the leftmost; the arrow is centered by default. <br/>When the arrow is on the left or right side of the popup: The value indicates the distance from the arrow to the top; the arrow is centered by default. <br/>When the popup is displayed on either edge of the screen, it will automatically deviate leftward or rightward to stay within the safe area. When the value is **0**, the arrow always points to the bound component. |
| showInSubWindow<sup>9+</sup> | boolean | No | Whether to show the popup in the subwindow.<br/>Default value: **false** | | showInSubWindow<sup>9+</sup> | boolean | No | Whether to show the popup in the subwindow.<br/>Default value: **false** |
## Example ## Example
```ts ```ts
// xxx.ets // xxx.ets
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
The text style attributes set the style for text in a component. The text style attributes set the style for text in a component.
> **NOTE** > **NOTE**
> >
> The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
...@@ -18,6 +18,8 @@ The text style attributes set the style for text in a component. ...@@ -18,6 +18,8 @@ The text style attributes set the style for text in a component.
| fontStyle | [FontStyle](ts-appendix-enums.md#fontstyle) | Font style.<br>Default value: **FontStyle.Normal** | | fontStyle | [FontStyle](ts-appendix-enums.md#fontstyle) | Font style.<br>Default value: **FontStyle.Normal** |
| fontWeight | number \| [FontWeight](ts-appendix-enums.md#fontweight) \| string | Font weight. For the number type, the value ranges from 100 to 900, at an interval of 100. The default value is **400**. A larger value indicates a larger font weight. The string type supports only the string of the number type, for example, **400**, **"bold"**, **"bolder"**, **"lighter"**, **"regular"**, and **"medium"**, which correspond to the enumerated values in **FontWeight**.<br>Default value: **FontWeight.Normal** | | fontWeight | number \| [FontWeight](ts-appendix-enums.md#fontweight) \| string | Font weight. For the number type, the value ranges from 100 to 900, at an interval of 100. The default value is **400**. A larger value indicates a larger font weight. The string type supports only the string of the number type, for example, **400**, **"bold"**, **"bolder"**, **"lighter"**, **"regular"**, and **"medium"**, which correspond to the enumerated values in **FontWeight**.<br>Default value: **FontWeight.Normal** |
| fontFamily | string \| [Resource](ts-types.md#resource) | Font family.<br>Default value: **'HarmonyOS Sans'**<br>Currently, only the default font is supported. | | fontFamily | string \| [Resource](ts-types.md#resource) | Font family.<br>Default value: **'HarmonyOS Sans'**<br>Currently, only the default font is supported. |
| lineHeight | string \| number \| [Resource](ts-types.md#resource) | Text line height. If the value is less than or equal to **0**, the line height is not limited and the font size is adaptive. If the value of the number type, the unit fp is used.|
| decoration | {<br>type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),<br>color?: [ResourceColor](ts-types.md#resourcecolor)<br>} | Style and color of the text decorative line.<br>Default value: {<br>type: TextDecorationType.None,<br>color: Color.Black<br>} |
## Example ## Example
......
...@@ -111,7 +111,7 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte ...@@ -111,7 +111,7 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte
} }
``` ```
5. After the splash screen animation plays for 1 second, the **FoodCategoryList** page is displayed. Set the **onFinish** callback of **animateTo**. Invoke the **setTimeout** API of the timer. After a delay of 1s, call **router.replace** to display the **FoodCategoryList** page. 5. After the splash screen animation plays for 1 second, the **FoodCategoryList** page is displayed. Set the **onFinish** callback of **animateTo**. Invoke the **setTimeout** API of the timer. After a delay of 1s, call **router.replaceUrl** to display the **FoodCategoryList** page.
```ts ```ts
import router from '@ohos.router' import router from '@ohos.router'
...@@ -240,11 +240,11 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte ...@@ -240,11 +240,11 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte
Implement the shared element transition between the food list page and the food details page. That is, after you click **FoodListItem** or **FoodGridItem**, the food thumbnail is zoomed in, and then you are redirected to the large image on the food details page. Implement the shared element transition between the food list page and the food details page. That is, after you click **FoodListItem** or **FoodGridItem**, the food thumbnail is zoomed in, and then you are redirected to the large image on the food details page.
1. Set the **sharedTransition** method for the **\<Image>** component of **FoodListItem** and **FoodGridItem**. The transition ID is **foodItem.id**, the duration of the transition animation is 1s, and the delay is 0.1s. The change curve is **Curves.cubicBezier(0.2, 0.2, 0.1, 1.0)**. You need to import the **Curves** module first. 1. Set the **sharedTransition** method for the **<Image>** component of **FoodListItem** and **FoodGridItem**. The transition ID is **foodItem.id**, the duration of the transition animation is 1s, and the delay is 0.1s. The change curve is **Curves.cubicBezier(0.2, 0.2, 0.1, 1.0)**. You need to import the **Curves** module first.
During the shared element transition, the attributes of the current element are carried. Therefore, create a **\<Row>** component as the parent component of the **\<Image>** component, and set the background color on the **\<Row>** component. During the shared element transition, the attributes of the current element are carried. Therefore, create a **<Row>** component as the parent component of the **<Image>** component, and set the background color on the **<Row>** component.
Set **autoResize** to **false** for the **\<Image>** component of **FoodListItem**. The **\<Image>** component adjusts the size of the image source based on the final display area by default to optimize the image rendering performance. In the transition animation, the image will be reloaded during the zoom-in process. Therefore, to ensure the smoothness of the transition animation, set **autoResize** to **false**. Set **autoResize** to **false** for the **<Image>** component of **FoodListItem**. The **<Image>** component adjusts the size of the image source based on the final display area by default to optimize the image rendering performance. In the transition animation, the image will be reloaded during the zoom-in process. Therefore, to ensure the smoothness of the transition animation, set **autoResize** to **false**.
```ts ```ts
// FoodList.ets // FoodList.ets
...@@ -316,7 +316,7 @@ Implement the shared element transition between the food list page and the food ...@@ -316,7 +316,7 @@ Implement the shared element transition between the food list page and the food
``` ```
2. Sets the **sharedTransition** method for the **\<Image>** component of **FoodImageDisplay** on the **FoodDetail** page. The setting method is the same as that mentioned above. 2. Sets the **sharedTransition** method for the **<Image>** component of **FoodImageDisplay** on the **FoodDetail** page. The setting method is the same as that mentioned above.
```ts ```ts
import Curves from '@ohos.curves' import Curves from '@ohos.curves'
......
...@@ -10,32 +10,32 @@ ...@@ -10,32 +10,32 @@
## Usage ## Usage
Invoke the **mediaquery** API to set the media query condition and the callback, and change the page layout or implement service logic in the callback corresponding to the condition. Invoke the **mediaquery** API to set the media query condition and the callback, and change the page layout or implement service logic in the callback corresponding to the condition. The procedure is as follows:
First, import the **mediaquery** module, as shown below: 1. Import the **mediaquery** module, as shown below:
```ts ```ts
import mediaquery from '@ohos.mediaquery' import mediaquery from '@ohos.mediaquery'
``` ```
Then, use the **matchMediaSync** API to set the media query condition and save the returned listener, as shown below: 2. Use the **matchMediaSync** API to set the media query condition and save the returned listener, as shown below:
```ts ```ts
listener = mediaquery.matchMediaSync('(orientation: landscape)') listener = mediaquery.matchMediaSync('(orientation: landscape)')
``` ```
Finally, register the **onPortrait** callback using the saved listener, and change the page layout or implement service logic in the callback. When the media query condition is matched, the callback is triggered. The sample code is as follows: 3. Register the **onPortrait** callback using the saved listener, and change the page layout or implement service logic in the callback. When the media query condition is matched, the callback is triggered. The sample code is as follows:
```ts ```ts
onPortrait(mediaQueryResult) { onPortrait(mediaQueryResult) {
if (mediaQueryResult.matches) { if (mediaQueryResult.matches) {
// do something here // do something here
} else { } else {
// do something here // do something here
} }
} }
listener.on('change', onPortrait) listener.on('change', onPortrait)
``` ```
## Media Query Conditions ## Media Query Conditions
...@@ -92,23 +92,23 @@ At MediaQuery Level 4, range query is imported so that you can use the operators ...@@ -92,23 +92,23 @@ At MediaQuery Level 4, range query is imported so that you can use the operators
| Type | Description | | Type | Description |
| ----------------- | ------------------------------------------------------------ | | ----------------- | ------------------------------------------------------------ |
| height | Height of the display area on the application page. | | height | Height of the display area on the application page. |
| min-height | Minimum height of the display area on the application page. | | min-height | Minimum height of the display area on the application page. |
| max-height | Maximum height of the display area on the application page. | | max-height | Maximum height of the display area on the application page. |
| width | Width of the display area on the app page. | | width | Width of the display area on the application page. |
| min-width | Minimum width of the display area on the application page. | | min-width | Minimum width of the display area on the application page. |
| max-width | Maximum width of the display area on the application page. | | max-width | Maximum width of the display area on the application page. |
| resolution | Resolution of the device. The unit can be dpi, dppx, or dpcm.<br>- **dpi** indicates the number of physical pixels per inch. 1 dpi ≈ 0.39 dpcm.<br>- **dpcm** indicates the number of physical pixels per centimeter. 1 dpcm ≈ 2.54 dpi.<br>- **dppx** indicates the number of physical pixels in each pixel. (This unit is calculated based on this formula: 96 px = 1 inch, which is different from the calculation method of the px unit on the page.) 1 dppx = 96 dpi.| | resolution | Resolution of the device. The unit can be dpi, dppx, or dpcm. <br>- **dpi** indicates the number of physical pixels per inch. 1 dpi ≈ 0.39 dpcm.<br>- **dpcm** indicates the number of physical pixels per centimeter. 1 dpcm ≈ 2.54 dpi.<br>- **dppx** indicates the number of physical pixels in each pixel. (This unit is calculated based on this formula: 96 px = 1 inch, which is different from the calculation method of the px unit on the page.) 1 dppx = 96 dpi.|
| min-resolution | Minimum device resolution. | | min-resolution | Minimum device resolution. |
| max-resolution | Maximum device resolution. | | max-resolution | Maximum device resolution. |
| orientation | Screen orientation.<br>Options are as follows:<br>- orientation: portrait<br>- orientation: landscape| | orientation | Screen orientation.<br>Options are as follows:<br>- orientation: portrait<br>- orientation: landscape|
| device-height | Height of the device. | | device-height | Height of the device. |
| min-device-height | Minimum height of the device. | | min-device-height | Minimum height of the device. |
| max-device-height | Maximum height of the device. | | max-device-height | Maximum height of the device. |
| device-width | Width of the device. | | device-width | Width of the device. |
| min-device-width | Minimum width of the device. | | device-type | Type of the device.<br>Options: **default** and tablet |
| max-device-width | Maximum width of the device. | | min-device-width | Minimum width of the device. |
| device-type | Type of the device.<br/>Value range: **default** | | max-device-width | Maximum width of the device. |
| round-screen | Screen type. The value **true** means that the screen is round, and **false** means the opposite. | | round-screen | Screen type. The value **true** means that the screen is round, and **false** means the opposite. |
| dark-mode | Whether the device is in dark mode. The value **true** means that the device is in dark mode, and **false** means the opposite. | | dark-mode | Whether the device is in dark mode. The value **true** means that the device is in dark mode, and **false** means the opposite. |
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
- [AI Framework](subsystems/subsys-ai-aiframework-devguide.md) - [AI Framework](subsystems/subsys-ai-aiframework-devguide.md)
- [Data Management](subsystems/subsys-data-relational-database-overview.md) - [Data Management](subsystems/subsys-data-relational-database-overview.md)
- [Sensor](subsystems/subsys-sensor-overview.md) - [Sensor](subsystems/subsys-sensor-overview.md)
- [USB](subsystems/subsys-usbservice-overview.md)
- [Application Framework](subsystems/subsys-application-framework-overview.md) - [Application Framework](subsystems/subsys-application-framework-overview.md)
- [OTA Update](subsystems/subsys-ota-guide.md) - [OTA Update](subsystems/subsys-ota-guide.md)
- [Telephony](subsystems/subsys-tel-overview.md) - [Telephony](subsystems/subsys-tel-overview.md)
......
...@@ -178,6 +178,7 @@ ...@@ -178,6 +178,7 @@
- [Exception Debugging](kernel/kernel-mini-memory-exception.md) - [Exception Debugging](kernel/kernel-mini-memory-exception.md)
- [Trace](kernel/kernel-mini-memory-trace.md) - [Trace](kernel/kernel-mini-memory-trace.md)
- [LMS](kernel/kernel-mini-memory-lms.md) - [LMS](kernel/kernel-mini-memory-lms.md)
- [Shell](kernel/kernel-mini-debug-shell.md)
- Appendix - Appendix
- [Kernel Coding Specification](kernel/kernel-mini-appx-code.md) - [Kernel Coding Specification](kernel/kernel-mini-appx-code.md)
- [Standard Libraries](kernel/kernel-mini-appx-lib.md) - [Standard Libraries](kernel/kernel-mini-appx-lib.md)
...@@ -426,10 +427,6 @@ ...@@ -426,10 +427,6 @@
- [Sensor Overview](subsystems/subsys-sensor-overview.md) - [Sensor Overview](subsystems/subsys-sensor-overview.md)
- [Sensor Usage Guidelines](subsystems/subsys-sensor-guide.md) - [Sensor Usage Guidelines](subsystems/subsys-sensor-guide.md)
- [Sensor Usage Example](subsystems/subsys-sensor-demo.md) - [Sensor Usage Example](subsystems/subsys-sensor-demo.md)
- USB
- [USB Overview](subsystems/subsys-usbservice-overview.md)
- [USB Usage Guidelines](subsystems/subsys-usbservice-guide.md)
- [USB Usage Example](subsystems/subsys-usbservice-demo.md)
- Application Framework - Application Framework
- [Overview](subsystems/subsys-application-framework-overview.md) - [Overview](subsystems/subsys-application-framework-overview.md)
- [Setting Up a Development Environment](subsystems/subsys-application-framework-envbuild.md) - [Setting Up a Development Environment](subsystems/subsys-application-framework-envbuild.md)
......
# 创建一个ArkTS卡片 # 创建一个ArkTS卡片
在已有的应用工程中,创建ArkTS卡片,具体的操作方式如下。
开发者可以使用IDE创建ArkTS卡片,具体步骤请参见[DevEco Studio服务卡片开发指南](https://gitee.com/link?target=https%3A%2F%2Fdeveloper.harmonyos.com%2Fcn%2Fdocs%2Fdocumentation%2Fdoc-guides%2Fohos-development-service-widget-0000001263280425)。使用IDE生成的卡片模板包括三个部分:卡片页面(WidgetCard.ets)、卡片生命周期管理(FormExtensionAbility)和卡片配置文件(form_config.json) 1. 创建卡片
![WidgetProjectCreate1](figures/WidgetProjectCreate1.png)
在选择卡片的开发语言类型(Language)时,需要选择ArkTS选项,如下图所示 2. 根据实际业务场景,选择一个卡片模板
![WidgetProjectCreate2](figures/WidgetProjectCreate2.png)
![WidgetCreateProject](figures/WidgetCreateProject.png) 3. 在选择卡片的开发语言类型(Language)时,选择ArkTS选项,然后单击“Finish”,即可完成ArkTS卡片创建。
![WidgetProjectCreate3](figures/WidgetProjectCreate3.png)
ArkTS卡片创建完成后,工程中会新增如下卡片相关文件:卡片生命周期管理文件(EntryFormAbility.ts)、卡片页面文件(WidgetCard.ets)和卡片配置文件(form_config.json)
![WidgetProjectView](figures/WidgetProjectView.png)
\ No newline at end of file
# 卡片数据交互说明 # 卡片数据交互说明
ArkTS卡片框架提供了updateForm()接口和requestForm()接口主动触发卡片的页面刷新。**(介绍下LocalStorageProp在这个过程中起到的作用)** ArkTS卡片框架提供了updateForm()接口和requestForm()接口主动触发卡片的页面刷新。
![WidgetLocalStorageProp](figures/WidgetLocalStorageProp.png) ![WidgetLocalStorageProp](figures/WidgetLocalStorageProp.png)
......
...@@ -45,7 +45,7 @@ ExtensionAbility组件是基于特定场景(例如服务卡片、输入法等 ...@@ -45,7 +45,7 @@ ExtensionAbility组件是基于特定场景(例如服务卡片、输入法等
## 实现指定类型的ExtensionAbility组件 ## 实现指定类型的ExtensionAbility组件
以实现卡片[FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md)为例进行说明。卡片框架提供了[FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md)基类,开发者通过派生此基类(如MyFormExtensionAbility),实现回调(如创建卡片的onCreate()回调、更新卡片的onUpdateForm()回调等)来实现具体卡片功能,具体见开发指导见[服务卡片FormExtensionAbility](widget-development-stage.md) 以实现卡片[FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md)为例进行说明。卡片框架提供了[FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md)基类,开发者通过派生此基类(如MyFormExtensionAbility),实现回调(如创建卡片的onCreate()回调、更新卡片的onUpdateForm()回调等)来实现具体卡片功能,具体见开发指导见[服务卡片FormExtensionAbility](service-widget-overview.md)
卡片FormExtensionAbility实现方不用关心使用方何时去请求添加、删除卡片,FormExtensionAbility实例及其所在的ExtensionAbility进程的整个生命周期,都是由卡片管理系统服务FormManagerService进行调度管理。 卡片FormExtensionAbility实现方不用关心使用方何时去请求添加、删除卡片,FormExtensionAbility实例及其所在的ExtensionAbility进程的整个生命周期,都是由卡片管理系统服务FormManagerService进行调度管理。
......
...@@ -57,13 +57,6 @@ FormExtensionAbility类拥有如下API接口,具体的API介绍详见[接口 ...@@ -57,13 +57,6 @@ FormExtensionAbility类拥有如下API接口,具体的API介绍详见[接口
| onConfigurationUpdate(config:&nbsp;Configuration):&nbsp;void | 当系统配置更新时调用。 | | onConfigurationUpdate(config:&nbsp;Configuration):&nbsp;void | 当系统配置更新时调用。 |
| onShareForm?(formId:&nbsp;string):&nbsp;{&nbsp;[key:&nbsp;string]:&nbsp;any&nbsp;} | 卡片提供方接收卡片分享的通知接口。 | | onShareForm?(formId:&nbsp;string):&nbsp;{&nbsp;[key:&nbsp;string]:&nbsp;any&nbsp;} | 卡片提供方接收卡片分享的通知接口。 |
FormExtensionAbility类还拥有成员context,为FormExtensionContext类,具体的API介绍详见[接口文档](../reference/apis/js-apis-inner-application-formExtensionContext.md)
| 接口名 | 描述 |
| -------- | -------- |
| startAbility(want:&nbsp;Want,&nbsp;callback:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | 回调形式拉起一个卡片所属应用的UIAbility(系统接口,三方应用不支持调用,需申请后台拉起权限)。 |
| startAbility(want:&nbsp;Want):&nbsp;Promise&lt;void&gt; | Promise形式拉起一个卡片所属应用的UIAbility(系统接口,三方应用不支持调用,需申请后台拉起权限)。 |
formProvider类有如下API接口,具体的API介绍详见[接口文档](../reference/apis/js-apis-app-form-formProvider.md) formProvider类有如下API接口,具体的API介绍详见[接口文档](../reference/apis/js-apis-app-form-formProvider.md)
| 接口名 | 描述 | | 接口名 | 描述 |
...@@ -324,7 +317,7 @@ export default class EntryFormAbility extends FormExtension { ...@@ -324,7 +317,7 @@ export default class EntryFormAbility extends FormExtension {
} }
``` ```
具体的持久化方法可以参考[轻量级数据存储开发指导](../database/database-preference-guidelines.md) 具体的持久化方法可以参考[轻量级数据存储开发指导](../database/app-data-persistence-overview.md)
需要注意的是,卡片使用方在请求卡片时传递给提供方应用的Want数据中存在临时标记字段,表示此次请求的卡片是否为临时卡片: 需要注意的是,卡片使用方在请求卡片时传递给提供方应用的Want数据中存在临时标记字段,表示此次请求的卡片是否为临时卡片:
......
...@@ -54,14 +54,3 @@ ArkTS卡片与JS卡片具备不同的实现原理及特征,在场景能力上 ...@@ -54,14 +54,3 @@ ArkTS卡片与JS卡片具备不同的实现原理及特征,在场景能力上
| 逻辑代码执行(不包含import能力) | 不支持 | 支持 | | 逻辑代码执行(不包含import能力) | 不支持 | 支持 |
相比于JS卡片,ArkTS卡片在能力和场景方面更加丰富,因此无论开发何种用途的卡片,都推荐使用ArkTS卡片,因为它可以提高开发效率并实现动态化。但如果只需要做静态页面展示的卡片,可以考虑使用JS卡片。 相比于JS卡片,ArkTS卡片在能力和场景方面更加丰富,因此无论开发何种用途的卡片,都推荐使用ArkTS卡片,因为它可以提高开发效率并实现动态化。但如果只需要做静态页面展示的卡片,可以考虑使用JS卡片。
## 限制
为了降低FormExtensionAbility能力被三方应用滥用的风险,在FormExtensionAbility中限制以下接口的调用
- @ohos.ability.particleAbility.d.ts
- @ohos.backgroundTaskManager.d.ts
- @ohos.resourceschedule.backgroundTaskManager.d.ts
- @ohos.multimedia.camera.d.ts
- @ohos.multimedia.audio.d.ts
- @ohos.multimedia.media.d.ts
\ No newline at end of file
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
## 跨设备同步访问控制机制 ## 跨设备同步访问控制机制
数据跨设备同步时,数据管理基于设备等级和[数据安全标签](access-control-by-device-and-data-level.md#基本概念)进行访问控制。规则为,数据只允许向数据安全标签不高于设备安全等级的设备同步数据,具体访问控制矩阵如下: 数据跨设备同步时,数据管理基于设备等级和[数据安全标签](access-control-by-device-and-data-level.md#数据安全标签)进行访问控制。规则为,数据只允许向数据安全标签不高于设备安全等级的设备同步数据,具体访问控制矩阵如下:
|设备安全级别|可同步的数据安全标签| |设备安全级别|可同步的数据安全标签|
|---|---| |---|---|
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
在操作系统中,存在各种各样的数据,按数据结构可分为: 在操作系统中,存在各种各样的数据,按数据结构可分为:
- 结构化数据:能够用统一的数据模型加以描述的数据。常见的是各类数据库数据。在应用开发中,对结构化数据的开发活动隶属于[数据管理模块](database/data-mgmt-overview.md) - 结构化数据:能够用统一的数据模型加以描述的数据。常见的是各类数据库数据。在应用开发中,对结构化数据的开发活动隶属于[数据管理模块](../database/data-mgmt-overview.md)
- 非结构化数据:指数据结构不规则或不完整,没有预定义的数据结构/模型,不方便用数据库二维逻辑表来表现的数据。常见的是各类文件,如文档、图片、音频、视频等。在应用开发中,对非结构化数据的开发活动隶属于文件管理模块,将在下文展开介绍。 - 非结构化数据:指数据结构不规则或不完整,没有预定义的数据结构/模型,不方便用数据库二维逻辑表来表现的数据。常见的是各类文件,如文档、图片、音频、视频等。在应用开发中,对非结构化数据的开发活动隶属于文件管理模块,将在下文展开介绍。
......
...@@ -97,12 +97,12 @@ Ability组件信息标志,指示需要获取的Ability组件信息的内容。 ...@@ -97,12 +97,12 @@ Ability组件信息标志,指示需要获取的Ability组件信息的内容。
| 名称 | 值 | 说明 | | 名称 | 值 | 说明 |
|:----------------:|:---:|-----| |:----------------:|:---:|-----|
| FORM | 0 | [FormExtensionAbility](../../application-models/widget-development-stage.md):卡片扩展能力,提供卡片开发能力。 | | FORM | 0 | [FormExtensionAbility](../../application-models/service-widget-overview.md):卡片扩展能力,提供卡片开发能力。 |
| WORK_SCHEDULER | 1 | [WorkSchedulerExtensionAbility](../../task-management/work-scheduler-dev-guide.md):延时任务扩展能力,允许应用在系统闲时执行实时性不高的任务。 | | WORK_SCHEDULER | 1 | [WorkSchedulerExtensionAbility](../../task-management/work-scheduler-dev-guide.md):延时任务扩展能力,允许应用在系统闲时执行实时性不高的任务。 |
| INPUT_METHOD | 2 | [InputMethodExtensionAbility](js-apis-inputmethod-extension-ability.md):输入法扩展能力,用于开发输入法应用。 | | INPUT_METHOD | 2 | [InputMethodExtensionAbility](js-apis-inputmethod-extension-ability.md):输入法扩展能力,用于开发输入法应用。 |
| SERVICE | 3 | [ServiceExtensionAbility](../../application-models/serviceextensionability.md):后台服务扩展能力,提供后台运行并对外提供相应能力。 | | SERVICE | 3 | [ServiceExtensionAbility](../../application-models/serviceextensionability.md):后台服务扩展能力,提供后台运行并对外提供相应能力。 |
| ACCESSIBILITY | 4 | [AccessibilityExtensionAbility](js-apis-application-accessibilityExtensionAbility.md):无障碍服务扩展能力,支持访问与操作前台界面。 | | ACCESSIBILITY | 4 | [AccessibilityExtensionAbility](js-apis-application-accessibilityExtensionAbility.md):无障碍服务扩展能力,支持访问与操作前台界面。 |
| DATA_SHARE | 5 | [DataShareExtensionAbility](../../database/database-datashare-guidelines.md):数据共享扩展能力,用于对外提供数据读写服务。 | | DATA_SHARE | 5 | [DataShareExtensionAbility](../../database/share-data-by-datashareextensionability.md):数据共享扩展能力,用于对外提供数据读写服务。 |
| FILE_SHARE | 6 | FileShareExtensionAbility:文件共享扩展能力,用于应用间的文件分享。预留能力,当前暂未支持。 | | FILE_SHARE | 6 | FileShareExtensionAbility:文件共享扩展能力,用于应用间的文件分享。预留能力,当前暂未支持。 |
| STATIC_SUBSCRIBER| 7 | [StaticSubscriberExtensionAbility](js-apis-application-staticSubscriberExtensionAbility.md):静态广播扩展能力,用于处理静态事件,比如开机事件。 | | STATIC_SUBSCRIBER| 7 | [StaticSubscriberExtensionAbility](js-apis-application-staticSubscriberExtensionAbility.md):静态广播扩展能力,用于处理静态事件,比如开机事件。 |
| WALLPAPER | 8 | WallpaperExtensionAbility:壁纸扩展能力,用于实现桌面壁纸。预留能力,当前暂未支持。 | | WALLPAPER | 8 | WallpaperExtensionAbility:壁纸扩展能力,用于实现桌面壁纸。预留能力,当前暂未支持。 |
......
...@@ -29,7 +29,7 @@ createEffect(source: image.PixelMap): Filter ...@@ -29,7 +29,7 @@ createEffect(source: image.PixelMap): Filter
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------- | ----------------- | ---- | -------- | | ------- | ----------------- | ---- | -------- |
| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例。 | | source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md) |
**返回值:** **返回值:**
...@@ -61,7 +61,7 @@ createColorPicker(source: image.PixelMap): Promise\<ColorPicker> ...@@ -61,7 +61,7 @@ createColorPicker(source: image.PixelMap): Promise\<ColorPicker>
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------- | ---- | -------------------------- | | -------- | ----------- | ---- | -------------------------- |
| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例。 | | source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md) |
**返回值:** **返回值:**
...@@ -95,7 +95,7 @@ createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>) ...@@ -95,7 +95,7 @@ createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>)
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------ | ---- | -------------------------- | | -------- | ------------------ | ---- | -------------------------- |
| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 |image模块创建的PixelMap实例。 | | source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 |image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md) |
| callback | AsyncCallback\<[ColorPicker](#colorpicker)> | 是 | 回调函数。返回创建的ColorPicker实例。 | | callback | AsyncCallback\<[ColorPicker](#colorpicker)> | 是 | 回调函数。返回创建的ColorPicker实例。 |
**示例:** **示例:**
......
...@@ -476,9 +476,9 @@ AVPlayer回调的**错误分类**<a name = error_info></a>可以分为以下几 ...@@ -476,9 +476,9 @@ AVPlayer回调的**错误分类**<a name = error_info></a>可以分为以下几
| 801 | Unsupport Capability: | 不支持该API能力,表示调用无效。 | | 801 | Unsupport Capability: | 不支持该API能力,表示调用无效。 |
| 5400101 | No Memory: | 播放内存不足,[AVPlayerState](#avplayerstate9)会进入error状态。 | | 5400101 | No Memory: | 播放内存不足,[AVPlayerState](#avplayerstate9)会进入error状态。 |
| 5400102 | Operate Not Permit: | 当前状态机不支持此操作,表示调用无效。 | | 5400102 | Operate Not Permit: | 当前状态机不支持此操作,表示调用无效。 |
| 5400103 | IO Error: | 播放中发现码流异常 | | 5400103 | IO Error: | 播放中发现码流异常[AVPlayerState](#avplayerstate9)会进入error状态。 |
| 5400104 | Network Timeout: | 网络原因超时响应,[AVPlayerState](#avplayerstate9)会进入error状态。 | | 5400104 | Network Timeout: | 网络原因超时响应,[AVPlayerState](#avplayerstate9)会进入error状态。 |
| 5400105 | Service Died: | 播放进程死亡,[AVPlayerState](#avplayerstate9)会进入error状态。 | | 5400105 | Service Died: | 播放进程死亡,[AVPlayerState](#avplayerstate9)会进入error状态,需要调用release后重新创建实例。 |
| 5400106 | Unsupport Format: | 不支持的文件格式,[AVPlayerState](#avplayerstate9)会进入error状态。 | | 5400106 | Unsupport Format: | 不支持的文件格式,[AVPlayerState](#avplayerstate9)会进入error状态。 |
**示例:** **示例:**
...@@ -3775,7 +3775,7 @@ on(type: 'play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeCh ...@@ -3775,7 +3775,7 @@ on(type: 'play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeCh
**示例:** **示例:**
```js ```js
import fileio from '@ohos.fileio' import fs from '@ohos.file.fs';
let audioPlayer = media.createAudioPlayer(); //创建一个音频播放实例 let audioPlayer = media.createAudioPlayer(); //创建一个音频播放实例
audioPlayer.on('dataLoad', () => { //设置'dataLoad'事件回调,src属性设置成功后,触发此回调 audioPlayer.on('dataLoad', () => { //设置'dataLoad'事件回调,src属性设置成功后,触发此回调
...@@ -3819,15 +3819,15 @@ audioPlayer.on('error', (error) => { //设置'error'事件回调 ...@@ -3819,15 +3819,15 @@ audioPlayer.on('error', (error) => { //设置'error'事件回调
let fdPath = 'fd://'; let fdPath = 'fd://';
// path路径的码流可通过"hdc file send D:\xxx\01.mp3 /data/accounts/account_0/appdata" 命令,将其推送到设备上 // path路径的码流可通过"hdc file send D:\xxx\01.mp3 /data/accounts/account_0/appdata" 命令,将其推送到设备上
let path = '/data/accounts/account_0/appdata/ohos.xxx.xxx.xxx/01.mp3'; let path = '/data/accounts/account_0/appdata/ohos.xxx.xxx.xxx/01.mp3';
fileio.open(path).then((fdValue) => { fs.open(path).then((file) => {
fdPath = fdPath + '' + fdValue; fdPath = fdPath + '' + file.fd;
console.info('open fd success fd is' + fdPath); console.info('open fd success fd is' + fdPath);
audioPlayer.src = fdPath; //设置src属性,并触发'dataLoad'事件回调
}, (err) => { }, (err) => {
console.info('open fd failed err is' + err); console.info('open fd failed err is' + err);
}).catch((err) => { }).catch((err) => {
console.info('open fd failed err is' + err); console.info('open fd failed err is' + err);
}); });
audioPlayer.src = fdPath; //设置src属性,并触发'dataLoad'事件回调
``` ```
### on('timeUpdate') ### on('timeUpdate')
......
...@@ -352,7 +352,7 @@ let res: boolean = AppStorage.IsMutable('simpleProp'); ...@@ -352,7 +352,7 @@ let res: boolean = AppStorage.IsMutable('simpleProp');
static Size(): number static Size(): number
返回LocalStorage中的属性数量。 返回AppStorage中的属性数量。
**返回值:** **返回值:**
...@@ -487,7 +487,7 @@ let res1: boolean = storage.set('PropB', 47); // false ...@@ -487,7 +487,7 @@ let res1: boolean = storage.set('PropB', 47); // false
### setOrCreate<sup>9+</sup> ### setOrCreate<sup>9+</sup>
setOrCreate&lt;T&gt;(propName: string, newValue?: T): boolean setOrCreate&lt;T&gt;(propName: string, newValue: T): boolean
propName如果已经在LocalStorage中存在,则设置propName对应是属性的值为newValue。如果不存在,则创建propName属性,初始化为newValue。 propName如果已经在LocalStorage中存在,则设置propName对应是属性的值为newValue。如果不存在,则创建propName属性,初始化为newValue。
...@@ -496,7 +496,7 @@ propName如果已经在LocalStorage中存在,则设置propName对应是属性 ...@@ -496,7 +496,7 @@ propName如果已经在LocalStorage中存在,则设置propName对应是属性
| 参数名 | 类型 | 必填 | 参数描述 | | 参数名 | 类型 | 必填 | 参数描述 |
| -------- | ------ | ---- | ----------------------- | | -------- | ------ | ---- | ----------------------- |
| propName | string | 是 | LocalStorage中的属性名。 | | propName | string | 是 | LocalStorage中的属性名。 |
| newValue | T | | 属性值,不能为undefined或者null。 | | newValue | T | | 属性值,不能为undefined或者null。 |
**返回值:** **返回值:**
...@@ -573,7 +573,7 @@ var link2: SubscribedAbstractProperty<number> = storage.setAndLink('PropA', 50); ...@@ -573,7 +573,7 @@ var link2: SubscribedAbstractProperty<number> = storage.setAndLink('PropA', 50);
### prop<sup>9+</sup> ### prop<sup>9+</sup>
prop&lt;T&gt;(propName: string): SubscribedAbstractProperty&lt;T&gt; prop&lt;S&gt;(propName: string): SubscribedAbstractProperty&lt;S&gt;
如果给定的propName在LocalStorage存在,则返回与LocalStorage中propName对应属性的单向绑定数据。如果LocalStorage中不存在propName,则返回undefined。单向绑定数据的修改不会被同步回LocalStorage中。 如果给定的propName在LocalStorage存在,则返回与LocalStorage中propName对应属性的单向绑定数据。如果LocalStorage中不存在propName,则返回undefined。单向绑定数据的修改不会被同步回LocalStorage中。
...@@ -587,7 +587,7 @@ prop&lt;T&gt;(propName: string): SubscribedAbstractProperty&lt;T&gt; ...@@ -587,7 +587,7 @@ prop&lt;T&gt;(propName: string): SubscribedAbstractProperty&lt;T&gt;
| 类型 | 描述 | | 类型 | 描述 |
| ----------------------------------- | ---------------------------------------- | | ----------------------------------- | ---------------------------------------- |
| SubscribedAbstractProperty&lt;T&gt; | SubscribedAbstractProperty&lt;T&gt;的实例,如果AppStorage不存在对应的propName,在返回undefined。 | | SubscribedAbstractProperty&lt;S&gt; | SubscribedAbstractProperty&lt;S&gt;的实例,如果AppStorage不存在对应的propName,在返回undefined。 |
```ts ```ts
...@@ -600,7 +600,7 @@ prop1.set(1); // one-way sync: prop1.get()=1; but prop2.get() == 47 ...@@ -600,7 +600,7 @@ prop1.set(1); // one-way sync: prop1.get()=1; but prop2.get() == 47
### setAndProp<sup>9+</sup> ### setAndProp<sup>9+</sup>
setAndProp&lt;T&gt;(propName: string, defaultValue: T): SubscribedAbstractProperty&lt;T&gt; setAndProp&lt;S&gt;(propName: string, defaultValue: S): SubscribedAbstractProperty&lt;S&gt;
propName在LocalStorage存在,则返回该propName对应的属性的单向绑定数据。如果不存在,则使用defaultValue在LocalStorage创建和初始化propName对应的属性,返回其单向绑定数据。 propName在LocalStorage存在,则返回该propName对应的属性的单向绑定数据。如果不存在,则使用defaultValue在LocalStorage创建和初始化propName对应的属性,返回其单向绑定数据。
...@@ -609,13 +609,13 @@ propName在LocalStorage存在,则返回该propName对应的属性的单向绑 ...@@ -609,13 +609,13 @@ propName在LocalStorage存在,则返回该propName对应的属性的单向绑
| 参数名 | 类型 | 必填 | 参数描述 | | 参数名 | 类型 | 必填 | 参数描述 |
| ------------ | ------ | ---- | ---------------------------------------- | | ------------ | ------ | ---- | ---------------------------------------- |
| propName | string | 是 | LocalStorage中的属性名。 | | propName | string | 是 | LocalStorage中的属性名。 |
| defaultValue | T | 是 | 当propName在AppStorage中不存在,使用default在AppStorage中初始化对应的propName。 | | defaultValue | S | 是 | 当propName在AppStorage中不存在,使用default在AppStorage中初始化对应的propName。 |
**返回值:** **返回值:**
| 类型 | 描述 | | 类型 | 描述 |
| ----------------------------------- | ---------------------------------------- | | ----------------------------------- | ---------------------------------------- |
| SubscribedAbstractProperty&lt;T&gt; | SubscribedAbstractProperty&lt;T&gt;的实例,和AppStorage中propName对应属性的单向绑定的数据。 | | SubscribedAbstractProperty&lt;S&gt; | SubscribedAbstractProperty&lt;S&gt;的实例,和AppStorage中propName对应属性的单向绑定的数据。 |
```ts ```ts
...@@ -762,20 +762,6 @@ let prop1 = AppStorage.Prop('PropA'); ...@@ -762,20 +762,6 @@ let prop1 = AppStorage.Prop('PropA');
prop1.set(1); // prop1.get()=1 prop1.set(1); // prop1.get()=1
``` ```
### aboutToBeDeleted<sup>10+</sup>
abstract aboutToBeDeleted(): void
取消SubscribedAbstractProperty实例对AppStorage/LocalStorage单/双向同步关系。
```ts
AppStorage.SetOrCreate('PropA', 47);
let link = AppStorage.SetAndLink('PropB', 49); // PropA -> 47, PropB -> 49
link.aboutToBeDeleted();
link.set(50); // PropB -> 49, link.get() --> undefined
```
## PersistentStorage ## PersistentStorage
......
...@@ -60,4 +60,4 @@ JS服务卡片(entry/src/main/js/Widget)的典型开发目录结构如下: ...@@ -60,4 +60,4 @@ JS服务卡片(entry/src/main/js/Widget)的典型开发目录结构如下:
FA卡片需要在应用配置文件config.json中进行配置。详细的配置内容请参考[FA卡片配置文件说明](../../application-models/widget-development-fa.md#配置卡片配置文件) FA卡片需要在应用配置文件config.json中进行配置。详细的配置内容请参考[FA卡片配置文件说明](../../application-models/widget-development-fa.md#配置卡片配置文件)
Stage卡片需要在应用配置文件module.json5中的extensionAbilities标签下,配置ExtensionAbility相关信息。详细的配置内容请参考[Stage卡片配置文件说明](../../application-models/arkts-ui-widget-configuration.md) Stage卡片需要在应用配置文件module.json5中的extensionAbilities标签下,配置ExtensionAbility相关信息。详细的配置内容请参考[Stage卡片配置文件说明](../../application-models/arkts-ui-widget-configuration.md)
\ No newline at end of file
...@@ -433,7 +433,7 @@ OpenHarmony 3.2版本完整里程碑如下图所示,阅读本文档了解更 ...@@ -433,7 +433,7 @@ OpenHarmony 3.2版本完整里程碑如下图所示,阅读本文档了解更
- 支持应用/服务开发环境的诊断功能,能够检测开发环境是否完备,确保开发者拥有良好的开发体验。若检查结果中存在不满足的检查项,建议您根据修复建议进行调整。 - 支持应用/服务开发环境的诊断功能,能够检测开发环境是否完备,确保开发者拥有良好的开发体验。若检查结果中存在不满足的检查项,建议您根据修复建议进行调整。
- 提供基础模板和卡片模板,支持Stage工程下创建ArkTS服务卡片,帮助开发者快速开发应用和服务 - 提供基础模板和卡片模板,支持Stage工程下创建ArkTS服务卡片。
- 支持OpenHarmony工程添加Extension Ability模板,具体请参考在模块中添加Ability。 - 支持OpenHarmony工程添加Extension Ability模板,具体请参考在模块中添加Ability。
...@@ -610,12 +610,6 @@ API变更请参考: ...@@ -610,12 +610,6 @@ API变更请参考:
| 无障碍 | [AccessibilityExtensionAbility示例](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/AccessibilityExtAbility) | 本示例展示了AccessibilityExtensionAbility的简单应用,使用多个辅助功能接口实现了一些快捷的交互方式。 | ArkTS | | 无障碍 | [AccessibilityExtensionAbility示例](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/AccessibilityExtAbility) | 本示例展示了AccessibilityExtensionAbility的简单应用,使用多个辅助功能接口实现了一些快捷的交互方式。 | ArkTS |
| 企业管理 | [企业设备管理ExtensionAbility](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility) | 企业设备管理扩展能力,是MDM应用必备组件。当开发者为企业开发MDM(Mobile Device Management)应用时,需继承EnterpriseAdminExtensionAbility,在EnterpriseAdminExtensionAbility实例中实现MDM业务逻辑,EnterpriseAdminExtensionAbility实现了系统管理状态变化通知功能,并定义了管理应用激活、去激活、应用安装、卸载事件等回调接口。 | ArkTS | | 企业管理 | [企业设备管理ExtensionAbility](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility) | 企业设备管理扩展能力,是MDM应用必备组件。当开发者为企业开发MDM(Mobile Device Management)应用时,需继承EnterpriseAdminExtensionAbility,在EnterpriseAdminExtensionAbility实例中实现MDM业务逻辑,EnterpriseAdminExtensionAbility实现了系统管理状态变化通知功能,并定义了管理应用激活、去激活、应用安装、卸载事件等回调接口。 | ArkTS |
| 任务管理 | [任务延时调度](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/WorkScheduler) | 本示例使用\@ohos.WorkSchedulerExtensionAbility 、\@ohos.net.http 、\@ohos.notification 、\@ohos.bundle 、\@ohos.fileio 等接口,实现了设置后台任务、下载更新包 、保存更新包、发送通知 、安装更新包实现升级的功能。 | ArkTS | | 任务管理 | [任务延时调度](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/WorkScheduler) | 本示例使用\@ohos.WorkSchedulerExtensionAbility 、\@ohos.net.http 、\@ohos.notification 、\@ohos.bundle 、\@ohos.fileio 等接口,实现了设置后台任务、下载更新包 、保存更新包、发送通知 、安装更新包实现升级的功能。 | ArkTS |
| 网络 | [上传](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/Connectivity/Upload) | 本示例主要展示Request服务向三方应用提供系统上传服务能力,通过\@ohos.request,\@ohos.multimedia.mediaLibrary等接口去实现图片的选取与上传。 | ArkTS |
| 任务管理 | [短时任务](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/TransientTask) | 本示例主要展示后台任务中的短时任务。通过\@ohos.resourceschedule.backgroundTaskManager,\@ohos.app.ability.quickFixManager等接口实现应用热更新的方式去展现短时任务机制。 | ArkTS |
| 任务管理 | [长时任务](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/ContinuousTask) | 本示例展示后台任务的长时任务。通过使用\@ohos.resourceschedule.backgroundTaskManager实现后台播放音乐时避免进入挂起(Suspend)状态。 | ArkTS |
| 元能力 | [ArkTS卡片计算器](https://gitee.com/openharmony/applications_app_samples/tree/master/ability/ArkTSFormCalc) | 本示例展示了使用ArkTS卡片开发的计算器模型。 | ArkTS |
| 元能力 | [ArkTS卡片Canvas小游戏](https://gitee.com/openharmony/applications_app_samples/tree/master/ability/ArkTSCard/CanvasGame) | 本示例展示了如何通过ArkTS卡片的Canvas自定义绘制能力实现一个简单的五子棋游戏卡片。<br/>- 使用Canvas绘制棋盘和黑白棋子的落子。<br/>- 通过卡片支持的点击事件进行交互,让用户在棋盘上进行黑白棋子的对局。<br/>- 通过TS的逻辑代码实现五子棋输赢判定、回退等逻辑计算,整个游戏过程无需拉起FormExtensionAbility。 | ArkTS |
| 元能力 | [ArkTs音乐卡片](https://gitee.com/openharmony/applications_app_samples/tree/master/ability/ArkTSCard/ArkTSCardMusicSample) | 本示例展示了如何通过ArkTs卡片实现一个简单的音乐卡片。 | ArkTS |
请访问[Samples](https://gitee.com/openharmony/applications_app_samples)仓了解更多信息。 请访问[Samples](https://gitee.com/openharmony/applications_app_samples)仓了解更多信息。
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
- [包管理](js-apidiff-bundle.md) - [包管理](js-apidiff-bundle.md)
- [网络及通信](js-apidiff-communication.md) - [网络及通信](js-apidiff-communication.md)
- [语言编译器运行时](js-apidiff-compiler-and-runtime.md) - [语言编译器运行时](js-apidiff-compiler-and-runtime.md)
- [定制](js-apidiff-customization.md)
- [DFX](js-apidiff-dfx.md) - [DFX](js-apidiff-dfx.md)
- [分布式数据](js-apidiff-distributed-data.md) - [分布式数据](js-apidiff-distributed-data.md)
- [文件管理](js-apidiff-file-management.md) - [文件管理](js-apidiff-file-management.md)
......
# 用户IAM子系统Changelog
## cl.useriam.1 API9 GetVesion接口删除
为优化用户IAM接口,从当前版本开始做如下变更:
用户IAM删除GetVersion(API 9)接口。
**变更影响**
对用户IAM GetVersion(API 9)接口的使用有影响,需删除对此接口的调用,否则会调用失败。
**关键接口/组件变更**
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| ---------------------- | ------------------- | ------------------------- | ------------------------ |
| ohos.userIAM.userAuth | function | getVersion() : number | 删除 |
**适配指导**
需删除对用户IAM GetVersion(API 9)接口的调用。
## cl.useriam.2 API8 GetVesion接口返回值变更
为统一用户IAM GetVersion(API 8)接口的返回值。从当前版本开始做如下变更:
用户IAM GetVersion(API 8)接口的返回值由0变更为1。
**变更影响**
对用户IAM GetVersion(API 8)接口的使用有影响,如应用校验了此接口的返回值,修改后校验不通过。
**关键接口/组件变更**
用户IAM GetVersion(API 8)接口的返回值由0变更为1。
**适配指导**
此接口已废弃,需删除对用户IAM GetVersion(API 8)接口的使用。
# 剪贴板子系统ChangeLog
OpenHarmony 4.0.3.2 版本相较于OpenHarmony 之前的版本,剪贴板子系统的API变更如下。
## cl.pasteboard.1 convertToTextV9接口变更
接口convertToTextV9由于命名规范和接口返回方式问题,名称变更为toPlainText(),返回方式改为同步方式。
**变更影响**
4.0.3.3版本之前使用接口convertToTextV9开发的应用,在4.0.3.3版本及后续版本中无法继续正常使用。
**关键的接口/组件变更**
- 涉及接口
function convertToTextV9
- 变更前:
```ts
convertToTextV9(callback: AsyncCallback<string>): void;
convertToTextV9(): Promise<string>;
```
- 变更后:
```ts
toPlainText(): string;
```
变更前:
**适配指导**
请使用toPlainText替换convertToTextV9,并注意接口返回方式。
## cl.pasteboard.2 ShareOption属性名称变更,删除了未支持的属性
ShareOption枚举命名从**大驼峰**改成了**全大写**
**变更影响**
4.0.3.3版本之前使用InApp/LocalDevice/CrossDevice类型开发的应用,在4.0.3.3版本及后续版本中无法继续正常使用。
**关键接口/组件变更**
ShareOption<sup>9+</sup>
变更前:
| 名称 | 值 | 说明 |
| ---- |---|-------------------|
| InApp | 0 | 表示仅允许同应用内粘贴。 |
| LocalDevice | 1 | 表示允许在此设备中任何应用内粘贴。 |
| CrossDevice | 2 | 表示允许跨设备在任何应用内粘贴。 |
变更后:
| 名称 | 值 | 说明 |
| ---- |---|-------------------|
| INAPP | 0 | 表示仅允许同应用内粘贴。 |
| LOCALDEVICE | 1 | 表示允许在此设备中任何应用内粘贴。 |
| CROSSDEVICE | 2 | 表示允许跨设备在任何应用内粘贴。 |
**适配指导**
按新的语义进行适配。
\ No newline at end of file
# 帐号子系统ChangeLog
OpenHarmony4.0.3.2版本相较于OpenHarmony之前的版本,帐号模块的API变更如下。
## cl.account_os_account.1 应用帐号isAccountRemovable命名变更
类Authenticator中的成员函数isAccountRemovable由于命名不统一问题,名称变更为checkAccountRemovable。
**变更影响**
类Authenticator中的成员函数isAccountRemovable,在4.0.3.2版本及后续版本中无法继续正常使用,由checkAccountRemovable代替。
**关键的接口/组件变更**
- 涉及接口
```ts
class Authenticator {
...
isAccountRemovable
...
}
```
- 变更前:
```ts
class Authenticator {
...
/**
* Checks whether the specified account can be removed.
* @param name Indicates the account name.
* @param callback Indicates the authenticator callback.
* @returns void.
* @since 9
*/
isAccountRemovable(name: string, callback: AuthCallback): void;
...
}
```
- 变更后:
```ts
class Authenticator {
...
/**
* Checks whether the specified account can be removed.
* @param name Indicates the account name.
* @param callback Indicates the authenticator callback.
* @returns void.
* @since 9
*/
checkAccountRemovable(name: string, callback: AuthCallback): void;
...
}
```
## cl.account_os_account.2 系统帐号checkConstraintEnabled命名变更
checkConstraintEnabled由于命名不统一问题,名称变更为checkOsAccountConstraintEnabled。
**变更影响**
checkConstraintEnabled接口,在4.0.3.2版本及后续版本中无法继续正常使用,由checkOsAccountConstraintEnabled代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
checkConstraintEnabled
...
}
```
- 变更前:
```ts
checkConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void;
checkConstraintEnabled(localId: number, constraint: string): Promise<boolean>;
```
- 变更后:
```ts
checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void;
checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise<boolean>;
```
## cl.account_os_account.3 系统帐号checkOsAccountConstraintEnabled权限场景变更
checkOsAccountConstraintEnabled接口的权限管控新增可选权限:ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS。
**变更影响**
在4.0.3.2版本及后续版本中,应用申请ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS权限亦可调用checkOsAccountConstraintEnabled,
切此前版本申请ohos.permission.MANAGE_LOCAL_ACCOUNTS权限的不影响使用
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
checkOsAccountConstraintEnabled
...
}
```
- 变更前:
```ts
...
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
...
checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void;
checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise<boolean>;
```
- 变更后:
```ts
...
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
...
checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void;
checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise<boolean>;
```
## cl.account_os_account.4 系统帐号queryOsAccountLocalIdFromProcessd命名变更
queryOsAccountLocalIdFromProcess由于命名不统一问题,名称变更为getOsAccountLocalId。
**变更影响**
queryOsAccountLocalIdFromProcess接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalId代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
queryOsAccountLocalIdFromProcess
...
}
```
- 变更前:
```ts
queryOsAccountLocalIdFromProcess(callback: AsyncCallback<number>): void;
queryOsAccountLocalIdFromProcess(): Promise<number>;
```
- 变更后:
```ts
getOsAccountLocalId(callback: AsyncCallback<number>): void;
getOsAccountLocalId(): Promise<number>;
```
## cl.account_os_account.5 系统帐号queryOsAccountLocalIdFromUid命名变更
queryOsAccountLocalIdFromUid由于命名不统一问题,名称变更为getOsAccountLocalIdForUid。
**变更影响**
queryOsAccountLocalIdFromUid接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalIdForUid代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
queryOsAccountLocalIdFromUid
...
}
```
- 变更前:
```ts
queryOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback<number>): void;
queryOsAccountLocalIdFromUid(uid: number): Promise<number>;
```
- 变更后:
```ts
getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback<number>): void;
getOsAccountLocalIdForUid(uid: number): Promise<number>;
```
## cl.account_os_account.6 系统帐号queryOsAccountLocalIdFromDomain命名变更
queryOsAccountLocalIdFromDomain由于命名不统一问题,名称变更为getOsAccountLocalIdForDomain。
**变更影响**
queryOsAccountLocalIdFromDomain接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalIdForDomain代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
queryOsAccountLocalIdFromDomain
...
}
```
- 变更前:
```ts
queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void;
queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise<number>;
```
- 变更后:
```ts
getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void;
getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise<number>;
```
## cl.account_os_account.7 系统帐号getActivatedOsAccountIds命名变更
getActivatedOsAccountIds由于命名不统一问题,名称变更为getActivatedOsAccountLocalIds。
**变更影响**
getActivatedOsAccountIds接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getActivatedOsAccountLocalIds代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
getActivatedOsAccountIds
...
}
```
- 变更前:
```ts
getActivatedOsAccountIds(callback: AsyncCallback<Array<number>>): void;
getActivatedOsAccountIds(): Promise<Array<number>>;
```
- 变更后:
```ts
getActivatedOsAccountLocalIds(callback: AsyncCallback<Array<number>>): void;
getActivatedOsAccountLocalIds(): Promise<Array<number>>;
```
## cl.account_os_account.8 系统帐号queryOsAccountLocalIdBySerialNumber命名变更
queryOsAccountLocalIdBySerialNumber由于命名不统一问题,名称变更为getOsAccountLocalIdForSerialNumber。
**变更影响**
queryOsAccountLocalIdBySerialNumber接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalIdForSerialNumber代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
queryOsAccountLocalIdBySerialNumber
...
}
```
- 变更前:
```ts
queryOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback<number>): void;
queryOsAccountLocalIdBySerialNumber(serialNumber: number): Promise<number>;
```
- 变更后:
```ts
getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback<number>): void;
getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise<number>;
```
## cl.account_os_account.9 系统帐号querySerialNumberByOsAccountLocalId命名变更
querySerialNumberByOsAccountLocalId由于命名不统一问题,名称变更为getSerialNumberForOsAccountLocalId。
**变更影响**
querySerialNumberByOsAccountLocalId接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getSerialNumberForOsAccountLocalId代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
querySerialNumberByOsAccountLocalId
...
}
```
- 变更前:
```ts
querySerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void;
querySerialNumberByOsAccountLocalId(localId: number): Promise<number>;
```
- 变更后:
```ts
getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void;
getSerialNumberForOsAccountLocalId(localId: number): Promise<number>;
```
## cl.account_os_account.10 系统帐号getBundleIdFromUid命名变更
getBundleIdFromUid由于命名不统一问题,名称变更为getBundleIdForUid。
**变更影响**
getBundleIdFromUid接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getBundleIdForUid代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
getBundleIdFromUid
...
}
```
- 变更前:
```ts
getBundleIdFromUid(uid: number, callback: AsyncCallback<number>): void;
getBundleIdFromUid(uid: number): Promise<number>;
```
- 变更后:
```ts
getBundleIdForUid(uid: number, callback: AsyncCallback<number>): void;
getBundleIdForUid(uid: number): Promise<number>;
```
## cl.account_os_account.11 系统帐号queryOsAccountConstraintSourceTypes命名变更
queryOsAccountConstraintSourceTypes由于命名不统一问题,名称变更为getOsAccountConstraintSourceTypes。
**变更影响**
queryOsAccountConstraintSourceTypes接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountConstraintSourceTypes代替。
**关键的接口/组件变更**
- 涉及接口
```
interface AccountManager {
...
queryOsAccountConstraintSourceTypes
...
}
```
- 变更前:
```ts
queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback<Array<ConstraintSourceTypeInfo>>): void;
queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise<Array<ConstraintSourceTypeInfo>>;
```
- 变更后:
```ts
getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback<Array<ConstraintSourceTypeInfo>>): void;
getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise<Array<ConstraintSourceTypeInfo>>;
```
\ No newline at end of file
# Readme
- [元能力](changelogs-ability.md)
- [帐号](changelogs-account_os_account.md)
- [ArkUI](changelogs-arkui.md)
- [多媒体-相机](changelogs-camera.md)
- [设备管理](changelogs-device-manager.md)
- [USB](changelogs-device-usb.md)
- [分布式调度](changelogs-dmsfwk.md)
- [分布式软总线](changelogs-dsoftbus.md)
- [定制管理](changelogs-enterprise_device_management.md)
- [文件管理](changelogs-filemanagement.md)
- [位置服务](changelogs-geolocation.md)
- [全球化](changelogs-global.md)
- [输入法框架](changelogs-inputmethod-framworks.md)
- [多媒体](changelogs-multimedia.md)
- [多模输入](changelogs-multimodalinput.md)
- [事件通知](changelogs-notification.md)
- [电源管理](changelogs-power.md)
- [上传下载](changelogs-request.md)
- [资源管理](changelogs-resource-manager.md)
- [资源调度](changelogs-resourceschedule.md)
- [电话服务](changelogs-telephony.md)
- [测试](changelogs-testfwk_arkxtest.md)
- [主题](changelogs-theme.md)
- [用户IAM](changelogs-useriam.md)
- [元能力-WantAgent](changelogs-wantAgent.md)
- [Web](changelogs-web.md)
- [基础通信-WIFI](changelogs-wifi.md)
# xxx子系统ChangeLog
相比最近一个发布版本(包括不限于LTS、Release、Beta、monthly版本)发生了影响契约兼容性(契约兼容:也称语义兼容,指版本演进后,开发者原有程序行为不发生变化)的变更(包括不限于接口名、参数、返回值、所需要的权限、调用顺序、枚举值、配置参数、路径等),则需要在ChangeLog中对变更进行阐述。
## cl.subsystemname.x xxx功能变更, 例:DeviceType属性变更、相机权限变更(尽量概括,不要超过15个字)
每个变更标题前需要附加编号:cl.subsystemname.x。cl为ChangeLog首字母缩写,subsystemname请填写子系统英文标准名称,x表示变更序号(从低到高逐位增加,起始为1)。
以功能维度对变更点进行概括描述。例如:xxx功能的xxx、xxx等发生了xxx变化,开发者需要根据以下说明对应用进行适配。
如果有此变更有对应的需求或设计文档,可以在描述中附上对应的设计文档编号。
**变更影响**
是否影响已发布的接口或者接口行为发生变更,影响的是JS接口还是Native接口。
是否影响在此前版本已开发的应用,即应用是否需要进行适配动才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
列举此功能变更涉及的接口/组件变更。
**适配指导(可选,不涉及则可以删除)**
提供指导,帮助开发者针对相关变更进行适配,使应用可以与新版本兼容。
例:
在xxx文件中将xxx参数修改为xxx。
```
sample code
```
# arkui子系统ChangeLog
## cl.arkui.1 xcomponent组件接口变更
arkui子系统xcomponent组件接口存在变更:
- 去除getXComponentSurfaceId和setXComponentSurfaceSize接口的@systemapi标签
- 指定getXComponentSurfaceId,getXComponentContext和setXComponentSurfaceSize接口的返回值类型
开发者需要根据以下说明对应用进行适配。
**变更影响**
影响已发布的JS接口,应用需要进行适配才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
- getXComponentSurfaceId:改为public接口,指定返回值类型为string
- setXComponentSurfaceSize:改为public接口,指定返回值类型为void
- getXComponentContext:指定返回值类型为Object
**适配指导**
不同场景下的启动规则说明如下:
开发者适配内容:
- **getXComponentSurfaceId**
- OpenHarmony 3.2-beta3 版本规则:
- 系统接口systemapi。
- 未指定返回值
- OpenHarmony 3.2-Beta4 版本新规则:
- 公共接口。
- 指定返回值类型为string
- 开发者需要按照string类型处理返回值
- **setXComponentSurfaceSize**
- OpenHarmony 3.2-beta3 版本规则:
- 系统接口systemapi。
- 未指定返回值
- OpenHarmony 3.2-Beta4 版本新规则:
- 公共接口。
- 指定返回值类型为void
- 开发者需要按照void类型处理返回值
- **getXComponentContext**
- OpenHarmony 3.2-beta3 版本规则:
- 未指定返回值
- OpenHarmony 3.2-Beta4 版本新规则:
- 指定返回值类型为Object
- 开发者需要按照Object类型处理返回值
## cl.arkui.2 弹窗类组件接口样式变更
ArkUI子系统alertDialog, actionSheet, customDialog组件及prompt, promptAction接口存在样式变更:
- promptAction.showDialog, promptAction.showActionMenu, alertDialog, actionSheet, customDialog更新弹窗底板模糊效果
**变更影响**
默认弹窗底板模糊效果
**关键的接口/组件变更**
涉及接口: promptAction.showDialog, promptAction.showActionMenu;
涉及组件: alertDialog, actionSheet, customDialog
**适配指导**
无需适配
## cl.arkui.3 自定义组件成员变量初始化的方式与约束校验场景补全
[自定义组件成员变量初始化规则](../../../application-dev/quick-start/arkts-restrictions-and-extensions.md#自定义组件成员变量初始化的方式与约束)请参考文档,此版本修复了某些遗漏场景的校验。
**变更影响**
如果未按照文档规范,进行自定义组件成员变量初始化赋值,编译报错。
**关键的接口/组件变更**
不涉及。
**适配指导**
按文档提示修改。
## cl.arkui.4 自定义父子组件成员变量赋值约束校验场景补全
[自定义父子组件成员变量赋值规则](../../../application-dev/quick-start/arkts-restrictions-and-extensions.md#自定义组件成员变量初始化的方式与约束)请参考文档,此版本修复了某些遗漏场景的校验。
**变更影响**
如果自定义父子组件成员变量初始化未按照文档规范,编译报错。
**关键的接口/组件变更**
不涉及。
**适配指导**
按文档提示修改,使用其它装饰器变量或常规变量赋值。
## cl.arkui.5 单一子组件校验补全
对 'Button', 'FlowItem','GridItem','GridCol','ListItem','Navigator','Refresh','RichText','ScrollBar','StepperItem','TabContent'等只支持一个子组件的开启校验。
**变更影响**
如果上述组件内有超过一个子组件,编译报错。
**关键的接口/组件变更**
```js
RichText('RichText') {
Text('Text1')
Text('Text2')
}
/* ArkTS:ERROR File: /root/newOH/developtools/ace-ets2bundle/compiler/sample/pages/home.ets:25:7
The component 'RichText' can only have a single child component. */
```
**适配指导**
按报错提示修改,指定组件内只能有一个子组件。
# USB管理 changeLog
## cl.usb_manager.1 API错误信息返回方式变更
USB管理接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。从API9开始作出变更,选择通过抛出异常的方式返回错误信息。
**变更影响**
基于此前版本开发的应用,需适配接口的错误信息返回方式,否则会影响原有业务逻辑。
**关键接口/组件变更**
USB模块名由@ohos.usb.d.ts 变更为 @ohos.usbV9.d.ts,模块内所有接口均增加错误码处理。
**适配指导**
接口以getDevices为例,示例代码如下:
```ts
import usbV9 from '@ohos.usbV9'
try {
usbV9.getDevices(); // 如果给该接口传入不合适的参数,则会抛出异常
} catch (err) {
console.error("getDevices errCode:" + err.code + ",errMessage:" + err.message);
}
```
\ No newline at end of file
# 全球化子系统ChangeLog
## cl.global.1 国际化模块接口支持错误码
全球化子系统国际化组件在如下场景中提供的接口修改为支持错误码。从API9开始作以下变更:
- 获取国家、语言的本地化显示
- 获取系统支持的语言列表、语言支持的地区列表
- 判断语言与地区是否匹配
- 获取、设置系统语言、系统国家或地区、系统区域
- 获取、设置系统24小时制
- 获取、添加、移除系统偏好语言
- 获取、设置本地化数字
开发者需要根据以下说明对应用进行适配。
**变更影响**
上述接口修改为System类的静态方法,调用时需要在模块名后加上类名。
设置类接口,返回值由boolean类型修改为void类型。例如,setSystemLanguage接口。
接口调用失败时会根据失败原因抛出相应的错误码。例如,当应用未正确配置权限时,抛出201错误码。
**关键的接口/组件变更**
- 涉及接口
- getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string;
- getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string;
- getSystemLanguages(): Array<string>;
- getSystemCountries(language: string): Array<string>;
- isSuggested(language: string, region?: string): boolean;
- getSystemLanguage(): string;
- setSystemLanguage(language: string): void;
- getSystemRegion(): string;
- setSystemRegion(region: string): void;
- getSystemLocale(): string;
- setSystemLocale(locale: string): void;
- is24HourClock(): boolean;
- set24HourClock(option: boolean): void;
- addPreferredLanguage(language: string, index?: number): void;
- removePreferredLanguage(index: number): void;
- getPreferredLanguageList(): Array<string>;
- getFirstPreferredLanguage(): string;
- getAppPreferredLanguage(): string;
- setUsingLocalDigit(flag: boolean): void;
- getUsingLocalDigit(): boolean;
**适配指导**
使用try-catch块捕获接口抛出的日常。
```
import I18n from '@ohos.i18n'
try {
I18n.System.setSystemLanguage('zh');
} catch(error) {
console.error(`call System.setSystemLanguage failed, error code: ${error.code}, message: ${error.message}.`)
}
```
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册