From a11d70f173f1f62b3f9f1e7f4428b4ccd0ff33c5 Mon Sep 17 00:00:00 2001 From: onurays Date: Fri, 21 Feb 2020 00:51:22 +0300 Subject: [PATCH 1/2] Use exif info of the image for correct rotation. --- CHANGES.md | 1 + .../vector/riotx/features/media/ImageContentRenderer.kt | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index b402dc0522..29ccfb29fc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,6 +15,7 @@ Bugfix 🐛: - Account creation: wrongly hints that an email can be used to create an account (#941) - Fix crash in the room directory, when public room has no name (#1023) - Fix restoring keys backup with passphrase (#526) + - Fix rotation of full-size image (#647) Translations 🗣: - diff --git a/vector/src/main/java/im/vector/riotx/features/media/ImageContentRenderer.kt b/vector/src/main/java/im/vector/riotx/features/media/ImageContentRenderer.kt index 909fd5b8eb..cbdb19d132 100644 --- a/vector/src/main/java/im/vector/riotx/features/media/ImageContentRenderer.kt +++ b/vector/src/main/java/im/vector/riotx/features/media/ImageContentRenderer.kt @@ -25,6 +25,7 @@ import com.bumptech.glide.load.engine.GlideException import com.bumptech.glide.load.resource.bitmap.RoundedCorners import com.bumptech.glide.request.RequestListener import com.bumptech.glide.request.target.Target +import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.ORIENTATION_USE_EXIF import com.github.piasy.biv.view.BigImageView import im.vector.matrix.android.api.session.content.ContentUrlResolver import im.vector.matrix.android.internal.crypto.attachments.ElementToDecrypt @@ -36,6 +37,7 @@ import im.vector.riotx.core.utils.DimensionConverter import im.vector.riotx.core.utils.isLocalFile import kotlinx.android.parcel.Parcelize import timber.log.Timber +import java.io.File import javax.inject.Inject import kotlin.math.min @@ -142,6 +144,13 @@ class ImageContentRenderer @Inject constructor(private val activeSessionHolder: return } + imageView.setImageLoaderCallback(object: DefaultImageLoaderCallback { + override fun onSuccess(image: File?) { + super.onSuccess(image) + imageView.ssiv.orientation = ORIENTATION_USE_EXIF + } + }) + imageView.showImage( Uri.parse(thumbnail), Uri.parse(fullSize) From b3d4747d97ba85d08339567ac16b1f76c8ee2bec Mon Sep 17 00:00:00 2001 From: onurays Date: Mon, 24 Feb 2020 17:35:57 +0300 Subject: [PATCH 2/2] Code review fixes. --- .../java/im/vector/riotx/features/media/ImageContentRenderer.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/vector/src/main/java/im/vector/riotx/features/media/ImageContentRenderer.kt b/vector/src/main/java/im/vector/riotx/features/media/ImageContentRenderer.kt index cbdb19d132..d11af4f350 100644 --- a/vector/src/main/java/im/vector/riotx/features/media/ImageContentRenderer.kt +++ b/vector/src/main/java/im/vector/riotx/features/media/ImageContentRenderer.kt @@ -146,7 +146,6 @@ class ImageContentRenderer @Inject constructor(private val activeSessionHolder: imageView.setImageLoaderCallback(object: DefaultImageLoaderCallback { override fun onSuccess(image: File?) { - super.onSuccess(image) imageView.ssiv.orientation = ORIENTATION_USE_EXIF } })