ImageContentRenderer: Only animate images using ANIMATED_THUMBNAIL mode

This patch removes the dependency on `VectorSettings` as well as only
enable animated rendering if the image is actually playable.

Signed-off-by: networkException <git@nwex.de>
This commit is contained in:
networkException 2022-05-31 22:05:05 +02:00
parent dccc64384c
commit 5fede491ee
No known key found for this signature in database
GPG Key ID: C1F2658DC370C8FC
1 changed files with 1 additions and 3 deletions

View File

@ -38,7 +38,6 @@ import im.vector.app.core.glide.GlideRequest
import im.vector.app.core.glide.GlideRequests
import im.vector.app.core.ui.model.Size
import im.vector.app.core.utils.DimensionConverter
import im.vector.app.features.settings.VectorPreferences
import kotlinx.parcelize.Parcelize
import org.matrix.android.sdk.api.extensions.tryOrNull
import org.matrix.android.sdk.api.session.content.ContentUrlResolver
@ -65,7 +64,6 @@ class ImageContentRenderer @Inject constructor(
private val localFilesHelper: LocalFilesHelper,
private val activeSessionHolder: ActiveSessionHolder,
private val dimensionConverter: DimensionConverter,
private val vectorPreferences: VectorPreferences
) {
@Parcelize
@ -134,7 +132,7 @@ class ImageContentRenderer @Inject constructor(
createGlideRequest(data, mode, imageView, size)
.let {
if (vectorPreferences.autoplayAnimatedImages()) it
if (mode == Mode.ANIMATED_THUMBNAIL) it
else it.dontAnimate()
}
.transform(cornerTransformation)