I am trying to switch between the original and transformed bitmaps using Picasso. The problem is the first time the original is loaded it seems to be cached, but when I load the transformed image then it seems to reload the image again and not using the cache. The same url is used to fetch the image. It happens only the first time for the original and transformed and then the cache is used.
My expectation that Picasso should automatically reuse the original image cashed to apply the transform and reload it with no delay. Maybe I am missing something.
Here is the code of image loading.
private fun loadOriginalImage(i: Product, productImage: ImageView) {
Picasso.get().load(getProductUrl(i.id)).placeholder(R.color.light_grey)
.error(R.color.light_grey).fit().centerCrop().into(productImage)
}
private fun loadGreyedImage(i: Product, productImage: ImageView) {
Picasso.get().load(getProductUrl(i.id)).placeholder(R.color.light_grey)
.error(R.color.light_grey).fit().centerCrop().transform(GrayScaleTransform()).into(productImage)
}
Picasso version implementation 'com.squareup.picasso:picasso:2.71828'