mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-25 10:55:55 +03:00
Fix picture size for non-bitmaps (i.e. GIFs) when not known a priori
Change-Id: Idcab1e3a4c99af5e51cbfc955eb5524bac3f7982
This commit is contained in:
parent
e293771dda
commit
4d4d29f049
1 changed files with 7 additions and 10 deletions
|
@ -16,7 +16,6 @@
|
|||
|
||||
package im.vector.app.features.media
|
||||
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.net.Uri
|
||||
import android.os.Parcelable
|
||||
|
@ -130,16 +129,14 @@ class ImageContentRenderer @Inject constructor(private val localFilesHelper: Loc
|
|||
}
|
||||
|
||||
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
|
||||
if (data.width == null || data.height == null || data.width == 0 || data.height == 0) {
|
||||
if (resource is BitmapDrawable) {
|
||||
val updatedData = data.copy(width = resource.intrinsicWidth, height = resource.intrinsicHeight)
|
||||
val newSize = processSize(updatedData, mode)
|
||||
imageView.updateLayoutParams {
|
||||
width = newSize.width
|
||||
height = newSize.height
|
||||
}
|
||||
onImageSizeListener?.onImageSizeUpdated(newSize.width, newSize.height)
|
||||
if (resource != null && (data.width == null || data.height == null || data.width == 0 || data.height == 0)) {
|
||||
val updatedData = data.copy(width = resource.intrinsicWidth, height = resource.intrinsicHeight)
|
||||
val newSize = processSize(updatedData, mode)
|
||||
imageView.updateLayoutParams {
|
||||
width = newSize.width
|
||||
height = newSize.height
|
||||
}
|
||||
onImageSizeListener?.onImageSizeUpdated(newSize.width, newSize.height)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue