From ef0b0fe9eecb9ebd2d2644e326bacbed366bb8ac Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Sat, 18 Jan 2020 16:22:54 +0100 Subject: [PATCH 1/7] images: slightly rounded corners Signed-off-by: tobiasKaminsky --- .../datamodel/ThumbnailsCacheManager.java | 7 ++++++- .../android/ui/adapter/OCFileListAdapter.java | 9 +++++++- .../owncloud/android/utils/BitmapUtils.java | 21 ++++++++++++++++++- src/main/res/values/dims.xml | 1 + 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java b/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java index 5db9a29605..ba0fc22b05 100644 --- a/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java +++ b/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java @@ -508,7 +508,12 @@ public final class ThumbnailsCacheManager { tagId = String.valueOf(((TrashbinFile) mFile).getRemoteId()); } if (String.valueOf(imageView.getTag()).equals(tagId)) { - imageView.setImageBitmap(bitmap); + Resources resources = MainApp.getAppContext().getResources(); + + BitmapUtils.setRoundedBitmap(resources, + bitmap, + resources.getDimension(R.dimen.file_icon_rounded_corner_radius), + imageView); } } } diff --git a/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java index 7bf1148cc4..beeca6e63b 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java @@ -52,6 +52,7 @@ import com.bumptech.glide.request.target.BitmapImageViewTarget; import com.nextcloud.client.account.User; import com.nextcloud.client.account.UserAccountManager; import com.nextcloud.client.preferences.AppPreferences; +import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; @@ -602,7 +603,13 @@ public class OCFileListAdapter extends RecyclerView.Adapter20dp 40dp 128dp + 20dp 128dp 16dp 32dp From 4fb140d275061e028d70b3a24fa3af36713daba0 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Wed, 22 Jan 2020 13:45:31 +0100 Subject: [PATCH 2/7] round corners only in list view Signed-off-by: tobiasKaminsky --- .../datamodel/ThumbnailsCacheManager.java | 25 +++++++++++++++---- .../android/ui/adapter/OCFileListAdapter.java | 17 ++++++++----- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java b/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java index ba0fc22b05..0124bacd5d 100644 --- a/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java +++ b/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java @@ -410,12 +410,23 @@ public final class ThumbnailsCacheManager { private String mImageKey; private FileDataStorageManager mStorageManager; private GetMethod getMethod; + private boolean roundedCorners = false; public ThumbnailGenerationTask(ImageView imageView, FileDataStorageManager storageManager, Account account) throws IllegalArgumentException { this(imageView, storageManager, account, null); } + public ThumbnailGenerationTask(ImageView imageView, + FileDataStorageManager storageManager, + Account account, + List asyncTasks, + boolean roundedCorners) + throws IllegalArgumentException { + this(imageView, storageManager, account, asyncTasks); + this.roundedCorners = roundedCorners; + } + public ThumbnailGenerationTask(ImageView imageView, FileDataStorageManager storageManager, Account account, List asyncTasks) throws IllegalArgumentException { @@ -508,12 +519,16 @@ public final class ThumbnailsCacheManager { tagId = String.valueOf(((TrashbinFile) mFile).getRemoteId()); } if (String.valueOf(imageView.getTag()).equals(tagId)) { - Resources resources = MainApp.getAppContext().getResources(); + if (roundedCorners) { + Resources resources = MainApp.getAppContext().getResources(); - BitmapUtils.setRoundedBitmap(resources, - bitmap, - resources.getDimension(R.dimen.file_icon_rounded_corner_radius), - imageView); + BitmapUtils.setRoundedBitmap(resources, + bitmap, + resources.getDimension(R.dimen.file_icon_rounded_corner_radius), + imageView); + } else { + imageView.setImageBitmap(bitmap); + } } } } diff --git a/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java index beeca6e63b..b201e088ca 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java @@ -603,12 +603,16 @@ public class OCFileListAdapter extends RecyclerView.Adapter Date: Thu, 30 Jan 2020 20:31:45 +0100 Subject: [PATCH 3/7] extract doubled code Signed-off-by: tobiasKaminsky --- .../android/datamodel/ThumbnailsCacheManager.java | 7 +------ .../android/ui/adapter/OCFileListAdapter.java | 9 +-------- .../java/com/owncloud/android/utils/BitmapUtils.java | 11 +++++++++++ 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java b/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java index 0124bacd5d..8bd377cba7 100644 --- a/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java +++ b/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java @@ -520,12 +520,7 @@ public final class ThumbnailsCacheManager { } if (String.valueOf(imageView.getTag()).equals(tagId)) { if (roundedCorners) { - Resources resources = MainApp.getAppContext().getResources(); - - BitmapUtils.setRoundedBitmap(resources, - bitmap, - resources.getDimension(R.dimen.file_icon_rounded_corner_radius), - imageView); + BitmapUtils.setRoundedBitmap(bitmap, imageView); } else { imageView.setImageBitmap(bitmap); } diff --git a/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java index b201e088ca..e4ccc8c0dc 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java @@ -52,7 +52,6 @@ import com.bumptech.glide.request.target.BitmapImageViewTarget; import com.nextcloud.client.account.User; import com.nextcloud.client.account.UserAccountManager; import com.nextcloud.client.preferences.AppPreferences; -import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; @@ -606,14 +605,8 @@ public class OCFileListAdapter extends RecyclerView.Adapter Date: Thu, 30 Jan 2020 21:39:54 +0100 Subject: [PATCH 4/7] use radius, and do not only test for it Signed-off-by: tobiasKaminsky --- src/main/java/com/owncloud/android/utils/BitmapUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/owncloud/android/utils/BitmapUtils.java b/src/main/java/com/owncloud/android/utils/BitmapUtils.java index 711df4969b..086fd63b18 100644 --- a/src/main/java/com/owncloud/android/utils/BitmapUtils.java +++ b/src/main/java/com/owncloud/android/utils/BitmapUtils.java @@ -390,7 +390,7 @@ public final class BitmapUtils { roundedBitmap.setCircular(true); if (radius != -1) { - roundedBitmap.setCornerRadius(20); + roundedBitmap.setCornerRadius(radius); } return roundedBitmap; From d6275c48332afac1d6f1370855c6f4a3e62d86a4 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 31 Jan 2020 07:20:14 +0100 Subject: [PATCH 5/7] use 10dp Signed-off-by: tobiasKaminsky --- src/main/res/values/dims.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/res/values/dims.xml b/src/main/res/values/dims.xml index 67d98e6b59..2b894e5e48 100644 --- a/src/main/res/values/dims.xml +++ b/src/main/res/values/dims.xml @@ -30,7 +30,7 @@ 20dp 40dp 128dp - 20dp + 10dp 128dp 16dp 32dp From 66b78e0eb75881304527f49b248d2e307892faa9 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 3 Feb 2020 06:58:39 +0100 Subject: [PATCH 6/7] changed to 8dp Signed-off-by: tobiasKaminsky --- src/main/res/values/dims.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/res/values/dims.xml b/src/main/res/values/dims.xml index 2b894e5e48..00860d18dc 100644 --- a/src/main/res/values/dims.xml +++ b/src/main/res/values/dims.xml @@ -30,7 +30,7 @@ 20dp 40dp 128dp - 10dp + 8dp 128dp 16dp 32dp From b787284ab6c0a389d0d57e71877d1d4cd301ed8c Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 3 Feb 2020 11:53:37 +0100 Subject: [PATCH 7/7] bump spotbugs Signed-off-by: tobiasKaminsky --- scripts/analysis/findbugs-results.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/analysis/findbugs-results.txt b/scripts/analysis/findbugs-results.txt index 5c9fe11c04..d1b9f6a9c4 100644 --- a/scripts/analysis/findbugs-results.txt +++ b/scripts/analysis/findbugs-results.txt @@ -1 +1 @@ -413 \ No newline at end of file +414