From a3bad3680b8384d5ebf27e454668318c6311bc5a Mon Sep 17 00:00:00 2001 From: olly Date: Thu, 2 Jan 2020 13:13:31 +0000 Subject: [PATCH] Document overriding drawables for notifications Issue: #6266 PiperOrigin-RevId: 287821640 --- .../ui/PlayerNotificationManager.java | 52 +++++++++++++------ 1 file changed, 37 insertions(+), 15 deletions(-) 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 aeb5292187..e572bc5a11 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 @@ -55,28 +55,28 @@ import java.util.List; import java.util.Map; /** - * A notification manager to start, update and cancel a media style notification reflecting the - * player state. + * Starts, updates and cancels a media style notification reflecting the player state. The actions + * displayed and the drawables used can both be customized, as described below. * *

The notification is cancelled when {@code null} is passed to {@link #setPlayer(Player)} or * when the notification is dismissed by the user. * *

If the player is released it must be removed from the manager by calling {@code - * setPlayer(null)} which will cancel the notification. + * setPlayer(null)}. * *

Action customization

* - * Standard playback actions can be shown or omitted as follows: + * Playback actions can be displayed or omitted as follows: * * + * + *

Overriding drawables

+ * + * The drawables used by PlayerNotificationManager can be overridden by drawables with the same + * names defined in your application. The drawables that can be overridden are: + * + * + * + * Unlike the drawables above, the large icon (i.e. the icon passed to {@link + * NotificationCompat.Builder#setLargeIcon(Bitmap)} cannot be overridden in this way. Instead, the + * large icon is obtained from the {@link MediaDescriptionAdapter} injected when creating the + * PlayerNotificationManager. */ public class PlayerNotificationManager { @@ -154,11 +177,10 @@ public class PlayerNotificationManager { /** * Gets the large icon for the current media item. * - *

When a bitmap initially needs to be asynchronously loaded, a placeholder (or null) can be - * returned and the bitmap asynchronously passed to the {@link BitmapCallback} once it is - * loaded. Because the adapter may be called multiple times for the same media item, the bitmap - * should be cached by the app and whenever possible be returned synchronously at subsequent - * calls for the same 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 {@link 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 {@link NotificationCompat.Builder#setLargeIcon(Bitmap)}. *