[Android] AudioUtil: split the Bitmap loading+scaling in a separate method
Jean-Baptiste Kempf
git at videolan.org
Mon Oct 15 16:31:10 CEST 2012
vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Oct 15 16:30:54 2012 +0200| [90fe9de5117d4f43317f1c7e56697592d09586cb] | committer: Jean-Baptiste Kempf
AudioUtil: split the Bitmap loading+scaling in a separate method
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=90fe9de5117d4f43317f1c7e56697592d09586cb
---
.../src/org/videolan/vlc/gui/audio/AudioUtil.java | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
index 09b5184..2d238da 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
@@ -191,12 +191,8 @@ public class AudioUtil {
if (coverPath == null)
coverPath = getCoverFromMediaStore(context, media);
- // read the bitmap
- cover = readBitmap(coverPath);
-
- // scale down if requested
- if (cover != null && width > 0)
- cover = Util.scaleDownBitmap(context, cover, width);
+ // read (and scale?) the bitmap
+ cover = readCoverBitmap(context, coverPath, width);
// store cover into cache
writeBitmap(cover, cachePath);
@@ -223,7 +219,13 @@ public class AudioUtil {
}
}
- private static Bitmap readBitmap(String path) {
- return BitmapFactory.decodeFile(path);
+ private static Bitmap readCoverBitmap(Context context, String path, int width) {
+ Bitmap cover = BitmapFactory.decodeFile(path);
+
+ // scale down if requested
+ if (cover != null && width > 0)
+ cover = Util.scaleDownBitmap(context, cover, width);
+
+ return cover;
}
}
More information about the Android
mailing list