鴻蒙OS NotificationActionButton

2022-10-11 10:10 更新

NotificationActionButton

java.lang.Object

|---ohos.event.notification.NotificationActionButton

public class NotificationActionButton
extends Object
implements Sequenceable

封裝要在通知中顯示的操作按鈕。 您可以調(diào)用 NotificationRequest#addActionButton 將操作按鈕添加到通知。

NotificationActionButton 對象必須包含一個圖標(biāo)、一個標(biāo)題和一個關(guān)聯(lián)的 IntentAgent,定義了單擊操作按鈕時要觸發(fā)的操作。

Since:

3

嵌套類摘要

修飾符和類型 描述
static class NotificationActionButton.Builder NotificationActionButton 對象的生成器類。
從接口 ohos.utils.Sequenceable 繼承的嵌套類/接口
Sequenceable.ProducerT

字段摘要

修飾符和類型 字段 描述
static Sequenceable.ProducerNotificationActionButton PRODUCER 從 Parcel 創(chuàng)建 NotificationActionButton 實例。

方法總結(jié)

修飾符和類型 方法 描述
PacMap getAdditionalData() 獲取包含在此 NotificationActionButton 中的附加數(shù)據(jù)。
PixelMap getIcon() 獲取此 NotificationActionButton 的圖標(biāo)。
IntentAgent getIntentAgent() 獲取此 NotificationActionButton 的 IntentAgent。
ListNotificationUserInput getMimeTypeOnlyUserInputs() 在發(fā)送此 NotificationActionButton 時,獲取僅允許特定 MIME 類型的值的 NotificationUserInput 對象。
int getSemanticActionButton() 獲取此 NotificationActionButton 的語義操作。
String getTitle() 獲取此 NotificationActionButton 的標(biāo)題。
ListNotificationUserInput getUserInputs() 獲取發(fā)送此 NotificationActionButton 時向用戶收集的 NotificationUserInput 對象。
boolean isAutoCreatedReplies() 檢查平臺是否可以自動為此 NotificationActionButton 生成可能的回復(fù)。
boolean isContextDependent() 檢查此 NotificationActionButton 是否為上下文操作,即此 NotificationActionButton 是否依賴于通知消息體。
boolean marshalling(Parcel out) 將 NotificationActionButton 對象編組到 Parcel 中。
String toString() 返回對象的字符串表示形式。
boolean unmarshalling(Parcel in) 從 Parcel 中解組 NotificationActionButton 對象。
從類 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
從接口 ohos.utils.Sequenceable 繼承的方法
hasFileDescriptor

字段詳細(xì)信息

PRODUCER

public static final Sequenceable.ProducerNotificationActionButton PRODUCER

從 Parcel 創(chuàng)建 NotificationActionButton 實例。

Since:

4

方法詳情

getIcon

public PixelMap getIcon()

獲取此 NotificationActionButton 的圖標(biāo)。

返回:

返回此 NotificationActionButton 的圖標(biāo)。

Since:

3

getAdditionalData

public PacMap getAdditionalData()

獲取包含在此 NotificationActionButton 中的附加數(shù)據(jù)。

返回:

返回此 NotificationActionButton 中包含的附加數(shù)據(jù)。

Since:

3

getUserInputs

public ListNotificationUserInput getUserInputs()

獲取發(fā)送此 NotificationActionButton 時向用戶收集的 NotificationUserInput 對象。

返回:

返回 NotificationUserInput 對象的列表。

Since:

3

getMimeTypeOnlyUserInputs

public ListNotificationUserInput getMimeTypeOnlyUserInputs()

在發(fā)送此 NotificationActionButton 時,獲取僅允許特定 MIME 類型的值的 NotificationUserInput 對象。

返回:

返回僅允許特定 MIME 類型值的 NotificationUserInput 對象列表。

Since:

3

isAutoCreatedReplies

public boolean isAutoCreatedReplies()

檢查平臺是否可以自動為此 NotificationActionButton 生成可能的回復(fù)。

返回:

如果平臺可以生成回復(fù),則返回 true; 否則返回 false。

Since:

3

isContextDependent

public boolean isContextDependent()

檢查此 NotificationActionButton 是否為上下文操作,即此 NotificationActionButton 是否依賴于通知消息體。 例如,上下文 NotificationActionButton 在通知中為用戶打開地圖應(yīng)用程序提供地址。

返回:

如果此 NotificationActionButton 是上下文操作,則返回 true; 否則返回 false。

Since:

3

getTitle

public String getTitle()

獲取此 NotificationActionButton 的標(biāo)題。

返回:

返回此 NotificationActionButton 的標(biāo)題。

Since:

3

getIntentAgent

public IntentAgent getIntentAgent()

獲取此 NotificationActionButton 的 IntentAgent。

返回:

返回此 NotificationActionButton 的 IntentAgent。

Since:

3

getSemanticActionButton

public int getSemanticActionButton()

獲取此 NotificationActionButton 的語義操作。

返回:

返回此 NotificationActionButton 的語義操作,如 NotificationConstant.SemanticActionButton 中所枚舉。

Since:

3

marshalling

public boolean marshalling(Parcel out)

將 NotificationActionButton 對象編組到 Parcel 中。

進(jìn)程可以調(diào)用 unmarshalling(ohos.utils.Parcel) 方法從 Parcel 中解組 NotificationActionButton 對象,以實現(xiàn)進(jìn)程間通信 (IPC)。

指定者:

接口 Sequenceable 中的編組

參數(shù):

參數(shù)名稱 參數(shù)描述
out 指示用于編組的 MessageParcel 對象。 MessageParcel 是 Parcel 的子類。

返回:

如果編組成功,則返回 true; 否則返回 false。

Since:

4

unmarshalling

public boolean unmarshalling(Parcel in)

從 Parcel 中解組 NotificationActionButton 對象。

指定者:

在接口 Sequenceable 中解組

參數(shù):

參數(shù)名稱 參數(shù)描述
in 指示用于編組的 MessageParcel 對象。 MessageParcel 是 Parcel 的子類。

返回:

如果解組成功,則返回 true; 否則返回 false。

Since:

4

toString

public String toString()

從類復(fù)制的描述:對象

返回對象的字符串表示形式。 通常,toString 方法返回一個“以文本方式表示”該對象的字符串。 結(jié)果應(yīng)該是一個簡潔但信息豐富的表示,易于人們閱讀。 建議所有子類重寫此方法。

Object 類的 toString 方法返回一個字符串,該字符串由對象作為其實例的類的名稱、at 符號字符“@”和對象哈希碼的無符號十六進(jìn)制表示形式組成。 換句話說,此方法返回一個等于以下值的字符串:

 getClass().getName() + '@' + Integer.toHexString(hashCode()) 

覆蓋:

類 Object 中的 toString

返回:

對象的字符串表示形式。

Since:

4

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號