mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Merge pull request #10472 from nextcloud/thumbnailUpdateEnforced
When thumbnail update enforced, do not use any cached version
This commit is contained in:
commit
5cdace49ca
1 changed files with 16 additions and 4 deletions
|
@ -587,11 +587,17 @@ public final class ThumbnailsCacheManager {
|
|||
ServerFileInterface file = (ServerFileInterface) mFile;
|
||||
String imageKey = PREFIX_THUMBNAIL + file.getRemoteId();
|
||||
|
||||
// Check disk cache in background thread
|
||||
thumbnail = getBitmapFromDiskCache(imageKey);
|
||||
boolean updateEnforced = (file instanceof OCFile && ((OCFile) file).isUpdateThumbnailNeeded());
|
||||
|
||||
if (updateEnforced) {
|
||||
thumbnail = null;
|
||||
} else {
|
||||
// Check disk cache in background thread
|
||||
thumbnail = getBitmapFromDiskCache(imageKey);
|
||||
}
|
||||
|
||||
// Not found in disk cache
|
||||
if (thumbnail == null || (file instanceof OCFile && ((OCFile) file).isUpdateThumbnailNeeded())) {
|
||||
if (thumbnail == null) {
|
||||
int pxW;
|
||||
int pxH;
|
||||
pxW = pxH = getThumbnailDimension();
|
||||
|
@ -624,7 +630,13 @@ public final class ThumbnailsCacheManager {
|
|||
if (thumbnail == null) {
|
||||
// check if resized version is available
|
||||
String resizedImageKey = PREFIX_RESIZED_IMAGE + file.getRemoteId();
|
||||
Bitmap resizedImage = getBitmapFromDiskCache(resizedImageKey);
|
||||
|
||||
Bitmap resizedImage;
|
||||
if (updateEnforced) {
|
||||
resizedImage = null;
|
||||
} else {
|
||||
resizedImage = getBitmapFromDiskCache(resizedImageKey);
|
||||
}
|
||||
|
||||
if (resizedImage != null) {
|
||||
thumbnail = ThumbnailUtils.extractThumbnail(resizedImage, pxW, pxH);
|
||||
|
|
Loading…
Reference in a new issue