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