PlayerNotificationManager.MediaDescriptionAdapter


public interface PlayerNotificationManager.MediaDescriptionAdapter


An adapter to provide content assets of the media currently playing.

Summary

Public methods

abstract @Nullable PendingIntent

Creates a content intent for the current media item.

abstract @Nullable CharSequence

Gets the content text for the current media item.

abstract CharSequence

Gets the content title for the current media item.

abstract @Nullable Bitmap

Gets the large icon for the current media item.

default @Nullable CharSequence

Gets the content sub text for the current media item.

Public methods

createCurrentContentIntent

abstract @Nullable PendingIntent createCurrentContentIntent(Player player)

Creates a content intent for the current media item.

See setContentIntent.

Parameters
Player player

The Player for which a notification is being built.

Returns
@Nullable PendingIntent

The content intent for the current media item, or null if no intent should be fired.

getCurrentContentText

abstract @Nullable CharSequence getCurrentContentText(Player player)

Gets the content text for the current media item.

See setContentText.

Parameters
Player player

The Player for which a notification is being built.

Returns
@Nullable CharSequence

The content text for the current media item, or null if no context text should be displayed.

getCurrentContentTitle

abstract CharSequence getCurrentContentTitle(Player player)

Gets the content title for the current media item.

See setContentTitle.

Parameters
Player player

The Player for which a notification is being built.

Returns
CharSequence

The content title for the current media item.

getCurrentLargeIcon

abstract @Nullable Bitmap getCurrentLargeIcon(
    Player player,
    PlayerNotificationManager.BitmapCallback callback
)

Gets the large icon for the current media item.

When a bitmap needs to be loaded asynchronously, a placeholder bitmap (or null) should be returned. The actual bitmap should be passed to the BitmapCallback once it has been loaded. Because the adapter may be called multiple times for the same media item, bitmaps should be cached by the app and returned synchronously when possible.

See setLargeIcon.

Parameters
Player player

The Player for which a notification is being built.

PlayerNotificationManager.BitmapCallback callback

A BitmapCallback to provide a Bitmap asynchronously.

Returns
@Nullable Bitmap

The large icon for the current media item, or null if the icon will be returned through the BitmapCallback or if no icon should be displayed.

getCurrentSubText

default @Nullable CharSequence getCurrentSubText(Player player)

Gets the content sub text for the current media item.

See setSubText.

Parameters
Player player

The Player for which a notification is being built.

Returns
@Nullable CharSequence

The content subtext for the current media item, or null if no subtext should be displayed.