Commit 177bec2a authored by Geoffrey Métais's avatar Geoffrey Métais

Restore cache policy in cover fetching

parent 9fb81380
......@@ -378,7 +378,13 @@ public class AudioUtil {
}
public static Bitmap readCoverBitmap(String path, int width) {
Bitmap cover = null;
if (path == null)
return null;
if (path.startsWith("file"))
path = path.substring(7);
Bitmap cover = BitmapCache.getInstance().getBitmapFromMemCache(path);
if (cover != null)
return cover;
BitmapFactory.Options options = new BitmapFactory.Options();
/* Get the resolution of the bitmap without allocating the memory */
......@@ -397,6 +403,7 @@ public class AudioUtil {
// Decode the file (with memory allocation this time)
cover = BitmapFactory.decodeFile(path, options);
BitmapCache.getInstance().addBitmapToMemCache(path, cover);
}
return cover;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment