diff --git a/docs/html/preview/api-overview.jd b/docs/html/preview/api-overview.jd index 294c4be33b819..110418a262cd5 100644 --- a/docs/html/preview/api-overview.jd +++ b/docs/html/preview/api-overview.jd @@ -113,6 +113,13 @@ use. Some of the changes include:

take advantage of the new templates with minimal adjustments in their code. +
  • + Message style customization: You can customize more of the + user interface labels associated with your notifications using the + MessageStyle class. You can configure the message, conversation + title, and content view. +
  • +
  • Bundled notifications: The system can group messages together, for example by message topic, and display the group. A user can @@ -614,7 +621,7 @@ features such as face-tracking, eye-tracking, point scanning, and so on, to meet the needs of those users.

    For more information, see android.accessibilityservice.GestureDescription - in the downloadable API Reference.

    + in the downloadable API Reference.

    Direct boot

    diff --git a/docs/html/preview/features/notification-updates.jd b/docs/html/preview/features/notification-updates.jd index 7ee09547d06fb..b8dfbaababcaf 100644 --- a/docs/html/preview/features/notification-updates.jd +++ b/docs/html/preview/features/notification-updates.jd @@ -16,6 +16,7 @@ trainingnavtop=true
  • Direct Reply
  • Bundled Notifications
  • Custom Views
  • +
  • Message Style
  • @@ -233,6 +234,12 @@ Builder.setGroup()} method to bundle similar notifications.

    group.

    +

    + Note: If the same app sends four or more notifications + and does not specify a grouping, the + system automatically groups them together. +

    +

    To learn how to add notifications to a group, see Add Each Notification to a Group.

    @@ -348,7 +355,7 @@ the desired custom view style.

    {@code DecoratedCustomViewStyle()} method.

    -Notification noti = new Notification.Builder()
    +Notification notification = new Notification.Builder()
                .setSmallIcon(R.drawable.ic_stat_player)
                .setLargeIcon(albumArtBitmap))
                .setCustomContentView(contentView);
    @@ -356,3 +363,27 @@ Notification noti = new Notification.Builder()
                .build();
     
     
    + +

    Message Style

    +

    + Android N introduces a new API for customizing the style of a notification. + Using the MessageStyle class, you can change several of the + labels displayed on the notification, including the conversation title, + additional messages, and the content view for the notification. +

    + +

    + The following code snippet demonstrates how to customize a notification's + style using the MessageStyle class. +

    + +
    +  Notification notification = new Notification.Builder()
    +             .setStyle(new Notification.MessagingStyle("Me")
    +             .setConversationTitle("Team lunch")
    +             .addMessage("Hi", timestamp1, null) // Pass in null for user.
    +             .addMessage("What's up?", timestamp2, "Coworker")
    +             .addMessage("Not much", timestamp3, null)
    +             .addMessage("How about lunch?", timestamp4, "Coworker")
    +             .setAllow());
    +
    \ No newline at end of file