From: tobiasKaminsky Date: Sat, 31 Oct 2015 07:30:13 +0000 (+0100) Subject: fixed storing thumbnails by correct imageKey X-Git-Tag: beta-20151122~1^2~6 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/cf22541dd5b573030c37d2cc7624d644d33eed93?ds=inline fixed storing thumbnails by correct imageKey --- diff --git a/src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java b/src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java index 49bda88e..9b31f3aa 100644 --- a/src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java +++ b/src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java @@ -339,18 +339,6 @@ public class ThumbnailsCacheManager { thumbnail = ThumbnailUtils.extractThumbnail(bitmap, pxW, pxH); byte[] bytes = get.getResponseBody(); - String type = ""; - if (mIsThumbnail){ - type = "Thumbnail"; - } else { - type = "Resized image"; - } - Log_OC.d("Thumbnail", - type + " size of " + file.getRemotePath() - + ": " + bytes.length); - - // bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); - if (mIsThumbnail) { thumbnail = ThumbnailUtils.extractThumbnail(bitmap, pxW, pxH); } else { @@ -377,13 +365,20 @@ public class ThumbnailsCacheManager { } 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) { diff --git a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java index eb595383..897f9804 100644 --- a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java +++ b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java @@ -297,8 +297,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter { if (file.isImage() && file.getRemoteId() != null){ // Thumbnail in Cache? Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache( - String.valueOf(file.getRemoteId()) - ); + "t" + String.valueOf(file.getRemoteId())); if (thumbnail != null && !file.needsUpdateThumbnail()){ fileIcon.setImageBitmap(thumbnail); } else {