From 5f1192c9a36a513a11aa7d777c0080a24d5911ee Mon Sep 17 00:00:00 2001 From: Robert Ly Date: Thu, 1 May 2014 17:40:16 +0000 Subject: Revert "update wear stack notifications to coincide with devbyte code" This reverts commit b8e3f209af70a7707be75d866b142dc1fccc8d5f. Change-Id: Iba48e235b23cb0b6ce191809e6eb87395c6d1766 --- docs/html/wear/images/11_bundles_A.png | Bin 33194 -> 114317 bytes docs/html/wear/images/11_bundles_B.png | Bin 18253 -> 93804 bytes docs/html/wear/images/11_bundles_C.png | Bin 14837 -> 0 bytes docs/html/wear/notifications/stacks.jd | 137 ++++++--------------------------- 4 files changed, 25 insertions(+), 112 deletions(-) delete mode 100644 docs/html/wear/images/11_bundles_C.png (limited to 'docs/html') diff --git a/docs/html/wear/images/11_bundles_A.png b/docs/html/wear/images/11_bundles_A.png index 0ffc6ec..7199a1f 100644 Binary files a/docs/html/wear/images/11_bundles_A.png and b/docs/html/wear/images/11_bundles_A.png differ diff --git a/docs/html/wear/images/11_bundles_B.png b/docs/html/wear/images/11_bundles_B.png index c188d3d..bb751a2 100644 Binary files a/docs/html/wear/images/11_bundles_B.png and b/docs/html/wear/images/11_bundles_B.png differ diff --git a/docs/html/wear/images/11_bundles_C.png b/docs/html/wear/images/11_bundles_C.png deleted file mode 100644 index de71c59..0000000 Binary files a/docs/html/wear/images/11_bundles_C.png and /dev/null differ diff --git a/docs/html/wear/notifications/stacks.jd b/docs/html/wear/notifications/stacks.jd index e723dab..7f955f6 100644 --- a/docs/html/wear/notifications/stacks.jd +++ b/docs/html/wear/notifications/stacks.jd @@ -2,8 +2,7 @@ page.title=Stacking Notifications @jd:body - - +

When creating notifications for a handheld device, you should always aggregate similar @@ -11,7 +10,7 @@ notifications into a single summary notification. For example, if your app creat for received messages, you should not show more than one notification on a handheld device—when more than one is message is received, use a single notification to provide a summary such as "2 new messages."

-
+

However, a summary notification is less useful on an Android wearable because users are not able to read details from each message on the wearable (they must open your app on the handheld to view more information). So for the wearable device, you should @@ -26,50 +25,25 @@ only one summary notification on the handheld device.

Wear.

-

Create notifications in stacks

- -
- -
- - -
-
- +

Add Each Notification to a Group

To create a stack, call setGroup() for each notification you want in the stack, passing the same -group key.

+group key. For example:

+ +
+final static String GROUP_KEY_EMAILS = "group_key_emails";
 
+NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext)
+         .setContentTitle("New mail from " + sender)
+         .setContentText(subject)
+         .setSmallIcon(R.drawable.new_mail);
+
+Notification notif = new WearableNotifications.Builder(builder)
+         .setGroup(GROUP_KEY_EMAILS)
+         .build();
+

By default, notifications appear in the order in which you added them, with the most recent notification visible at the top. You can define a specific position in the group @@ -78,82 +52,21 @@ href="{@docRoot}reference/android/preview/support/wearable/notifications/Wearabl setGroup().

-

It's also important that you still provide a summary notification that appears on handheld devices. +

Add a Summary Notification

+ +

It's important that you still provide a summary notification that appears on handheld devices. So in addition to adding each unique notification to the same stack group, also add a summary notification, but set its order position to be GROUP_ORDER_SUMMARY.

-

This notification will not appear in your stack of notifications on the wearable, but -appears as the only notification on the handheld device. -

- - -

Here's an example that creates a stack notification for a wearable and -a summary notification for a handset device:

- -
-public void onClick_button_groups () {
-    Bitmap bitmapMila = BitmapFactory.decodeResource(getResources(),
-    		R.drawable.mila128);
-
-    // Nuke all previous notifications and generate unique ids
-    NotificationManagerCompat.from(this).cancelAll();
-    int notificationId = 0;
-
-    // String to represent the group all the notifications will be a part of
-    final String GROUP_KEY_EMAILS = "group_key_messages";
-
-    // Group notification that will be visible on the phone
-    NotificationCompat.Builder builderG = new NotificationCompat.Builder(this)
-            .setContentTitle("2 Pet Notifications")
-            .setContentText("Mila and Dylan both sent messages")
-            .setSmallIcon(R.drawable.ic_launcher)
-            .setLargeIcon(bitmapMila);
-    Notification summaryNotification = new WearableNotifications
-    		.Builder(builderG)
-            .setGroup(GROUP_KEY_EMAILS, 
-            		WearableNotifications.GROUP_ORDER_SUMMARY)
-            .build();
-
-    // Separate notifications that will be visible on the watch
-    Intent viewIntent1 = new Intent(this, MainActivity.class);
-    PendingIntent viewPendingIntent1 =
-          PendingIntent.getActivity(this, notificationId+1, viewIntent1, 0);
-    NotificationCompat.Builder builder1 = new NotificationCompat.Builder(this)
-            .addAction(R.drawable.ic_action_done, "Treat Fed",
-            		viewPendingIntent1)
-            .setContentTitle("Message from Mila")
-            .setContentText("What's for dinner? "
-                            + "Can we have steak?")
-            .setSmallIcon(R.drawable.ic_launcher);
-    Notification notification1 = new WearableNotifications.Builder(builder1)
-            .setGroup(GROUP_KEY_EMAILS)
-            .build();
-
-    Intent viewIntent2 = new Intent(this, MainActivity.class);
-    PendingIntent viewPendingIntent2 =
-          PendingIntent.getActivity(this, notificationId+2, viewIntent2, 0);
-    NotificationCompat.Builder builder2 = new NotificationCompat.Builder(this)
-            .addAction(R.drawable.ic_action_done, "Water Filled",
-            		viewPendingIntent2)
-            .setContentTitle("Message from Dylan")
-            .setContentText("Can you refill our water bowl?")
-            .setSmallIcon(R.drawable.ic_launcher);
-    Notification notification2 = new WearableNotifications.Builder(builder2)
-            .setGroup(GROUP_KEY_EMAILS)
-            .build();
-
-    // Issue the group notification
-    NotificationManagerCompat notificationManager =
-    		NotificationManagerCompat.from(this);
-    notificationManager.notify(notificationId+0, summaryNotification);
-
-    // Issue the separate wear notifications
-    notificationManager.notify(notificationId+2, notification2);
-    notificationManager.notify(notificationId+1, notification1);
-}
+
+Notification summaryNotification = new WearableNotifications.Builder(builder)
+         .setGroup(GROUP_KEY_EMAILS, WearableNotifications.GROUP_ORDER_SUMMARY)
+         .build();
 
+

This notification will not appear in your stack of notifications on the wearable, but +appears as the only notification on the handheld device. -- cgit v1.1