diff options
author | Griff Hazen <griff@google.com> | 2014-05-26 09:07:14 -0700 |
---|---|---|
committer | Griff Hazen <griff@google.com> | 2014-05-27 11:28:45 -0700 |
commit | 6f72ac5d5f4b7bae34bb3dab7821f3dbcbf02bcd (patch) | |
tree | 55a599c68d6b0894cd1e55f533f02815e33a9b09 /core | |
parent | d7439d8c59e4c5a82ad94a5080436cc94f72e0be (diff) | |
download | frameworks_base-6f72ac5d5f4b7bae34bb3dab7821f3dbcbf02bcd.zip frameworks_base-6f72ac5d5f4b7bae34bb3dab7821f3dbcbf02bcd.tar.gz frameworks_base-6f72ac5d5f4b7bae34bb3dab7821f3dbcbf02bcd.tar.bz2 |
Doc fixes for Notification.WearableExtender
Change-Id: I22947e30d329e667079555ac4ac5f9b25d6bd3fa
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/Notification.java | 63 |
1 files changed, 44 insertions, 19 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 60e7660..1d66464 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -918,10 +918,9 @@ public class Notification implements Parcelable * <pre class="prettyprint"> * Notification.Action action = new Notification.Action.Builder( * R.drawable.archive_all, "Archive all", actionIntent) - * .apply(new Notification.Action.WearableExtender() + * .extend(new Notification.Action.WearableExtender() * .setAvailableOffline(false)) - * .build(); - * </pre> + * .build();</pre> */ public static final class WearableExtender implements Extender { /** Notification action extra which contains wearable extensions */ @@ -2837,8 +2836,7 @@ public class Notification implements Parcelable * <pre class="prettyprint"> * Notification.WearableExtender wearableExtender = new Notification.WearableExtender( * notification); - * List<Notification> pages = wearableExtender.getPages(); - * </pre> + * List<Notification> pages = wearableExtender.getPages();</pre> */ public static final class WearableExtender implements Extender { /** @@ -3083,7 +3081,27 @@ public class Notification implements Parcelable /** * Set an intent to launch inside of an activity view when displaying - * this notification. This {@link PendingIntent} should be for an activity. + * this notification. The {@link PendingIntent} provided should be for an activity. + * + * <pre class="prettyprint"> + * Intent displayIntent = new Intent(context, MyDisplayActivity.class); + * PendingIntent displayPendingIntent = PendingIntent.getActivity(context, + * 0, displayIntent, PendingIntent.FLAG_UPDATE_CURRENT); + * Notification notif = new Notification.Builder(context) + * .extend(new Notification.WearableExtender() + * .setDisplayIntent(displayPendingIntent) + * .setCustomSizePreset(Notification.WearableExtender.SIZE_MEDIUM)) + * .build();</pre> + * + * <p>The activity to launch needs to allow embedding, must be exported, and + * should have an empty task affinity. + * + * <p>Example AndroidManifest.xml entry: + * <pre class="prettyprint"> + * <activity android:name="com.example.MyDisplayActivity" + * android:exported="true" + * android:allowEmbedded="true" + * android:taskAffinity="" /></pre> * * @param intent the {@link PendingIntent} for an activity * @return this object for method chaining @@ -3217,12 +3235,17 @@ public class Notification implements Parcelable /** * Set an action from this notification's actions to be clickable with the content of - * this notification page. This action will no longer display separately from the - * notification content. This action's icon will display with optional subtext provided - * by the action's title. - * @param actionIndex The index of the action to hoist on the current notification page. - * If wearable actions are present, this index will apply to that list, - * otherwise it will apply to the main notification's actions list. + * this notification. This action will no longer display separately from the + * notification's content. + * + * <p>For notifications with multiple pages, child pages can also have content action's + * set, although the list of available actions comes from the main notification and not + * from the child page's notification. + * + * @param actionIndex The index of the action to hoist onto the current notification page. + * If wearable actions were added to the main notification, this index + * will apply to that list, otherwise it will apply to the regular + * actions list. */ public WearableExtender setContentAction(int actionIndex) { mContentActionIndex = actionIndex; @@ -3230,14 +3253,16 @@ public class Notification implements Parcelable } /** - * Get the action index of an action from this notification to show as clickable with - * the content of this notification page. When the user clicks this notification page, - * this action will trigger. This action will no longer display separately from the - * notification content. The action's icon will display with optional subtext provided - * by the action's title. + * Get the action index from this notification's actions to be clickable with the + * content of this notification. This action will no longer display separately + * from the notification's content. + * + * <p>For notifications with multiple pages, child pages can also have content action's + * set, although the list of available actions comes from the main notification and not + * from the child page's notification. * - * <p>If wearable specific actions are present, this index will apply to that list, - * otherwise it will apply to the main notification's actions list. + * <p>If wearable specific actions were added to the main notification, this index will + * apply to that list, otherwise it will apply to the regular actions list. */ public int getContentAction() { return mContentActionIndex; |