From 0eb0870d6c7542ce493d18fa92159491a6fa06c8 Mon Sep 17 00:00:00 2001 From: ganfra Date: Thu, 19 Dec 2019 18:29:46 +0100 Subject: [PATCH] AvatarRenderer: allow to pass GlideRequests too (fix home group avatar) --- .../java/im/vector/riotx/features/home/AvatarRenderer.kt | 8 ++++++++ .../im/vector/riotx/features/home/HomeDetailFragment.kt | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/riotx/features/home/AvatarRenderer.kt b/vector/src/main/java/im/vector/riotx/features/home/AvatarRenderer.kt index 4e1808a48a..b7c3e61ee4 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/AvatarRenderer.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/AvatarRenderer.kt @@ -52,6 +52,14 @@ class AvatarRenderer @Inject constructor(private val activeSessionHolder: Active DrawableImageViewTarget(imageView)) } + @UiThread + fun render(matrixItem: MatrixItem, imageView: ImageView, glideRequests: GlideRequests) { + render(imageView.context, + glideRequests, + matrixItem, + DrawableImageViewTarget(imageView)) + } + @UiThread fun render(context: Context, glideRequest: GlideRequests, diff --git a/vector/src/main/java/im/vector/riotx/features/home/HomeDetailFragment.kt b/vector/src/main/java/im/vector/riotx/features/home/HomeDetailFragment.kt index fc0eeaf92c..b9d3e3c95e 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/HomeDetailFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/HomeDetailFragment.kt @@ -30,6 +30,7 @@ import im.vector.matrix.android.api.session.group.model.GroupSummary import im.vector.matrix.android.api.util.toMatrixItem import im.vector.riotx.R import im.vector.riotx.core.extensions.commitTransactionNow +import im.vector.riotx.core.glide.GlideApp import im.vector.riotx.core.platform.ToolbarConfigurable import im.vector.riotx.core.platform.VectorBaseFragment import im.vector.riotx.core.ui.views.KeysBackupBanner @@ -75,7 +76,8 @@ class HomeDetailFragment @Inject constructor( private fun onGroupChange(groupSummary: GroupSummary?) { groupSummary?.let { - avatarRenderer.render(it.toMatrixItem(), groupToolbarAvatarImageView) + // Use GlideApp with activity context to avoid the glideRequests to be paused + avatarRenderer.render(it.toMatrixItem(), groupToolbarAvatarImageView, GlideApp.with(requireActivity())) } }