Try to fix cropped image in timeline (#2126)

This commit is contained in:
Benoit Marty 2020-11-13 16:17:27 +01:00
parent 8dff0b2c5d
commit 8ae0501c22
2 changed files with 10 additions and 3 deletions

View File

@ -12,6 +12,7 @@ Bugfix 🐛:
- Fix issue when restoring draft after sharing (#2287)
- Fix issue when updating the avatar of a room (new avatar vanishing)
- Discard change dialog displayed by mistake when avatar has been updated
- Try to fix cropped image in timeline (#2126)
Translations 🗣:
-

View File

@ -21,6 +21,7 @@ import android.net.Uri
import android.os.Parcelable
import android.view.View
import android.widget.ImageView
import androidx.core.view.updateLayoutParams
import com.bumptech.glide.load.DataSource
import com.bumptech.glide.load.engine.GlideException
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
@ -96,15 +97,17 @@ class ImageContentRenderer @Inject constructor(private val activeSessionHolder:
fun render(data: Data, mode: Mode, imageView: ImageView) {
val size = processSize(data, mode)
imageView.layoutParams.width = size.width
imageView.layoutParams.height = size.height
imageView.updateLayoutParams {
width = size.width
height = size.height
}
// a11y
imageView.contentDescription = data.filename
createGlideRequest(data, mode, imageView, size)
.dontAnimate()
.transform(RoundedCorners(dimensionConverter.dpToPx(8)))
.thumbnail(0.3f)
// .thumbnail(0.3f)
.into(imageView)
}
@ -117,6 +120,9 @@ class ImageContentRenderer @Inject constructor(private val activeSessionHolder:
}
}
/**
* Used by Attachment Viewer
*/
fun render(data: Data, contextView: View, target: CustomViewTarget<*, Drawable>) {
val req = if (data.elementToDecrypt != null) {
// Encrypted image