From 506690a8979a58203f0a1cf9dc31acde0cabf050 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Mon, 21 Feb 2022 17:54:05 +0000 Subject: [PATCH] fixing wrong shortcut icon size and ensuring the transformed files are stored with unique keys --- .../im/vector/app/features/home/AdaptiveIconTransformation.kt | 2 +- .../main/java/im/vector/app/features/home/AvatarRenderer.kt | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/AdaptiveIconTransformation.kt b/vector/src/main/java/im/vector/app/features/home/AdaptiveIconTransformation.kt index 9efd842e58..6eb41a1d85 100644 --- a/vector/src/main/java/im/vector/app/features/home/AdaptiveIconTransformation.kt +++ b/vector/src/main/java/im/vector/app/features/home/AdaptiveIconTransformation.kt @@ -31,7 +31,7 @@ class AdaptiveIconTransformation(private val adaptiveIconSize: Int, private val override fun updateDiskCacheKey(messageDigest: MessageDigest) { messageDigest.update(ID_BYTES) - messageDigest.update(ByteBuffer.allocate(4).putInt(adaptiveIconSize).putFloat(adaptiveIconOuterSides).array()) + messageDigest.update(ByteBuffer.allocate(8).putInt(adaptiveIconSize).putFloat(adaptiveIconOuterSides).array()) } override fun transform(pool: BitmapPool, toTransform: Bitmap, outWidth: Int, outHeight: Int): Bitmap { diff --git a/vector/src/main/java/im/vector/app/features/home/AvatarRenderer.kt b/vector/src/main/java/im/vector/app/features/home/AvatarRenderer.kt index d8a8409f5a..5b96caa3f1 100644 --- a/vector/src/main/java/im/vector/app/features/home/AvatarRenderer.kt +++ b/vector/src/main/java/im/vector/app/features/home/AvatarRenderer.kt @@ -33,6 +33,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.DrawableImageViewTarget import com.bumptech.glide.request.target.Target +import com.bumptech.glide.signature.ObjectKey import im.vector.app.core.contacts.MappedContact import im.vector.app.core.di.ActiveSessionHolder import im.vector.app.core.glide.AvatarPlaceholder @@ -171,8 +172,9 @@ class AvatarRenderer @Inject constructor(private val activeSessionHolder: Active .asBitmap() .avatarOrText(matrixItem, iconSize) .transform(CenterCrop(), AdaptiveIconTransformation(adaptiveIconSize, adaptiveIconOuterSides)) + .signature(ObjectKey("adaptive-icon")) .diskCacheStrategy(DiskCacheStrategy.RESOURCE) - .submit(adaptiveIconSize, adaptiveIconSize) + .submit(iconSize, iconSize) .get() }