I am using glide in my project to show the images in recycler view. The image will be downloaded from the server until I will show a very low resolution blurred image. The blurred image is a base 64 encoded image which will converted to byteArray to show in glide.
My problem is each time when notifydatasetchanged()
function is called the base 64 decoded image blinks. How to avoid this strange behaviour?
I am loading images from the local storage as File in the same recycler view, but there is no blinking problem when notifydatasetchanged()
called.
Only for the blurred image (base 64 decoded bitmap) blinking issue occurs
I am using glide version: 4.8.0
//converting string to byteArray
byte[] blurImg = getBlurImageBitmap(fileDataTable.get("blurimg") as String)
//function which converts the image string to byteArray
fun getBlurImageBitmap(blurImageString : String) : ByteArray {
val decodedBytes = Base64.decode(blurImageString, android.util.Base64.DEFAULT)
return decodedBytes
}
//loading the byteArray into glide
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
Glide.with(imageMessage.context)
.load(chatMessage.fileData.blurImg)
.transition(DrawableTransitionOptions.withCrossFade(1))
.into(imageMessage)
}
I want to avoid the blinking of base 64 images in glide.