Sequenceablepublic static final class NotificationRequest.NotificationMediaContent extends Object implements Sequenceable
Before constructing this notification, you should first initialize a NotificationMediaContent
object, and call setAVToken(ohos.media.common.sessioncore.AVToken) to attach an AVToken to it for setting up an
interaction channel with the associated AVSession. You can call
setShownActions(int[]) to request the NotificationActionButton objects to be displayed
in this notification. Then, you should initialize a NotificationRequest object and
call NotificationRequest#setContent(NotificationContent) to set it to a media playback notification
and attach the previously constructed NotificationMediaContent object to it. Additionally, you should
call NotificationRequest#addActionButton(NotificationActionButton) so that media control buttons
will be displayed in this notification after it is published.
SystemCapability.Notification#ANSSequenceable.Producer<T>| 构造器 | 说明 |
|---|---|
NotificationMediaContent() |
Default constructor used to create a
NotificationMediaContent instance. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
String |
getAdditionalText() |
Obtains the additional text that has been set by calling
setAdditionalText(java.lang.String) for this
media playback notification. |
AVToken |
getAVToken() |
Obtains the
AVToken attached to this media playback notification. |
int[] |
getShownActions() |
Obtains the list of sequence numbers representing the
NotificationActionButton objects to be shown
in this media playback notification. |
String |
getText() |
Obtains the notification content that has been set by calling
setText(java.lang.String) for this
media playback notification. |
String |
getTitle() |
Obtains the title that has been set by calling
setTitle(java.lang.String) for this media playback
notification. |
boolean |
marshalling(Parcel out) |
Marshals this
NotificationMediaContent object into a Parcel. |
NotificationRequest.NotificationMediaContent |
setAdditionalText(String additionalText) |
Sets the additional text to be included in this media playback notification.
|
NotificationRequest.NotificationMediaContent |
setAVToken(AVToken avToken) |
Attaches a specified
AVToken to this media playback notification. |
NotificationRequest.NotificationMediaContent |
setShownActions(int[] actions) |
Sets up to three
NotificationActionButton objects to be shown in this media playback notification. |
NotificationRequest.NotificationMediaContent |
setText(String text) |
Sets the text to be included in this media playback notification.
|
NotificationRequest.NotificationMediaContent |
setTitle(String title) |
Sets the title of this media playback notification.
|
String |
toString() |
Returns a string representation of the object.
|
boolean |
unmarshalling(Parcel in) |
Unmarshals this
NotificationMediaContent object from a Parcel. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waithasFileDescriptorpublic NotificationMediaContent()
NotificationMediaContent instance.public String getTitle()
setTitle(java.lang.String) for this media playback
notification.public NotificationRequest.NotificationMediaContent setTitle(String title)
title - Indicates the title of this media playback notification.NotificationMediaContent object.public String getText()
setText(java.lang.String) for this
media playback notification.public NotificationRequest.NotificationMediaContent setText(String text)
text - Indicates the text to be included.NotificationMediaContent object.public String getAdditionalText()
setAdditionalText(java.lang.String) for this
media playback notification.public NotificationRequest.NotificationMediaContent setAdditionalText(String additionalText)
The additional text is a supplement to the notification text set by calling setText(java.lang.String).
The font of the additional text is smaller than the notification text and is displayed in a separate line.
additionalText - Indicates the additional text to be included.NotificationMediaContent object.public AVToken getAVToken()
AVToken attached to this media playback notification.AVToken attached to this notification.public NotificationRequest.NotificationMediaContent setAVToken(AVToken avToken)
AVToken to this media playback notification. After an AVToken is
attached, this notification can interact with the associated AVSession
so that users can control media playback in this notification.avToken - Indicates the AVToken to attach.NotificationMediaContent object.public int[] getShownActions()
NotificationActionButton objects to be shown
in this media playback notification.public NotificationRequest.NotificationMediaContent setShownActions(int[] actions)
NotificationActionButton objects to be shown in this media playback notification.
Before publishing this notification, you should also call
NotificationRequest#addActionButton(NotificationActionButton) to add specified
NotificationActionButton objects for this notification so that this method can take effect.
The added action buttons will be assigned sequence numbers in the order they were added.
The sequence numbers specified in the value of actions for this method must match
those assigned to added action buttons. Otherwise, the notification will fail to publish. By default,
the sequence number starts from 0. If you want to show three action buttons, the value of
actions should be 0, 1, 2.
actions - Indicates the list of sequence numbers representing the
NotificationActionButton objects to be shown in this notification.NotificationMediaContent object.public boolean marshalling(Parcel out)
NotificationMediaContent object into a Parcel.
A process can call the unmarshalling(ohos.utils.Parcel) method to unmarshal this
NotificationMediaContent object from a Parcel to implement
inter-process communication (IPC).
marshalling 在接口中 Sequenceableout - Indicates the Parcel object for marshalling.true if the marshalling is successful; returns false otherwise.public boolean unmarshalling(Parcel in)
NotificationMediaContent object from a Parcel.unmarshalling 在接口中 Sequenceablein - Indicates the Parcel object for unmarshalling.true if the unmarshalling is successful; returns false otherwise.public String toString()
ObjecttoString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())