|
@@ -529,11 +529,15 @@ public class ThumbnailsCacheManager {
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- // Download thumbnail from server
|
|
|
- OwnCloudVersion serverOCVersion = AccountUtils.getServerVersion(mAccount);
|
|
|
+ // check if resized version is available
|
|
|
+ String resizedImageKey = PREFIX_RESIZED_IMAGE + String.valueOf(file.getRemoteId());
|
|
|
+ Bitmap resizedImage = getBitmapFromDiskCache(resizedImageKey);
|
|
|
|
|
|
- if (mClient != null) {
|
|
|
- if (serverOCVersion.supportsRemoteThumbnails()) {
|
|
|
+ if (resizedImage != null) {
|
|
|
+ thumbnail = ThumbnailUtils.extractThumbnail(resizedImage, pxW, pxH);
|
|
|
+ } else {
|
|
|
+ // Download thumbnail from server
|
|
|
+ if (mClient != null && AccountUtils.getServerVersion(mAccount).supportsRemoteThumbnails()) {
|
|
|
getMethod = null;
|
|
|
try {
|
|
|
// thumbnail
|
|
@@ -561,13 +565,6 @@ public class ThumbnailsCacheManager {
|
|
|
if (file.getMimetype().equalsIgnoreCase(PNG_MIMETYPE)) {
|
|
|
thumbnail = handlePNG(thumbnail, pxW, pxH);
|
|
|
}
|
|
|
-
|
|
|
- // Add thumbnail to cache
|
|
|
- if (thumbnail != null) {
|
|
|
- Log_OC.d(TAG, "add thumbnail to cache: " + file.getFileName());
|
|
|
- addBitmapToCache(imageKey, thumbnail);
|
|
|
- }
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
Log_OC.d(TAG, e.getMessage(), e);
|
|
|
} finally {
|
|
@@ -579,6 +576,12 @@ public class ThumbnailsCacheManager {
|
|
|
Log_OC.d(TAG, "Server too old");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // Add thumbnail to cache
|
|
|
+ if (thumbnail != null) {
|
|
|
+ Log_OC.d(TAG, "add thumbnail to cache: " + file.getFileName());
|
|
|
+ addBitmapToCache(imageKey, thumbnail);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|