<div dir="ltr">Referring to last former patch, I'd rather put the retrieval from <span style="color:rgb(33,33,33)"><i>getBitmapFromIconCache()</i></span> in <i>getCoverFromMemCache().</i></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Nov 7, 2016 at 10:04 AM Marc K <<a href="mailto:morckx@gmail.com">morckx@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This fixes showing the cover art of network media if it was previously<br class="gmail_msg">
shown as icon in the browser,<br class="gmail_msg">
<br class="gmail_msg">
Signed-off-by: Marc K <<a href="mailto:morckx@gmail.com" class="gmail_msg" target="_blank">morckx@gmail.com</a>><br class="gmail_msg">
---<br class="gmail_msg">
vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java | 7 +++++--<br class="gmail_msg">
vlc-android/src/org/videolan/vlc/util/HttpImageLoader.java | 11 +++++++++--<br class="gmail_msg">
2 files changed, 14 insertions(+), 4 deletions(-)<br class="gmail_msg">
<br class="gmail_msg">
diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java b/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java<br class="gmail_msg">
index 846f996..022387a 100644<br class="gmail_msg">
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java<br class="gmail_msg">
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java<br class="gmail_msg">
@@ -42,6 +42,7 @@ import org.videolan.vlc.R;<br class="gmail_msg">
import org.videolan.vlc.VLCApplication;<br class="gmail_msg">
import org.videolan.vlc.media.MediaUtils;<br class="gmail_msg">
import org.videolan.vlc.util.AndroidDevices;<br class="gmail_msg">
+import org.videolan.vlc.util.HttpImageLoader;<br class="gmail_msg">
import org.videolan.vlc.util.MurmurHash;<br class="gmail_msg">
import org.videolan.vlc.util.Permissions;<br class="gmail_msg">
import org.videolan.vlc.util.Util;<br class="gmail_msg">
@@ -322,8 +323,6 @@ public class AudioUtil {<br class="gmail_msg">
if (cacheFile.exists()) {<br class="gmail_msg">
if (cacheFile.length() > 0)<br class="gmail_msg">
coverPath = cachePath;<br class="gmail_msg">
- else<br class="gmail_msg">
- return null;<br class="gmail_msg">
}<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
@@ -342,6 +341,10 @@ public class AudioUtil {<br class="gmail_msg">
// read (and scale?) the bitmap<br class="gmail_msg">
cover = readCoverBitmap(coverPath, width);<br class="gmail_msg">
<br class="gmail_msg">
+ // as last resort try to get the cover from the icon cache<br class="gmail_msg">
+ if (cover == null && media.getArtworkURL() != null)<br class="gmail_msg">
+ cover = HttpImageLoader.getBitmapFromIconCache(media.getArtworkURL());<br class="gmail_msg">
+<br class="gmail_msg">
// store cover into both cache<br class="gmail_msg">
if (cachePath != null) {<br class="gmail_msg">
writeBitmap(cover, cachePath);<br class="gmail_msg">
diff --git a/vlc-android/src/org/videolan/vlc/util/HttpImageLoader.java b/vlc-android/src/org/videolan/vlc/util/HttpImageLoader.java<br class="gmail_msg">
index a0cf59e..8810408 100644<br class="gmail_msg">
--- a/vlc-android/src/org/videolan/vlc/util/HttpImageLoader.java<br class="gmail_msg">
+++ b/vlc-android/src/org/videolan/vlc/util/HttpImageLoader.java<br class="gmail_msg">
@@ -95,7 +95,7 @@ public class HttpImageLoader implements Callbacks {<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
@Nullable<br class="gmail_msg">
- public static Bitmap downloadBitmap(String imageUrl) {<br class="gmail_msg">
+ public static Bitmap getBitmapFromIconCache(String imageUrl) {<br class="gmail_msg">
if (iconsMap.containsKey(imageUrl)) {<br class="gmail_msg">
Bitmap bd = iconsMap.get(imageUrl).get();<br class="gmail_msg">
if (bd != null) {<br class="gmail_msg">
@@ -103,8 +103,15 @@ public class HttpImageLoader implements Callbacks {<br class="gmail_msg">
} else<br class="gmail_msg">
iconsMap.remove(imageUrl);<br class="gmail_msg">
}<br class="gmail_msg">
+ return null;<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ @Nullable<br class="gmail_msg">
+ public static Bitmap downloadBitmap(String imageUrl) {<br class="gmail_msg">
HttpURLConnection urlConnection = null;<br class="gmail_msg">
- Bitmap icon = null;<br class="gmail_msg">
+ Bitmap icon = getBitmapFromIconCache(imageUrl);<br class="gmail_msg">
+ if (icon != null)<br class="gmail_msg">
+ return icon;<br class="gmail_msg">
try {<br class="gmail_msg">
URL url = new URL(imageUrl);<br class="gmail_msg">
if (url.getPort() <= 0)<br class="gmail_msg">
--<br class="gmail_msg">
2.9.3<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
Android mailing list<br class="gmail_msg">
<a href="mailto:Android@videolan.org" class="gmail_msg" target="_blank">Android@videolan.org</a><br class="gmail_msg">
<a href="https://mailman.videolan.org/listinfo/android" rel="noreferrer" class="gmail_msg" target="_blank">https://mailman.videolan.org/listinfo/android</a><br class="gmail_msg">
</blockquote></div>