method public android.graphics.drawable.Icon getLargeIcon();
method public android.graphics.drawable.Icon getSmallIcon();
method public java.lang.String getSortKey();
- method public android.app.Notification.Topic[] getTopics();
+ method public android.app.Notification.Topic getTopic();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.media.AudioAttributes AUDIO_ATTRIBUTES_DEFAULT;
field public static final java.lang.String CATEGORY_ALARM = "alarm";
method public android.app.Notification.Builder addAction(android.app.Notification.Action);
method public android.app.Notification.Builder addExtras(android.os.Bundle);
method public android.app.Notification.Builder addPerson(java.lang.String);
- method public android.app.Notification.Builder addTopic(android.app.Notification.Topic);
method public android.app.Notification build();
method public android.app.Notification.Builder extend(android.app.Notification.Extender);
method public android.os.Bundle getExtras();
method public android.app.Notification.Builder setSubText(java.lang.CharSequence);
method public android.app.Notification.Builder setTicker(java.lang.CharSequence);
method public deprecated android.app.Notification.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews);
+ method public android.app.Notification.Builder setTopic(android.app.Notification.Topic);
method public android.app.Notification.Builder setUsesChronometer(boolean);
method public android.app.Notification.Builder setVibrate(long[]);
method public android.app.Notification.Builder setVisibility(int);
method public android.graphics.drawable.Icon getLargeIcon();
method public android.graphics.drawable.Icon getSmallIcon();
method public java.lang.String getSortKey();
- method public android.app.Notification.Topic[] getTopics();
+ method public android.app.Notification.Topic getTopic();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.media.AudioAttributes AUDIO_ATTRIBUTES_DEFAULT;
field public static final java.lang.String CATEGORY_ALARM = "alarm";
method public android.app.Notification.Builder addAction(android.app.Notification.Action);
method public android.app.Notification.Builder addExtras(android.os.Bundle);
method public android.app.Notification.Builder addPerson(java.lang.String);
- method public android.app.Notification.Builder addTopic(android.app.Notification.Topic);
method public android.app.Notification build();
method public android.app.Notification.Builder extend(android.app.Notification.Extender);
method public android.os.Bundle getExtras();
method public android.app.Notification.Builder setSubText(java.lang.CharSequence);
method public android.app.Notification.Builder setTicker(java.lang.CharSequence);
method public deprecated android.app.Notification.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews);
+ method public android.app.Notification.Builder setTopic(android.app.Notification.Topic);
method public android.app.Notification.Builder setUsesChronometer(boolean);
method public android.app.Notification.Builder setVibrate(long[]);
method public android.app.Notification.Builder setVisibility(int);
};
}
- private Topic[] topics;
+ private Topic topic;
- public Topic[] getTopics() {
- return topics;
+ public Topic getTopic() {
+ return topic;
}
/**
color = parcel.readInt();
- topics = parcel.createTypedArray(Topic.CREATOR); // may be null
+ if (parcel.readInt() != 0) {
+ topic = Topic.CREATOR.createFromParcel(parcel);
+ }
}
@Override
that.color = this.color;
- if (this.topics != null) {
- that.topics = new Topic[this.topics.length];
- for(int i=0; i<this.topics.length; i++) {
- that.topics[i] = this.topics[i].clone();
- }
+ if (this.topic != null) {
+ that.topic = this.topic.clone();
}
if (!heavy) {
parcel.writeInt(color);
- parcel.writeTypedArray(topics, 0); // null ok
+ if (topic != null) {
+ parcel.writeInt(1);
+ topic.writeToParcel(parcel, 0);
+ } else {
+ parcel.writeInt(0);
+ }
}
/**
sb.append(" publicVersion=");
sb.append(publicVersion.toString());
}
- if (topics != null) {
- sb.append("topics=[");
- int N = topics.length;
- if (N > 0) {
- for (int i = 0; i < N-1; i++) {
- sb.append(topics[i]);
- sb.append(',');
- }
- sb.append(topics[N-1]);
- }
- sb.append("]");
+ if (topic != null) {
+ sb.append("topic=");
+ sb.append(topic.toString());
}
sb.append(")");
return sb.toString();
private ArrayList<String> mPersonList = new ArrayList<String>();
private NotificationColorUtil mColorUtil;
private boolean mColorUtilInited = false;
- private List<Topic> mTopics = new ArrayList<>();
/**
* The user that built the notification originally.
Collections.addAll(mPersonList, mN.extras.getStringArray(EXTRA_PEOPLE));
}
- if (mN.getTopics() != null) {
- Collections.addAll(mTopics, mN.getTopics());
- }
-
String templateClass = mN.extras.getString(EXTRA_TEMPLATE);
if (!TextUtils.isEmpty(templateClass)) {
final Class<? extends Style> styleClass
}
/**
- * Add a topic to this notification. Topics are typically displayed in Notification
+ * Sets the topic of this notification. Topics are typically displayed in Notification
* settings.
* <p>
* Every topic must have an id and a textual label.
*
* @param topic The topic to add.
*/
- public Builder addTopic(Topic topic) {
- mTopics.add(topic);
+ public Builder setTopic(Topic topic) {
+ mN.topic = topic;
return this;
}
mN.extras.putStringArray(EXTRA_PEOPLE,
mPersonList.toArray(new String[mPersonList.size()]));
}
- if (mTopics.size() > 0) {
- mN.topics = new Topic[mTopics.size()];
- mTopics.toArray(mN.topics);
- }
return mN;
}