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

!12783 翻译完成 11703+11663+11650+11638+11570+11499+10778+12208

Merge pull request !12783 from ester.zhou/TR-11703
# @ohos.accessibility.GesturePath
The **GesturePath** module provides APIs for creating gesture path information required for an accessibility application to inject gestures.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import GesturePath from '@ohos.accessibility.GesturePath';
```
## GesturePath
Defines a gesture path.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
### Attributes
| Name | Type | Readable | Writable | Description |
| ------------ | ---------------------------------------- | ---- | ---- | ------ |
| points | Array<[GesturePoint](js-apis-accessibility-GesturePoint.md#gesturepoint)> | Yes | Yes | Gesture touch point. |
| durationTime | number | Yes | Yes | Total gesture duration, in milliseconds.|
### constructor
constructor(durationTime: number);
Constructor used to create a **GesturePath** object.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| durationTime | number | Yes| Total gesture duration, in milliseconds.|
**Example**
```ts
let gesturePath = new GesturePath.GesturePath(20);
```
# @ohos.accessibility.GesturePoint
The **GesturePoint** module provides APIs for creating gesture touch point information required for an accessibility application to inject gestures.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import GesturePoint from '@ohos.accessibility.GesturePoint';
```
## GesturePoint
Defines a gesture touch point.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
### Attributes
| Name | Type | Readable | Writable | Description |
| --------- | ------ | ---- | ---- | ------- |
| positionX | number | Yes | Yes | X coordinate of the touch point.|
| positionY | number | Yes | Yes | Y coordinate of the touch point.|
### constructor
constructor(positionX: number, positionY: number);
Constructor used to create a **GesturePoint** object.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| positionX | number | Yes| X coordinate of the touch point.|
| positionY | number | Yes | Y coordinate of the touch point.|
**Example**
```ts
let gesturePoint = new GesturePoint.GesturePoint(1, 2);
```
# Accessibility Extension Ability # @ohos.application.AccessibilityExtensionAbility
The **AccessibilityExtensionAbility** module is based on the ExtensionAbility framework and provides the **AccessibilityExtensionAbility**. The **AccessibilityExtensionAbility** module provides accessibility extension capabilities based on the ExtensionAbility framework.
>**NOTE** > **NOTE**
> >
>The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
>The APIs of this module can be used only in the stage model.
## Modules to Import ## Modules to Import
...@@ -18,9 +16,9 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens ...@@ -18,9 +16,9 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens
**System capability**: SystemCapability.BarrierFree.Accessibility.Core **System capability**: SystemCapability.BarrierFree.Accessibility.Core
| Name | Type | Readable | Writable | Description | | Name | Type| Readable| Writable| Description |
| --------- | -------- | ---- | ---- | ------------------------- | | --------- | -------- | ---- | ---- | ------------------------- |
| context | [AccessibilityExtensionContext](js-apis-accessibility-extension-context.md) | Yes | No | Context of the accessibility extension ability. | | context | [AccessibilityExtensionContext](js-apis-inner-application-accessibilityExtensionContext.md) | Yes| No| Context of the accessibility extension ability.|
## AccessibilityEvent ## AccessibilityEvent
...@@ -32,36 +30,10 @@ Defines an accessibility event. ...@@ -32,36 +30,10 @@ Defines an accessibility event.
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
| --------- | ---------------------------------------- | ---- | ---- | ---------- | | --------- | ---------------------------------------- | ---- | ---- | ---------- |
| eventType | [EventType](js-apis-accessibility.md#eventtype) \| [WindowUpdateType](js-apis-accessibility.md#windowupdatetype) \| [TouchGuideType](#touchguidetype) \| [GestureType](#gesturetype) \| [PageUpdateType](#pageupdatetype) | Yes | No | Event type. | | eventType | [accessibility.EventType](js-apis-accessibility.md#EventType) \| [accessibility.WindowUpdateType](js-apis-accessibility.md#WindowUpdateType) \| [TouchGuideType](#touchguidetype) \| [GestureType](#gesturetype) \| [PageUpdateType](#pageupdatetype) | Yes | No | Event type. |
| target | AccessibilityElement | Yes | No | Target component where the event occurs.| | target | AccessibilityElement | Yes | No | Target component where the event occurs.|
| timeStamp | number | Yes | No | Timestamp of the event. | | timeStamp | number | Yes | No | Timestamp of the event. |
## GesturePath
Defines a gesture path.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
### Attributes
| Name | Type | Readable | Writable | Description |
| ------------ | ---------------------------------------- | ---- | ---- | ------ |
| points | Array<[GesturePoint](gesturepoint)> | Yes | Yes | An array of gesture touch points. |
| durationTime | number | Yes | Yes | Total time consumed by the gesture.|
## GesturePoint
Defines a gesture touch point.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
### Attributes
| Name | Type | Readable | Writable | Description |
| --------- | ------ | ---- | ---- | ------- |
| positionX | number | Yes | Yes | X-coordinate of the touch point.|
| positionY | number | Yes | Yes | Y-coordinate of the touch point.|
## GestureType ## GestureType
Enumerates gesture types. Enumerates gesture types.
...@@ -89,7 +61,7 @@ Enumerates gesture types. ...@@ -89,7 +61,7 @@ Enumerates gesture types.
## PageUpdateType ## PageUpdateType
Enumerates the page refresh types. Enumerates the page update types.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core **System capability**: SystemCapability.BarrierFree.Accessibility.Core
...@@ -106,27 +78,25 @@ Enumerates the touch guide event types. ...@@ -106,27 +78,25 @@ Enumerates the touch guide event types.
| Name | Description | | Name | Description |
| ---------- | ------------ | | ---------- | ------------ |
| touchBegin | A touch starts in touch guide mode.| | touchBegin | Start of touch in touch guide mode. |
| touchEnd | A touch ends in touch guide mode.| | touchEnd | End of touch in touch guide mode. |
## AccessibilityExtensionAbility.onConnect ## AccessibilityExtensionAbility.onConnect
onConnect(): void; onConnect(): void;
Called when the **AccessibilityExtensionAbility** is enabled and connected to the system service. In this API, you can initialize service logic. This API can be overridden as required. Called when the **AccessibilityExtensionAbility** is enabled and connected to the system service. In this API, you can have the service logic initialized. This API can be overridden as required.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core **System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
None
**Example** **Example**
```ts ```ts
onConnect(): void { class MyAccessibilityExtensionAbility extends AccessibilityExtensionAbility {
console.log("AxExtensionAbility onConnect"); onConnect() {
} console.log('AxExtensionAbility onConnect');
}
};
``` ```
## AccessibilityExtensionAbility.onDisconnect ## AccessibilityExtensionAbility.onDisconnect
...@@ -137,16 +107,14 @@ Called when the **AccessibilityExtensionAbility** is disabled and disconnected f ...@@ -137,16 +107,14 @@ Called when the **AccessibilityExtensionAbility** is disabled and disconnected f
**System capability**: SystemCapability.BarrierFree.Accessibility.Core **System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
None
**Example** **Example**
```ts ```ts
onDisconnect(): void { class MyAccessibilityExtensionAbility extends AccessibilityExtensionAbility {
console.log("AxExtensionAbility onDisconnect"); onDisconnect() {
} console.log('AxExtensionAbility onDisconnect');
}
};
``` ```
## AccessibilityExtensionAbility.onAccessibilityEvent ## AccessibilityExtensionAbility.onAccessibilityEvent
...@@ -166,19 +134,21 @@ Called when an event that matches the specified bundle and event type occurs. In ...@@ -166,19 +134,21 @@ Called when an event that matches the specified bundle and event type occurs. In
**Example** **Example**
```ts ```ts
onAccessibilityEvent(event: AccessibilityEvent): void { class MyAccessibilityExtensionAbility extends AccessibilityExtensionAbility {
console.log("AxExtensionAbility onAccessibilityEvent"); onAccessibilityEvent(event) {
if (event.eventType == 'click') { console.log('AxExtensionAbility onAccessibilityEvent');
console.log("AxExtensionAbility onAccessibilityEvent: click"); if (event.eventType == 'click') {
console.log('AxExtensionAbility onAccessibilityEvent: click');
}
} }
} };
``` ```
## AccessibilityExtensionAbility.onKeyEvent ## AccessibilityExtensionAbility.onKeyEvent
onKeyEvent(keyEvent: inputEventClient.KeyEvent): boolean; onKeyEvent(keyEvent: KeyEvent): boolean;
Called when a physical key is pressed. In this API, you can determine whether to intercept the key event based on the service. Called when a physical key is pressed. In this API, you can determine whether to intercept an event based on the service.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core **System capability**: SystemCapability.BarrierFree.Accessibility.Core
...@@ -191,12 +161,14 @@ Called when a physical key is pressed. In this API, you can determine whether to ...@@ -191,12 +161,14 @@ Called when a physical key is pressed. In this API, you can determine whether to
**Example** **Example**
```ts ```ts
onKeyEvent(keyEvent: inputEventClient.KeyEvent): boolean { class MyAccessibilityExtensionAbility extends AccessibilityExtensionAbility {
console.log("AxExtensionAbility onKeyEvent"); onKeyEvent(keyEvent) {
if (keyEvent.keyCode == 22) { console.log('AxExtensionAbility onKeyEvent');
console.log("AxExtensionAbility onKeyEvent: intercept 22"); if (keyEvent.keyCode == 22) {
return true; console.log('AxExtensionAbility onKeyEvent: intercept 22');
return true;
}
return false;
} }
return false; };
}
``` ```
# Accessibility Error Codes
## 9300001 Invalid Bundle Name or Ability Name
**Error Message**
Invalid bundle name or ability name.
**Description**
This error code is reported when the entered bundle name or ability name is invalid.
**Possible Causes**
1. The bundle name does not exist.
2. The bundle does not contain the target ability.
**Solution**
1. Verify the bundle name.
2. Check whether the ability name corresponding to the bundle name is correct.
## 9300002 Target Ability Already Enabled
**Error Message**
Target ability already enabled.
**Description**
This error code is reported when the target ability is already enabled.
**Possible Causes**
The target ability is already enabled and cannot be enabled again.
**Solution**
1. Stop the target Ability.
2. Re-enable the target ability.
## 9300003 No Accessibility Permission to Perform the Operation
**Error Message**
Do not have accessibility right for this operation.
**Description**
This error code is reported when an application performs an accessibility operation for which the related permission has not been granted.
**Possible Causes**
The permission for performing the accessibility operation is not granted when the accessibility application is enabled.
**Solution**
1. Request from the user the permission for performing the accessibility operation, stating the reason for the request.
2. Have the accessibility application re-enabled and the required accessibility operation enabled.
## 9300004 Attribute Not Found
**Error Message**
This property does not exist.
**Description**
This error code is reported when the entered attribute of the accessibility element does not exist.
**Possible Causes**
The attribute does not exist in the accessibility element.
**Solution**
Make sure the accessibility element has the target attribute.
## 9300005 Operation Not Supported
**Error Message**
This action is not supported.
**Description**
This error code is reported when the application performs an operation that is not supported by the accessibility element.
**Possible Causes**
The accessibility element does not support the target operation.
**Solution**
Make sure the operation is included in the list of operations supported by the accessibility element.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册