NotificationStyle

class NotificationStyle

When music is playing, the com.adaptr.android.playersdk.Adaptr class creates a persistent notification with playback control buttons in it so that the user can always control music playback, even when a different app is in the foreground. By creating an instance of this class and passing it to com.adaptr.android.playersdk.AdaptrPlayer the imagery and layout of those notifications can be customized.

When using the default music notification layouts, the background color, play button image, pause button image, and skip button image can be customized through this object

To customize the music notification layout, you need to create two layouts: a small content view and a big content view. These must be identified with the setContentView and setBigContentView methods. Then you must provide the view IDs of any buttons or text fields in those views that you want wired up to the library: track name, artist name, release name, play/pause button, skip button, thumbs up (like) button, thumbs down (dislike) button, progress bar, and media image.

Note that the media artwork that appears in music notifications is defined via a call to com.adaptr.android.playersdk.AdaptrPlayer.artWork and not via this class.

Constructors

NotificationStyle
Link copied to clipboard
fun NotificationStyle()

Functions

getArtistTextId
Link copied to clipboard
fun getArtistTextId(): Int

Return the view id of the text view that renders the current artist and appears in the custom setBigContentView or setContentView}.

getCancelButtonId
Link copied to clipboard
fun getCancelButtonId(): Int

Return the view id of the cancel button that renders in the custom setBigContentView on pre-Lollipop devices when music is not playing.

getCancelIcon
Link copied to clipboard
fun getCancelIcon(): Int

Return the resource id of the icon that represents the cancel button in music notifications

getColor
Link copied to clipboard
fun getColor(): Int

Return the background color for the default music notification layout.

getDislikeButtonId
Link copied to clipboard
fun getDislikeButtonId(): Int

Return the view id of the dislike button that appears in the custom setBigContentView or setContentView}.

getLikeButtonId
Link copied to clipboard
fun getLikeButtonId(): Int

Return the view id of the like button that appears in the custom setBigContentView or setContentView}.

getMediaImageId
Link copied to clipboard
fun getMediaImageId(): Int

Return the view id of the image that renders the current media artwork and appears in the custom setBigContentView or setContentView}.

getPauseIcon
Link copied to clipboard
fun getPauseIcon(): Int

Return the resource id of the icon that represents the pause button in music notifications.

getPlayIcon
Link copied to clipboard
fun getPlayIcon(): Int

Return the resource id of the icon that represents the play button in music notifications

getPlayPauseButtonId
Link copied to clipboard
fun getPlayPauseButtonId(): Int

Return the view id of the play/pause button that appears in the custom setBigContentView or setContentView}.

getProgressId
Link copied to clipboard
fun getProgressId(): Int

Return the view id of the progress bar that renders the current track's elapsed playback and appears in the custom setBigContentView or setContentView}.

getReleaseTextId
Link copied to clipboard
fun getReleaseTextId(): Int

Return the view id of the text view that renders the current release and appears in the custom setBigContentView or setContentView}.

getSkipButtonId
Link copied to clipboard
fun getSkipButtonId(): Int

Return the view id of the skip button that appears in the custom setBigContentView or setContentView}.

getSkipIcon
Link copied to clipboard
fun getSkipIcon(): Int

Return the resource id of the icon that represents the skip button in music notifications

getSmallIcon
Link copied to clipboard
fun getSmallIcon(): Int

Return the resource id of the small icon that has been chosen for display in the notification area.

getTrackTextId
Link copied to clipboard
fun getTrackTextId(): Int

Return the view id of the text view that renders the current track and appears in the custom setBigContentView or setContentView}.

hasBigContentView
Link copied to clipboard
fun hasBigContentView(): Boolean
hasContentView
Link copied to clipboard
fun hasContentView(): Boolean
setArtistTextId
Link copied to clipboard
fun setArtistTextId(artistTextId: Int): NotificationStyle

Specify the view id of the view that renders the current artist that appears in the custom setBigContentView or setContentView .

setBigContentView
Link copied to clipboard
fun setBigContentView(packageName: String, bigContentViewId: Int): NotificationStyle

Specify the resource id of a view that will be rendered as a custom big notification to represent the currently playing song. Note that the view must only contain views within it that are permissible in android.widget.RemoteViews.

setCancelButtonId
Link copied to clipboard
fun setCancelButtonId(cancelButtonId: Int): NotificationStyle

Specify the view id of the cancel button that appears in the setBigContentView on pre-Lollipop devices to work around a bug with android persistent notifications not going away.

setCancelIcon
Link copied to clipboard
fun setCancelIcon(cancelIcon: Int): NotificationStyle

Provide the resource id of the icon that represents the cancel button in music notifications.

setColor
Link copied to clipboard
fun setColor(color: Int): NotificationStyle

Set the background color for the default music notification layout (note this is ignored if you use setContentView or setBigContentView).

setContentView
Link copied to clipboard
fun setContentView(packageName: String, contentViewId: Int): NotificationStyle

Specify the resource id of a view that will be rendered as a custom small notification to represent the currently playing song. Note that the view must only contain views within it that are permissible in a android.widget.RemoteViews.

setDislikeButtonId
Link copied to clipboard
fun setDislikeButtonId(dislikeButtonId: Int): NotificationStyle

Specify the view id of the dislike button that appears in the custom setBigContentView or setContentView .

setLikeButtonId
Link copied to clipboard
fun setLikeButtonId(likeButtonId: Int): NotificationStyle

Specify the view id of the like button that appears in the custom setBigContentView or setContentView .

setMediaImageId
Link copied to clipboard
fun setMediaImageId(mediaImageId: Int): NotificationStyle

Specify the view id of the image view that renders the current media artwork that appears in the custom setBigContentView or setContentView .

setPauseIcon
Link copied to clipboard
fun setPauseIcon(pauseIcon: Int): NotificationStyle

Provide the resource id of the icon that represents the pause button in music notifications.

setPlayIcon
Link copied to clipboard
fun setPlayIcon(playIcon: Int): NotificationStyle

Provide the resource id of the icon that represents the play button in music notifications.

setPlayPauseButtonId
Link copied to clipboard
fun setPlayPauseButtonId(playPauseButtonId: Int): NotificationStyle

Specify the id of the play/pause button that appears in the custom setBigContentView or setContentView .

setProgressId
Link copied to clipboard
fun setProgressId(progressId: Int): NotificationStyle

Specify the view id of the progress bar that renders the current track's elapsed playback that appears in the custom setBigContentView or setContentView .

setReleaseTextId
Link copied to clipboard
fun setReleaseTextId(releaseTextId: Int): NotificationStyle

Specify the view id of the view that renders the current release that appears in the custom setBigContentView or setContentView .

setSkipButtonId
Link copied to clipboard
fun setSkipButtonId(skipButtonId: Int): NotificationStyle

Specify the view id of the skip button that appears in the custom setBigContentView or setContentView .

setSkipIcon
Link copied to clipboard
fun setSkipIcon(skipIcon: Int): NotificationStyle

Provide the resource id of the icon that represents the skip button in music notifications.

setSmallIcon
Link copied to clipboard
fun setSmallIcon(smallIcon: Int): NotificationStyle

This is used to specify the image that should be used to represent music notifications for this app in the notification area.

setThumbsDownIcons
Link copied to clipboard
fun setThumbsDownIcons(thumbsDownIcon: Int, thumbsDownSelectedIcon: Int): NotificationStyle

Specify the resource ids of the icons that represent the thumbs down and selected thumbs down icons in custom music notifications.

setThumbsUpIcons
Link copied to clipboard
fun setThumbsUpIcons(thumbsUpIcon: Int, thumbsUpSelectedIcon: Int): NotificationStyle

Specify the resource ids of the icons that represent the thumbs up and selected thumbs up icons in custom music notifications.

setTrackTextId
Link copied to clipboard
fun setTrackTextId(trackTextId: Int): NotificationStyle

Specify the view id of the view that renders the current track that appears in the custom setBigContentView or setContentView .

Properties

bigContentView
Link copied to clipboard
val bigContentView: RemoteViews

Retrieve a new android.widget.RemoteViews instance constructed from the package name and resource ID provided to setBigContentView

contentView
Link copied to clipboard
val contentView: RemoteViews

Retrieve a new android.widget.RemoteViews instance constructed from the package name and resource is provided to setContentView

thumbsDownIcon
Link copied to clipboard
var thumbsDownIcon: Int

Return the resource id of the icon that represents the thumbs down button in custom music notifications

thumbsDownSelectedIcon
Link copied to clipboard
var thumbsDownSelectedIcon: Int

Return the resource id of the icon that represents the selected thumbs down button in custom music notifications.

thumbsUpIcon
Link copied to clipboard
var thumbsUpIcon: Int

Return the resource id of the icon that represents the thumbs up button in custom music notifications.

thumbsUpSelectedIcon
Link copied to clipboard
var thumbsUpSelectedIcon: Int

Return the resource id of the icon that represents the selected thumbs up button in custom music notifications.