fixing wrong shortcut icon size and ensuring the transformed files are stored with unique keys

This commit is contained in:
Adam Brown 2022-02-21 17:54:05 +00:00
parent 5bbb3f28b1
commit 506690a897
2 changed files with 4 additions and 2 deletions

View File

@ -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 {

View File

@ -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()
}