From 8bf1267495a414aa5873d67657a23f3e730ff66b Mon Sep 17 00:00:00 2001 From: bachinger Date: Wed, 16 Jan 2019 11:05:44 +0000 Subject: [PATCH] allow developers to set the subText of the notifcation Issue: #5344 PiperOrigin-RevId: 229527963 --- RELEASENOTES.md | 2 ++ .../exoplayer2/ui/PlayerNotificationManager.java | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index f6ecfb962e..7fb10727cc 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -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 ### diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java index 47025d9bba..7cbe52d404 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java @@ -125,6 +125,18 @@ public class PlayerNotificationManager { @Nullable String getCurrentContentText(Player player); + /** + * Gets the content sub text for the current media item. + * + *

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(