public static class NotificationOptions.Builder extends Object
NotificationOptions
.Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
NotificationOptions |
build()
Builds a
Notification by this builder. |
NotificationOptions.Builder |
setActions(List<String> actions,
int[] compatActionIndices)
Sets at most 4 actions to show in the
Notification , and at most 3 indices to the
actions to show in the compat view. |
NotificationOptions.Builder |
setChannel(NotificationChannel channel)
Sets the
NotificationChannel . |
NotificationOptions.Builder |
setClearDrawableResId(int resId)
Sets the resource ID of the icon that indicates
NotificationOptions.ACTION_CLEAR . |
NotificationOptions.Builder |
setColor(int color)
Sets the color of
Notification . |
NotificationOptions.Builder |
setLargeIcon(Bitmap bitmap)
Sets the bitmap of large icon.
|
NotificationOptions.Builder |
setPauseDrawableResId(int resId)
Sets the resource ID of the icon that indicates "pause".
|
NotificationOptions.Builder |
setPlayDrawableResId(int resId)
Sets the resource ID of the icon that indicates "play".
|
NotificationOptions.Builder |
setSkipNextDrawableResId(int resId)
Sets the resource ID of the icon that indicates
NotificationOptions.ACTION_NEXT . |
NotificationOptions.Builder |
setSkipPrevDrawableResId(int resId)
Sets the resource ID of the icon that indicates
NotificationOptions.ACTION_PREV . |
NotificationOptions.Builder |
setSmallIconResId(int resId)
Sets the resource ID of the small icon.
|
NotificationOptions.Builder |
setTargetClassName(String className)
Sets the name of the
Activity that will be launched when user clicks the content
area of the Notification . |
public NotificationOptions.Builder setActions(List<String> actions, int[] compatActionIndices)
Notification
, and at most 3 indices to the
actions to show in the compat view. Set null to use default UI that shows all the actions
in NotificationOptions.NOTIFICATION_ACTIONS
. The default value is null.actions
- The list of actions, defined in NotificationOptions.NOTIFICATION_ACTIONS
.compatActionIndices
- Indices of the actions in actions list, which will be shown in
the compat view.public NotificationOptions.Builder setPauseDrawableResId(@DrawableRes int resId)
resId
- drawable resource idpublic NotificationOptions.Builder setPlayDrawableResId(@DrawableRes int resId)
resId
- drawable resource idpublic NotificationOptions.Builder setSkipPrevDrawableResId(@DrawableRes int resId)
NotificationOptions.ACTION_PREV
. If set to 0 then
a default drawable will be used. The default value is 0.resId
- drawable resource idpublic NotificationOptions.Builder setSkipNextDrawableResId(@DrawableRes int resId)
NotificationOptions.ACTION_NEXT
. If set to 0 then
a default drawable will be used. The default value is 0.resId
- drawable resource idpublic NotificationOptions.Builder setClearDrawableResId(@DrawableRes int resId)
NotificationOptions.ACTION_CLEAR
. If set to 0 then
a default drawable will be used. The default value is 0.resId
- drawable resource idpublic NotificationOptions.Builder setSmallIconResId(@DrawableRes int resId)
NotificationCompat.Builder#setSmallIcon(int)
. If set to 0 then a default drawable
will be used. The default value is 0.resId
- drawable resource idpublic NotificationOptions.Builder setLargeIcon(Bitmap bitmap)
NotificationCompat.Builder#setLargeIcon(Bitmap)
. If set to null then the poster
image of video will be used. The default value is null.bitmap
- the bitmap of large iconpublic NotificationOptions.Builder setColor(int color)
Notification
. This value will be set to
NotificationCompat.Builder#setColor(int)
. The default value is 0.color
- color in ColorInt
public NotificationOptions.Builder setTargetClassName(String className)
Activity
that will be launched when user clicks the content
area of the Notification
. If set to null then clicking the Notification
will not launch any Activity
. The default value is null.className
- class name of Activity
public NotificationOptions.Builder setChannel(NotificationChannel channel)
NotificationChannel
.
This feature only works on
Android 8.0
and later version.channel
- NotificationChannel
public NotificationOptions build() throws IllegalArgumentException
Notification
by this builder.Notification
IllegalArgumentException