Package com.google.android.exoplayer2.ui
Class DefaultMediaDescriptionAdapter
- java.lang.Object
-
- com.google.android.exoplayer2.ui.DefaultMediaDescriptionAdapter
-
- All Implemented Interfaces:
PlayerNotificationManager.MediaDescriptionAdapter
public final class DefaultMediaDescriptionAdapter extends Object implements PlayerNotificationManager.MediaDescriptionAdapter
Default implementation ofPlayerNotificationManager.MediaDescriptionAdapter
.Uses values from the
player mediaMetadata
to populate the notification.
-
-
Constructor Summary
Constructors Constructor Description DefaultMediaDescriptionAdapter(PendingIntent pendingIntent)
Creates a defaultPlayerNotificationManager.MediaDescriptionAdapter
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PendingIntent
createCurrentContentIntent(Player player)
Creates a content intent for the current media item.CharSequence
getCurrentContentText(Player player)
Gets the content text for the current media item.CharSequence
getCurrentContentTitle(Player player)
Gets the content title for the current media item.Bitmap
getCurrentLargeIcon(Player player, PlayerNotificationManager.BitmapCallback callback)
Gets the large icon for the current media item.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.android.exoplayer2.ui.PlayerNotificationManager.MediaDescriptionAdapter
getCurrentSubText
-
-
-
-
Constructor Detail
-
DefaultMediaDescriptionAdapter
public DefaultMediaDescriptionAdapter(@Nullable PendingIntent pendingIntent)
Creates a defaultPlayerNotificationManager.MediaDescriptionAdapter
.- Parameters:
pendingIntent
- ThePendingIntent
to be returned fromcreateCurrentContentIntent(Player)
, or null if no intent should be fired.
-
-
Method Detail
-
getCurrentContentTitle
public CharSequence getCurrentContentTitle(Player player)
Description copied from interface:PlayerNotificationManager.MediaDescriptionAdapter
Gets the content title for the current media item.See
NotificationCompat.Builder.setContentTitle(CharSequence)
.- Specified by:
getCurrentContentTitle
in interfacePlayerNotificationManager.MediaDescriptionAdapter
- Parameters:
player
- ThePlayer
for which a notification is being built.- Returns:
- The content title for the current media item.
-
createCurrentContentIntent
@Nullable public PendingIntent createCurrentContentIntent(Player player)
Description copied from interface:PlayerNotificationManager.MediaDescriptionAdapter
Creates a content intent for the current media item.See
NotificationCompat.Builder.setContentIntent(PendingIntent)
.- Specified by:
createCurrentContentIntent
in interfacePlayerNotificationManager.MediaDescriptionAdapter
- Parameters:
player
- ThePlayer
for which a notification is being built.- Returns:
- The content intent for the current media item, or null if no intent should be fired.
-
getCurrentContentText
@Nullable public CharSequence getCurrentContentText(Player player)
Description copied from interface:PlayerNotificationManager.MediaDescriptionAdapter
Gets the content text for the current media item.See
NotificationCompat.Builder.setContentText(CharSequence)
.- Specified by:
getCurrentContentText
in interfacePlayerNotificationManager.MediaDescriptionAdapter
- Parameters:
player
- ThePlayer
for which a notification is being built.- Returns:
- The content text for the current media item, or null if no context text should be displayed.
-
getCurrentLargeIcon
@Nullable public Bitmap getCurrentLargeIcon(Player player, PlayerNotificationManager.BitmapCallback callback)
Description copied from interface:PlayerNotificationManager.MediaDescriptionAdapter
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
PlayerNotificationManager.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
NotificationCompat.Builder.setLargeIcon(Bitmap)
.- Specified by:
getCurrentLargeIcon
in interfacePlayerNotificationManager.MediaDescriptionAdapter
- Parameters:
player
- ThePlayer
for which a notification is being built.callback
- APlayerNotificationManager.BitmapCallback
to provide aBitmap
asynchronously.- Returns:
- The large icon for the current media item, or null if the icon will be returned
through the
PlayerNotificationManager.BitmapCallback
or if no icon should be displayed.
-
-