[Android] MediaSessionBrowser: remove use of static context

Geoffrey Métais git at videolan.org
Tue Mar 19 13:59:28 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar 19 13:31:14 2019 +0100| [6a5075f407d6f7df8cab3add0fa54a0e6b2889eb] | committer: Geoffrey Métais

MediaSessionBrowser: remove use of static context

> https://code.videolan.org/videolan/vlc-android/commit/6a5075f407d6f7df8cab3add0fa54a0e6b2889eb
---

 vlc-android/src/org/videolan/vlc/media/MediaSessionBrowser.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/media/MediaSessionBrowser.java b/vlc-android/src/org/videolan/vlc/media/MediaSessionBrowser.java
index b85d7c23b..20f9ba058 100644
--- a/vlc-android/src/org/videolan/vlc/media/MediaSessionBrowser.java
+++ b/vlc-android/src/org/videolan/vlc/media/MediaSessionBrowser.java
@@ -48,6 +48,7 @@ import org.videolan.vlc.extensions.ExtensionManagerService;
 import org.videolan.vlc.extensions.ExtensionsManager;
 import org.videolan.vlc.extensions.api.VLCExtensionItem;
 import org.videolan.vlc.gui.helpers.AudioUtil;
+import org.videolan.vlc.gui.helpers.UiTools;
 import org.videolan.vlc.util.Constants;
 import org.videolan.vlc.util.Settings;
 
@@ -63,7 +64,6 @@ public class MediaSessionBrowser implements ExtensionManagerService.ExtensionMan
 
     private static final String TAG = "VLC/MediaSessionBrowser";
 
-    private static final Bitmap DEFAULT_AUDIO_COVER = BitmapFactory.decodeResource(VLCApplication.getAppResources(), R.drawable.ic_menu_audio);
     private static String BASE_DRAWABLE_URI;
 
     public static final String ID_ROOT = "ID_ROOT";
@@ -247,7 +247,7 @@ public class MediaSessionBrowser implements ExtensionManagerService.ExtensionMan
                     if (libraryItem.getItemType() == MediaLibraryItem.TYPE_MEDIA && ((MediaWrapper) libraryItem).getType() != MediaWrapper.TYPE_AUDIO)
                         continue;
                     Bitmap cover = AudioUtil.readCoverBitmap(Uri.decode(libraryItem.getArtworkMrl()), 256);
-                    if (cover == null) cover = DEFAULT_AUDIO_COVER;
+                    if (cover == null) cover = UiTools.getDefaultAudioDrawable(context).getBitmap();
                     item.setTitle(libraryItem.getTitle())
                             .setMediaId(generateMediaId(libraryItem));
                     item.setIconBitmap(cover);
@@ -309,7 +309,7 @@ public class MediaSessionBrowser implements ExtensionManagerService.ExtensionMan
                 continue;
             mediaItem = new MediaDescriptionCompat.Builder();
             Uri coverUri = extensionItem.getImageUri();
-            if (coverUri == null) mediaItem.setIconBitmap(DEFAULT_AUDIO_COVER);
+            if (coverUri == null) mediaItem.setIconBitmap(UiTools.getDefaultAudioDrawable(VLCApplication.getAppContext()).getBitmap());
             else
                 mediaItem.setIconUri(coverUri);
             mediaItem.setTitle(extensionItem.getTitle());



More information about the Android mailing list