X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/6d5c6f86e5fa9a2edb51562d028554cbc49cdf93..898957f9e758b12b418801754bb225d94e51317e:/src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java diff --git a/src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java b/src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java index eeb01829..87fa43ff 100644 --- a/src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java +++ b/src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java @@ -1,5 +1,9 @@ -/* ownCloud Android client application - * Copyright (C) 2012-2014 ownCloud Inc. +/** + * ownCloud Android client application + * + * @author Tobias Kaminsky + * @author David A. Velasco + * Copyright (C) 2015 ownCloud Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@ -49,10 +53,7 @@ import com.owncloud.android.utils.BitmapUtils; import com.owncloud.android.utils.DisplayUtils; /** - * Manager for concurrent access to thumbnails cache. - * - * @author Tobias Kaminsky - * @author David A. Velasco + * Manager for concurrent access to thumbnails cache. */ public class ThumbnailsCacheManager { @@ -173,26 +174,7 @@ public class ThumbnailsCacheManager { } mFile = params[0]; - final String imageKey = String.valueOf(mFile.getRemoteId()); - - // Check disk cache in background thread - thumbnail = getBitmapFromDiskCache(imageKey); - - // Not found in disk cache - if (thumbnail == null || mFile.needsUpdateThumbnail()) { - // Use Width of imageView -> no blurry images on big screens - int px = mImageViewReference.get().getWidth(); - - if (mFile.isDown()){ - Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile( - mFile.getStoragePath(), px, px); - - if (bitmap != null) { - thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px); - - // Add thumbnail to cache - addBitmapToCache(imageKey, thumbnail); - + if (mFile instanceof OCFile) { thumbnail = doOCFileInBackground(); } else if (mFile instanceof File) { @@ -262,7 +244,7 @@ public class ThumbnailsCacheManager { private int getThumbnailDimension(){ // Converts dp to pixel Resources r = MainApp.getAppContext().getResources(); - return (int) Math.round(r.getDimension(R.dimen.file_icon_size)); + return (int) Math.round(r.getDimension(R.dimen.file_icon_size_grid)); } private Bitmap doOCFileInBackground() {