public static class Notification.MessagingStyle extends Notification.Style
Notification noti = new Notification.Builder() .setContentTitle("2 new messages wtih " + sender.toString()) .setContentText(subject) .setSmallIcon(R.drawable.new_message) .setLargeIcon(aBitmap) .setStyle(new Notification.MessagingStyle(resources.getString(R.string.reply_name)) .addMessage(messages[0].getText(), messages[0].getTime(), messages[0].getSender()) .addMessage(messages[1].getText(), messages[1].getTime(), messages[1].getSender())) .build();
Modifier and Type | Class and Description |
---|---|
static class |
Notification.MessagingStyle.Message |
Modifier and Type | Field and Description |
---|---|
static int |
MAXIMUM_RETAINED_MESSAGES
The maximum number of messages that will be retained in the Notification itself (the
number displayed is up to the platform).
|
mBuilder, mSummaryText, mSummaryTextSet
Constructor and Description |
---|
MessagingStyle(CharSequence userDisplayName) |
Modifier and Type | Method and Description |
---|---|
void |
addExtras(Bundle extras)
Apply any style-specific extras to this notification before shipping it out.
|
Notification.MessagingStyle |
addMessage(CharSequence text,
long timestamp,
CharSequence sender)
Adds a message for display by this notification.
|
Notification.MessagingStyle |
addMessage(Notification.MessagingStyle.Message message)
Adds a
Notification.MessagingStyle.Message for display in this notification. |
CharSequence |
getConversationTitle()
Return the title to be displayed on this conversation.
|
List<Notification.MessagingStyle.Message> |
getMessages()
Gets the list of
Message objects that represent the notification |
CharSequence |
getUserDisplayName()
Returns the name to be displayed for any replies sent by the user
|
RemoteViews |
makeBigContentView()
Construct a Style-specific RemoteViews for the final big notification layout.
|
RemoteViews |
makeContentView()
Construct a Style-specific RemoteViews for the final 1U notification layout.
|
RemoteViews |
makeHeadsUpContentView()
Construct a Style-specific RemoteViews for the final HUN layout.
|
protected void |
restoreFromExtras(Bundle extras)
Reconstruct the internal state of this Style object from extras.
|
Notification.MessagingStyle |
setConversationTitle(CharSequence conversationTitle)
Sets the title to be displayed on this conversation.
|
build, buildStyled, checkBuilder, displayCustomViewInline, getStandardView, hasProgress, hasSummaryInHeader, internalSetBigContentTitle, internalSetSummaryText, purgeResources, setBuilder
public static final int MAXIMUM_RETAINED_MESSAGES
public MessagingStyle(CharSequence userDisplayName)
userDisplayName
- Required - the name to be displayed for any replies sent by the
user before the posting app reposts the notification with those messages after they've
been actually sent and in previous messages sent by the user added in
addMessage(Notification.MessagingStyle.Message)
public CharSequence getUserDisplayName()
public Notification.MessagingStyle setConversationTitle(CharSequence conversationTitle)
conversationTitle
- public CharSequence getConversationTitle()
null
and
should be for one-on-one conversationspublic Notification.MessagingStyle addMessage(CharSequence text, long timestamp, CharSequence sender)
Notification.MessagingStyle.Message
in addMessage(Notification.MessagingStyle.Message)
.text
- A CharSequence
to be displayed as the message contenttimestamp
- Time at which the message arrivedsender
- A CharSequence
to be used for displaying the name of the
sender. Should be null
for messages by the current user, in which case
the platform will insert getUserDisplayName()
.
Should be unique amongst all individuals in the conversation, and should be
consistent during re-posts of the notification.Message#Message(CharSequence, long, CharSequence)
public Notification.MessagingStyle addMessage(Notification.MessagingStyle.Message message)
Notification.MessagingStyle.Message
for display in this notification.message
- The Notification.MessagingStyle.Message
to be displayedpublic List<Notification.MessagingStyle.Message> getMessages()
Message
objects that represent the notificationpublic void addExtras(Bundle extras)
Notification.Style
addExtras
in class Notification.Style
protected void restoreFromExtras(Bundle extras)
Notification.Style
restoreFromExtras
in class Notification.Style
public RemoteViews makeContentView()
Notification.Style
makeContentView
in class Notification.Style
public RemoteViews makeBigContentView()
Notification.Style
makeBigContentView
in class Notification.Style
public RemoteViews makeHeadsUpContentView()
Notification.Style
makeHeadsUpContentView
in class Notification.Style