From 3aa2dfdfd3695157679d0eec399e2c903f8a0f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20Garc=C3=ADa=20de=20Prada?= Date: Thu, 12 Jan 2023 13:48:34 +0100 Subject: [PATCH] Increase spaces thumbnails to support different screen sizes --- .../android/datamodel/ThumbnailsCacheManager.java | 9 ++++++--- owncloudApp/src/main/res/layout/spaces_list_item.xml | 2 +- owncloudApp/src/main/res/values-h640dp/dims.xml | 5 ++++- owncloudApp/src/main/res/values-h740dp/dims.xml | 5 ++++- owncloudApp/src/main/res/values/dims.xml | 6 ++++-- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/owncloudApp/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java b/owncloudApp/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java index 848cda72494..da94588625f 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java +++ b/owncloudApp/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java @@ -356,11 +356,14 @@ private Bitmap doFileInBackground() { } private String getSpaceSpecialUri(SpaceSpecial spaceSpecial) { + // Converts dp to pixel + Resources r = MainApp.Companion.getAppContext().getResources(); + Integer spacesThumbnailSize = Math.round(r.getDimension(R.dimen.spaces_thumbnail_height)) * 2; return String.format(Locale.ROOT, SPACE_SPECIAL_URI, spaceSpecial.getWebDavUrl(), - getThumbnailDimension(), - getThumbnailDimension(), + spacesThumbnailSize, + spacesThumbnailSize, spaceSpecial.getETag()); } @@ -373,7 +376,7 @@ private Bitmap doSpaceImageInBackground() { Bitmap thumbnail = getBitmapFromDiskCache(imageKey); // Not found in disk cache - if (thumbnail == null) { // TODO: Check if the current thumbnail is outdated + if (thumbnail == null) { int px = getThumbnailDimension(); // Download thumbnail from server diff --git a/owncloudApp/src/main/res/layout/spaces_list_item.xml b/owncloudApp/src/main/res/layout/spaces_list_item.xml index 2c4b518a281..b91d2b55ca8 100644 --- a/owncloudApp/src/main/res/layout/spaces_list_item.xml +++ b/owncloudApp/src/main/res/layout/spaces_list_item.xml @@ -42,7 +42,7 @@ diff --git a/owncloudApp/src/main/res/values-h640dp/dims.xml b/owncloudApp/src/main/res/values-h640dp/dims.xml index 75deca8312d..cc53084f8a4 100644 --- a/owncloudApp/src/main/res/values-h640dp/dims.xml +++ b/owncloudApp/src/main/res/values-h640dp/dims.xml @@ -23,4 +23,7 @@ 50dp 16dp 8dp - \ No newline at end of file + + + 192dp + diff --git a/owncloudApp/src/main/res/values-h740dp/dims.xml b/owncloudApp/src/main/res/values-h740dp/dims.xml index 745408ea4de..d4973189f1d 100644 --- a/owncloudApp/src/main/res/values-h740dp/dims.xml +++ b/owncloudApp/src/main/res/values-h740dp/dims.xml @@ -23,4 +23,7 @@ 100dp 32dp 8dp - \ No newline at end of file + + + 256dp + diff --git a/owncloudApp/src/main/res/values/dims.xml b/owncloudApp/src/main/res/values/dims.xml index 02b3a7e560a..563b43811a4 100644 --- a/owncloudApp/src/main/res/values/dims.xml +++ b/owncloudApp/src/main/res/values/dims.xml @@ -1,5 +1,4 @@ - - + 156dp