Class PlaybackNotification.Config

  • Enclosing class:

    public static class PlaybackNotification.Config
    extends java.lang.Object
    The config used to create the on-going notification and update the notification content.
    • Field Detail

      • context

        protected final android.content.Context context
      • notificationId

        protected int notificationId
      • channelNameResourceId

        protected int channelNameResourceId
      • smallIconResourceId

        protected int smallIconResourceId
      • channelImportance

        protected int channelImportance
      • usePlayPauseActions

        protected boolean usePlayPauseActions
      • useNextAction

        protected boolean useNextAction
      • usePreviousAction

        protected boolean usePreviousAction
      • useNextActionInCompactView

        protected boolean useNextActionInCompactView
      • usePreviousActionInCompactView

        protected boolean usePreviousActionInCompactView
      • useFastForwardAction

        protected boolean useFastForwardAction
      • useFastForwardActionInCompactView

        protected boolean useFastForwardActionInCompactView
      • useRewindAction

        protected boolean useRewindAction
      • useRewindActionInCompactView

        protected boolean useRewindActionInCompactView
      • colorized

        protected boolean colorized
      • color

        protected int color
      • priority

        protected int priority
      • visibility

        protected int visibility
      • channelId

        protected java.lang.String channelId
    • Constructor Detail

      • Config

        public Config​(android.content.Context context)
        Create a new instance of the config.
        context - The application context, used by the notification manager.
    • Method Detail

      • setChannelId

        public PlaybackNotification.Config setChannelId​(java.lang.String channelId)
        The id of the notification channel.
        channelId - The notification channel ID name.
        This instance for the chaining of method calls.
      • setNotificationId

        public PlaybackNotification.Config setNotificationId​(int notificationId)
        The id of the notification to be posted. Must be greater than 0.
        notificationId - The notification ID
        This instance for the chaining of method calls.
      • setChannelNameResourceId

        public PlaybackNotification.Config setChannelNameResourceId​(int channelNameResourceId)
        The name of the channel.
        This instance for the chaining of method calls.
      • setChannelImportance

        public PlaybackNotification.Config setChannelImportance​(int channelImportance)
        The importance of the channel.
        This instance for the chaining of method calls.
      • setSmallIcon

        public final PlaybackNotification.Config setSmallIcon​(@DrawableRes
                                                              int smallIconResourceId)
        Sets the small icon of the notification which is also shown in the system status bar.

        See Notification.Builder.setSmallIcon(int).

        smallIconResourceId - The resource id of the small icon.
      • setUseNextAction

        public final PlaybackNotification.Config setUseNextAction​(boolean useNextAction)
        Sets whether the next action should be used.
        useNextAction - Whether to use the next action.
      • setUsePreviousAction

        public final PlaybackNotification.Config setUsePreviousAction​(boolean usePreviousAction)
        Sets whether the previous action should be used.
        usePreviousAction - Whether to use the previous action.
      • setUsePreviousActionInCompactView

        public final PlaybackNotification.Config setUsePreviousActionInCompactView​(boolean usePreviousActionInCompactView)
        If usePreviousAction is true, sets whether the previous action should also be used in compact view. Has no effect if usePreviousAction is false.

        If set to true, setUseRewindActionInCompactView is set to false.

        usePreviousActionInCompactView - Whether to use the previous action in compact view.
      • setUseFastForwardAction

        public final PlaybackNotification.Config setUseFastForwardAction​(boolean useFastForwardAction)
        Sets whether the fast forward action should be used.
        useFastForwardAction - Whether to use the fast forward action.
      • setUseRewindAction

        public final PlaybackNotification.Config setUseRewindAction​(boolean useRewindAction)
        Sets whether the rewind action should be used.
        useRewindAction - Whether to use the rewind action.
      • setUseFastForwardActionInCompactView

        public final PlaybackNotification.Config setUseFastForwardActionInCompactView​(boolean useFastForwardActionInCompactView)
        Sets whether the fast forward action should also be used in compact view.
        useFastForwardActionInCompactView - Whether to use the fast forward action in compact view.
      • setUseRewindActionInCompactView

        public final PlaybackNotification.Config setUseRewindActionInCompactView​(boolean useRewindActionInCompactView)
        Sets whether the rewind action should also be used in compact view.
        useRewindActionInCompactView - Whether to use the rewind action in compact view.
      • setUsePlayPauseActions

        public final PlaybackNotification.Config setUsePlayPauseActions​(boolean usePlayPauseActions)
        Sets whether the play and pause actions should be used.
        usePlayPauseActions - Whether to use play and pause actions.
      • setColorized

        public final PlaybackNotification.Config setColorized​(boolean colorized)
        Sets whether the notification should be colorized. When set, the color set with setColor(int) will be used as the background color for the notification.

        See Notification.Builder.setColorized(boolean).

        colorized - Whether to colorize the notification.
      • setColor

        public final PlaybackNotification.Config setColor​(int color)
        Sets the accent color of the notification.

        See Notification.Builder.setColor(int).

        color - The color, in ARGB integer form.
      • setPriority

        public final PlaybackNotification.Config setPriority​(int priority)
        Sets the priority of the notification required for API 25 and lower.

        See Notification.Builder.setPriority(int).

        priority - The priority which can be one of Notification.PRIORITY_DEFAULT, Notification.PRIORITY_MAX, Notification.PRIORITY_HIGH, Notification.PRIORITY_LOW or Notification.PRIORITY_MIN. If not set Notification.PRIORITY_LOW is used by default.
      • setVisibility

        public final PlaybackNotification.Config setVisibility​(int visibility)
        Sets the visibility of the notification which determines whether and how the notification is shown when the device is in lock screen mode.

        See Notification.Builder.setVisibility(int).

        visibility - The visibility which must be one of Notification.VISIBILITY_PUBLIC, Notification.VISIBILITY_PRIVATE or Notification.VISIBILITY_SECRET.