/** * @deprecated Use {@link #build()} instead. */ @Deprecated public Notification getNotification() { return IMPL.build(this); }
public WearableExtender(Notification notif) { Bundle extras = getExtras(notif); Bundle wearableBundle = extras != null ? extras.getBundle(EXTRA_WEARABLE_EXTENSIONS) : null; if (wearableBundle != null) { Action[] actions = IMPL.getActionsFromParcelableArrayList( wearableBundle.getParcelableArrayList(KEY_ACTIONS)); if (actions != null) { Collections.addAll(mActions, actions); } mFlags = wearableBundle.getInt(KEY_FLAGS, DEFAULT_FLAGS); mDisplayIntent = wearableBundle.getParcelable(KEY_DISPLAY_INTENT); Notification[] pages = getNotificationArrayFromBundle( wearableBundle, KEY_PAGES); if (pages != null) { Collections.addAll(mPages, pages); } mBackground = wearableBundle.getParcelable(KEY_BACKGROUND); mContentIcon = wearableBundle.getInt(KEY_CONTENT_ICON); mContentIconGravity = wearableBundle.getInt(KEY_CONTENT_ICON_GRAVITY, DEFAULT_CONTENT_ICON_GRAVITY); mContentActionIndex = wearableBundle.getInt(KEY_CONTENT_ACTION_INDEX, UNSET_ACTION_INDEX); mCustomSizePreset = wearableBundle.getInt(KEY_CUSTOM_SIZE_PRESET, SIZE_DEFAULT); mCustomContentHeight = wearableBundle.getInt(KEY_CUSTOM_CONTENT_HEIGHT); mGravity = wearableBundle.getInt(KEY_GRAVITY, DEFAULT_GRAVITY); } }
/** * Apply car extensions to a notification that is being built. This is typically called by * the {@link android.support.v4.app.NotificationCompat.Builder#extend(NotificationCompat.Extender)} * method of {@link NotificationCompat.Builder}. */ @Override public NotificationCompat.Builder extend(NotificationCompat.Builder builder) { if (Build.VERSION.SDK_INT < 21) { return builder; } Bundle carExtensions = new Bundle(); if (mLargeIcon != null) { carExtensions.putParcelable(EXTRA_LARGE_ICON, mLargeIcon); } if (mColor != NotificationCompat.COLOR_DEFAULT) { carExtensions.putInt(EXTRA_COLOR, mColor); } if (mUnreadConversation != null) { Bundle b = IMPL.getBundleForUnreadConversation(mUnreadConversation); carExtensions.putBundle(EXTRA_CONVERSATION, b); } builder.getExtras().putBundle(EXTRA_CAR_EXTENDER, carExtensions); return builder; }
/** * Get the category of this notification in a backwards compatible * manner. * @param notif The notification to inspect. */ public static String getCategory(Notification notif) { return IMPL.getCategory(notif); }
/** * Get the number of actions in this notification in a backwards compatible * manner. Actions were supported from JellyBean (Api level 16) forwards. */ public static int getActionCount(Notification notif) { return IMPL.getActionCount(notif); }
/** * Get the key used to group this notification into a cluster or stack * with other notifications on devices which support such rendering. */ public static String getGroup(Notification notif) { return IMPL.getGroup(notif); }
/** * Combine all of the options that have been set and return a new {@link Notification} * object. */ public Notification build() { return IMPL.build(this); }
/** * Get whether or not this notification is only relevant to the current device. * * <p>Some notifications can be bridged to other devices for remote display. * If this hint is set, it is recommend that this notification not be bridged. */ public static boolean getLocalOnly(Notification notif) { return IMPL.getLocalOnly(notif); }
/** * Get an action on this notification in a backwards compatible * manner. Actions were supported from JellyBean (Api level 16) forwards. * @param notif The notification to inspect. * @param actionIndex The index of the action to retrieve. */ public static Action getAction(Notification notif, int actionIndex) { return IMPL.getAction(notif, actionIndex); }
/** * Gets the {@link Notification#extras} field from a notification in a backwards * compatible manner. Extras field was supported from JellyBean (Api level 16) * forwards. This function will return null on older api levels. */ public static Bundle getExtras(Notification notif) { return IMPL.getExtras(notif); }
/** * Combine all of the options that have been set and return a new {@link Notification} * object. */ public Notification getNotification() { return (Notification) IMPL.getNotification(this); } }