return null;
}
+ /**
+ * Sets max size of cache
+ * @param maxSize in MB
+ * @return
+ */
+ public static boolean setMaxSize(long maxSize){
+ if (mThumbnailCache != null){
+ mThumbnailCache.setMaxSize(maxSize * 1024 * 1024);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static long getMaxSize(){
+ if (mThumbnailCache != null) {
+ return mThumbnailCache.getMaxSize();
+ } else {
+ return -1l;
+ }
+ }
+
public static class ThumbnailGenerationTask extends AsyncTask<Object, Void, Bitmap> {
private final WeakReference<ImageView> mImageViewReference;
private WeakReference<ProgressBar> mProgressWheelRef;
}
private Bitmap doFileInBackground(Boolean mIsThumbnail) {
- Bitmap thumbnail = null;
File file = (File)mFile;
- final String imageKey = String.valueOf(file.hashCode());
+ // distinguish between thumbnail and resized image
+ String temp = String.valueOf(file.hashCode());
+ if (mIsThumbnail){
+ temp = "t" + temp;
+ } else {
+ temp = "r" + temp;
+ }
+
+ final String imageKey = temp;
// Check disk cache in background thread
- thumbnail = getBitmapFromDiskCache(imageKey);
+ Bitmap thumbnail = getBitmapFromDiskCache(imageKey);
// Not found in disk cache
if (thumbnail == null) {