Package com.google.android.exoplayer2.ui
Class PlayerNotificationManager.Builder
- java.lang.Object
-
- com.google.android.exoplayer2.ui.PlayerNotificationManager.Builder
-
- Enclosing class:
- PlayerNotificationManager
public static class PlayerNotificationManager.Builder extends Object
A builder forPlayerNotificationManagerinstances.
-
-
Field Summary
Fields Modifier and Type Field Description protected intchannelDescriptionResourceIdprotected StringchannelIdprotected intchannelImportanceprotected intchannelNameResourceIdprotected Contextcontextprotected PlayerNotificationManager.CustomActionReceivercustomActionReceiverprotected intfastForwardActionIconResourceIdprotected StringgroupKeyprotected PlayerNotificationManager.MediaDescriptionAdaptermediaDescriptionAdapterprotected intnextActionIconResourceIdprotected intnotificationIdprotected PlayerNotificationManager.NotificationListenernotificationListenerprotected intpauseActionIconResourceIdprotected intplayActionIconResourceIdprotected intpreviousActionIconResourceIdprotected intrewindActionIconResourceIdprotected intsmallIconResourceIdprotected intstopActionIconResourceId
-
Constructor Summary
Constructors Constructor Description Builder(Context context, int notificationId, String channelId)Creates an instance.Builder(Context context, int notificationId, String channelId, PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter)Deprecated.UseBuilder(Context, int, String)instead, then callsetMediaDescriptionAdapter(MediaDescriptionAdapter).
-
Method Summary
-
-
-
Field Detail
-
context
protected final Context context
-
notificationId
protected final int notificationId
-
channelId
protected final String channelId
-
notificationListener
@Nullable protected PlayerNotificationManager.NotificationListener notificationListener
-
customActionReceiver
@Nullable protected PlayerNotificationManager.CustomActionReceiver customActionReceiver
-
mediaDescriptionAdapter
protected PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter
-
channelNameResourceId
protected int channelNameResourceId
-
channelDescriptionResourceId
protected int channelDescriptionResourceId
-
channelImportance
protected int channelImportance
-
smallIconResourceId
protected int smallIconResourceId
-
rewindActionIconResourceId
protected int rewindActionIconResourceId
-
playActionIconResourceId
protected int playActionIconResourceId
-
pauseActionIconResourceId
protected int pauseActionIconResourceId
-
stopActionIconResourceId
protected int stopActionIconResourceId
-
fastForwardActionIconResourceId
protected int fastForwardActionIconResourceId
-
previousActionIconResourceId
protected int previousActionIconResourceId
-
nextActionIconResourceId
protected int nextActionIconResourceId
-
groupKey
@Nullable protected String groupKey
-
-
Constructor Detail
-
Builder
@Deprecated public Builder(Context context, int notificationId, String channelId, PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter)
Deprecated.UseBuilder(Context, int, String)instead, then callsetMediaDescriptionAdapter(MediaDescriptionAdapter).
-
-
Method Detail
-
setChannelNameResourceId
public PlayerNotificationManager.Builder setChannelNameResourceId(int channelNameResourceId)
The name of the channel. If set to a value other than0, the channel is automatically created whenbuild()is called. If the application has already created the notification channel, then this method should not be called.The default is
0.- Returns:
- This builder.
-
setChannelDescriptionResourceId
public PlayerNotificationManager.Builder setChannelDescriptionResourceId(int channelDescriptionResourceId)
The description of the channel. Ignored ifsetChannelNameResourceId(int)is not called with a value other than0. If the application has already created the notification channel, then this method should not be called.The default is
0.- Returns:
- This builder.
-
setChannelImportance
public PlayerNotificationManager.Builder setChannelImportance(@Importance int channelImportance)
The importance of the channel. Ignored ifsetChannelNameResourceId(int)is not called with a value other than0. If the application has already created the notification channel, then this method should not be called.The default is
NotificationUtil.IMPORTANCE_LOW.- Returns:
- This builder.
-
setNotificationListener
public PlayerNotificationManager.Builder setNotificationListener(PlayerNotificationManager.NotificationListener notificationListener)
ThePlayerNotificationManager.NotificationListenerto be used.The default is
null.- Returns:
- This builder.
-
setCustomActionReceiver
public PlayerNotificationManager.Builder setCustomActionReceiver(PlayerNotificationManager.CustomActionReceiver customActionReceiver)
ThePlayerNotificationManager.CustomActionReceiverto be used.The default is
null.- Returns:
- This builder.
-
setSmallIconResourceId
public PlayerNotificationManager.Builder setSmallIconResourceId(int smallIconResourceId)
The resource id of the small icon of the notification shown in the status bar. SeeNotificationCompat.Builder.setSmallIcon(int).The default is
R.drawable#exo_notification_small_icon.- Returns:
- This builder.
-
setPlayActionIconResourceId
public PlayerNotificationManager.Builder setPlayActionIconResourceId(int playActionIconResourceId)
The resource id of the drawable to be used as the icon of actionPlayerNotificationManager.ACTION_PLAY.The default is
R.drawable#exo_notification_play.- Returns:
- This builder.
-
setPauseActionIconResourceId
public PlayerNotificationManager.Builder setPauseActionIconResourceId(int pauseActionIconResourceId)
The resource id of the drawable to be used as the icon of actionPlayerNotificationManager.ACTION_PAUSE.The default is
R.drawable#exo_notification_pause.- Returns:
- This builder.
-
setStopActionIconResourceId
public PlayerNotificationManager.Builder setStopActionIconResourceId(int stopActionIconResourceId)
The resource id of the drawable to be used as the icon of actionPlayerNotificationManager.ACTION_STOP.The default is
R.drawable#exo_notification_stop.- Returns:
- This builder.
-
setRewindActionIconResourceId
public PlayerNotificationManager.Builder setRewindActionIconResourceId(int rewindActionIconResourceId)
The resource id of the drawable to be used as the icon of actionPlayerNotificationManager.ACTION_REWIND.The default is
R.drawable#exo_notification_rewind.- Returns:
- This builder.
-
setFastForwardActionIconResourceId
public PlayerNotificationManager.Builder setFastForwardActionIconResourceId(int fastForwardActionIconResourceId)
The resource id of the drawable to be used as the icon of actionPlayerNotificationManager.ACTION_FAST_FORWARD.The default is
R.drawable#exo_notification_fastforward.- Returns:
- This builder.
-
setPreviousActionIconResourceId
public PlayerNotificationManager.Builder setPreviousActionIconResourceId(int previousActionIconResourceId)
The resource id of the drawable to be used as the icon of actionPlayerNotificationManager.ACTION_PREVIOUS.The default is
R.drawable#exo_notification_previous.- Returns:
- This builder.
-
setNextActionIconResourceId
public PlayerNotificationManager.Builder setNextActionIconResourceId(int nextActionIconResourceId)
The resource id of the drawable to be used as the icon of actionPlayerNotificationManager.ACTION_NEXT.The default is
R.drawable#exo_notification_next.- Returns:
- This builder.
-
setGroup
public PlayerNotificationManager.Builder setGroup(String groupKey)
The key of the group the media notification should belong to.The default is
null- Returns:
- This builder.
-
setMediaDescriptionAdapter
public PlayerNotificationManager.Builder setMediaDescriptionAdapter(PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter)
ThePlayerNotificationManager.MediaDescriptionAdapterto be queried for the notification contents.The default is
DefaultMediaDescriptionAdapterwith noPendingIntent- Returns:
- This builder.
-
build
public PlayerNotificationManager build()
Builds thePlayerNotificationManager.
-
-