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

!19304 翻译完成 18434+17934+18662+18417+19103+19107+18959+18909+18655

Merge pull request !19304 from ester.zhou/TR-18434
# InputMethodExtensionAbility Development
# InputMethodExtensionAbility
## When to Use
[InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod-extension-ability.md), inherited from [ExtensionAbility](extensionability-overview.md), is used for developing input method applications.
......
# Notification
- [Notification Overview](notification-overview.md)
- [Notification Subscription (for System Applications Only)](notification-subscription.md)
- [Subscribing to Notifications (for System Applications Only)](notification-subscription.md)
- [Enabling Notification](notification-enable.md)
- [Notification Badge](notification-badge.md)
- [Managing the Notification Badge](notification-badge.md)
- Publishing a Notification
- [Publishing a Basic Notification](text-notification.md)
- [Publishing a Progress Notification](progress-bar-notification.md)
......
# Notification Badge
# Managing the Notification Badge
OpenHarmony provides APIs for setting the notification badge, which is displayed in the upper right corner of the application icon on the home screen to notify the user of the count of unread notifications.
......@@ -11,11 +11,11 @@ After a notification is read, the count on the badge is decremented by 1. If the
1. The notification service provides two methods to increase the count on the notification badge:
- When publishing a notification, pass the **badgeNumber** parameter in [NotificationRequest](../reference/apis/js-apis-notificationManager.md#notificationrequest). After the notification is received, the count on the badge is incremented.
- When publishing a notification, pass the **badgeNumber** parameter in [NotificationRequest](../reference/apis/js-apis-inner-notification-notificationRequest.md#notificationrequest). After the notification is received, the count on the badge is incremented.
- Call the [setBadgeNumber](../reference/apis/js-apis-notificationManager.md#setbadgenumber) API to set the count on the badge.
- Call the [setBadgeNumber()](../reference/apis/js-apis-notificationManager.md#notificationmanagersetbadgenumber10) API to set the count on the badge.
2. To decrease the count on the badge, call the **setBadgeNumber** API.
2. To decrease the count on the badge, call the [setBadgeNumber()](../reference/apis/js-apis-notificationManager.md#notificationmanagersetbadgenumber10) API.
| API| Description|
| -------- | -------- |
......@@ -32,37 +32,37 @@ After a notification is read, the count on the badge is decremented by 1. If the
2. Increase the count on the badge.
When publishing a notification, pass the **badgeNumber** parameter in [NotificationRequest](../reference/apis/js-apis-notificationManager.md#notificationrequest). For details, see [Publishing a Basic Notification](text-notification.md).
When publishing a notification, pass the **badgeNumber** parameter in [NotificationRequest](../reference/apis/js-apis-inner-notification-notificationRequest.md#notificationrequest). For details, see [Publishing a Basic Notification](text-notification.md).
In this example, the **setBadgeNumber** API is called to add a badge. This API is called after a new notification is published.
```ts
function setBadgeNumberCallback(err) {
if (err) {
console.info(`Set badge failed code is ${err.code}, message is ${err.message}`);
} else {
console.info(`Set badge success`);
}
if (err) {
console.error(`Failed to set badge number. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in seting badge number.`);
}
let badgeNumber = 10
let badgeNumber = 10;
notificationManager.setBadgeNumber(badgeNumber, setBadgeNumberCallback);
```
3. Reduce the count on the badge.
3. Decrease the count on the badge.
After a notification is read, the application needs to call the API to set the number of remaining unread notifications. The badge is then updated.
```ts
function setBadgeNumberCallback(err) {
if (err) {
console.info(`Set badge failed code is ${err.code}, message is ${err.message}`);
} else {
console.info(`Set badge success`);
}
if (err) {
console.error(`Failed to set badge number. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in seting badge number.`);
}
let badgeNumber = 9
let badgeNumber = 9;
notificationManager.setBadgeNumber(badgeNumber, setBadgeNumberCallback);
```
......
# Notification Subscription (for System Applications Only)
# Subscribing to Notifications (for System Applications Only)
To receive notifications, an application must subscribe to notifications first. The notification subsystem provides two types of subscription APIs, allowing applications to subscribe to notifications from all applications or notifications from a specific application.
......@@ -13,14 +13,14 @@ The major APIs for notification subscription are described as follows. For detai
**Table 1** Major APIs for notification subscription
| Name | Description|
| API| Description|
| -------- | -------- |
| subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback<void>): void | Subscribes to notifications from a specific application.|
| subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void | Subscribes to notifications from all applications. |
**Table 2** Callbacks for notification subscription
| Name | Description|
| API| Description|
| -------- | -------- |
| onConsume?:(data: SubscribeCallbackData) => void | Callback for receiving notifications. |
| onCancel?:(data: SubscribeCallbackData) => void | Callback for canceling notifications. |
......
......@@ -13,7 +13,7 @@ Below you can see the process of adding a **WantAgent** object to a notification
For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/js-apis-app-ability-wantAgent.md).
| Name| Description|
| API | Description|
| -------- | -------- |
| getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void | Creates a **WantAgent** object.|
| trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback<CompleteData>): void | Triggers a **WantAgent** object.|
......
......@@ -258,4 +258,4 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true })
}
```
![GIF](figures/GIF.gif)
![floating_button](figures/floating_button.gif)
......@@ -333,7 +333,7 @@ For non-custom navigation bars, tabs and tab content are linked by default. For
**Figure 11** Lack of linkage between tabs and tab content
![lack-of-linkage](figures /lack-of-linkage.gif)
![lack-of-linkage](figures/lack-of-linkage.gif)
To manually switch between the tabs, use the **onChange** API provided by the **\<Tabs>** component to listen for the index change and pass the index of the active tab to **currentIndex**.
......
......@@ -14,7 +14,7 @@ Each application can subscribe to common events as required. After your applicat
### Architecture
![]( figures/cesfwk_architecture_diagram.png "CES Architecture")
![](figures/cesfwk_architecture_diagram.png "CES Architecture")
## Directory Structure
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册