allow developers to set the subText of the notifcation

Issue: #5344
PiperOrigin-RevId: 229527963
This commit is contained in:
bachinger 2019-01-16 11:05:44 +00:00 committed by Oliver Woodman
parent 4483639f9a
commit 8bf1267495
2 changed files with 15 additions and 0 deletions

View File

@ -16,6 +16,8 @@
([#5351](https://github.com/google/ExoPlayer/issues/5351)).
* Fix issue where uneven track durations in MP4 streams can cause OOM problems
([#3670](https://github.com/google/ExoPlayer/issues/3670)).
* Add the sub text to the MediaDescriptionAdapter of the
PlayerNotificationManager.
### 2.9.3 ###

View File

@ -125,6 +125,18 @@ public class PlayerNotificationManager {
@Nullable
String getCurrentContentText(Player player);
/**
* Gets the content sub text for the current media item.
*
* <p>See {@link NotificationCompat.Builder#setSubText(CharSequence)}.
*
* @param player The {@link Player} for which a notification is being built.
*/
@Nullable
default String getCurrentSubText(Player player) {
return null;
}
/**
* Gets the large icon for the current media item.
*
@ -832,6 +844,7 @@ public class PlayerNotificationManager {
// Set media specific notification properties from MediaDescriptionAdapter.
builder.setContentTitle(mediaDescriptionAdapter.getCurrentContentTitle(player));
builder.setContentText(mediaDescriptionAdapter.getCurrentContentText(player));
builder.setSubText(mediaDescriptionAdapter.getCurrentSubText(player));
if (largeIcon == null) {
largeIcon =
mediaDescriptionAdapter.getCurrentLargeIcon(