|
@@ -156,7 +156,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|
thumbnail = getBitmapFromDiskCache(imageKey);
|
|
thumbnail = getBitmapFromDiskCache(imageKey);
|
|
|
|
|
|
// Not found in disk cache
|
|
// Not found in disk cache
|
|
- if (thumbnail == null) {
|
|
|
|
|
|
+ if (thumbnail == null || file.needsUpdateThumbnail()) {
|
|
// Converts dp to pixel
|
|
// Converts dp to pixel
|
|
Resources r = mContext.getResources();
|
|
Resources r = mContext.getResources();
|
|
int px = (int) Math.round(TypedValue.applyDimension(
|
|
int px = (int) Math.round(TypedValue.applyDimension(
|
|
@@ -172,6 +172,9 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|
|
|
|
|
// Add thumbnail to cache
|
|
// Add thumbnail to cache
|
|
addBitmapToCache(imageKey, thumbnail);
|
|
addBitmapToCache(imageKey, thumbnail);
|
|
|
|
+
|
|
|
|
+ file.setNeedsUpdateThumbnail(false);
|
|
|
|
+ mStorageManager.saveFile(file);
|
|
}
|
|
}
|
|
|
|
|
|
} else {
|
|
} else {
|
|
@@ -235,7 +238,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|
|
|
|
|
public void addBitmapToCache(String key, Bitmap bitmap) {
|
|
public void addBitmapToCache(String key, Bitmap bitmap) {
|
|
synchronized (thumbnailDiskCacheLock) {
|
|
synchronized (thumbnailDiskCacheLock) {
|
|
- if (mThumbnailCache != null && mThumbnailCache.getBitmap(key) == null) {
|
|
|
|
|
|
+ if (mThumbnailCache != null) {
|
|
mThumbnailCache.put(key, bitmap);
|
|
mThumbnailCache.put(key, bitmap);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -363,7 +366,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|
if (file.isImage()){
|
|
if (file.isImage()){
|
|
// Thumbnail in Cache?
|
|
// Thumbnail in Cache?
|
|
Bitmap thumbnail = getBitmapFromDiskCache(String.valueOf(file.getRemoteId()));
|
|
Bitmap thumbnail = getBitmapFromDiskCache(String.valueOf(file.getRemoteId()));
|
|
- if (thumbnail != null){
|
|
|
|
|
|
+ if (thumbnail != null && !file.needsUpdateThumbnail()){
|
|
fileIcon.setImageBitmap(thumbnail);
|
|
fileIcon.setImageBitmap(thumbnail);
|
|
} else {
|
|
} else {
|
|
// generate new Thumbnail
|
|
// generate new Thumbnail
|