From 0e0db67aef6dc5e5aa439142cb68af0d8cfb303f Mon Sep 17 00:00:00 2001 From: ganfra Date: Tue, 12 Nov 2019 20:34:19 +0100 Subject: [PATCH] Timeline: clear some resources when unbind --- .../im/vector/riotx/core/ui/views/ReadReceiptsView.kt | 9 +++++++++ .../home/room/detail/timeline/item/AbsMessageItem.kt | 1 + .../room/detail/timeline/item/MessageImageVideoItem.kt | 2 ++ 3 files changed, 12 insertions(+) diff --git a/vector/src/main/java/im/vector/riotx/core/ui/views/ReadReceiptsView.kt b/vector/src/main/java/im/vector/riotx/core/ui/views/ReadReceiptsView.kt index c74e9a4111..29b2863d02 100644 --- a/vector/src/main/java/im/vector/riotx/core/ui/views/ReadReceiptsView.kt +++ b/vector/src/main/java/im/vector/riotx/core/ui/views/ReadReceiptsView.kt @@ -23,6 +23,7 @@ import android.widget.ImageView import android.widget.LinearLayout import androidx.core.view.isVisible import im.vector.riotx.R +import im.vector.riotx.core.glide.GlideApp import im.vector.riotx.features.home.AvatarRenderer import im.vector.riotx.features.home.room.detail.timeline.item.ReadReceiptData import kotlinx.android.synthetic.main.view_read_receipts.view.* @@ -105,4 +106,12 @@ class ReadReceiptsView @JvmOverloads constructor( isVisible = false } } + + fun unbind() { + receiptAvatars.forEach { + GlideApp.with(context.applicationContext).clear(it) + } + isVisible = false + } + } diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/AbsMessageItem.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/AbsMessageItem.kt index bddee50861..2ca6bbfd37 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/AbsMessageItem.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/AbsMessageItem.kt @@ -139,6 +139,7 @@ abstract class AbsMessageItem : BaseEventItem() { override fun unbind(holder: H) { holder.readMarkerView.unbind() + holder.readReceiptsView.unbind() super.unbind(holder) } diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/MessageImageVideoItem.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/MessageImageVideoItem.kt index 928a18fe4d..457f30cbf4 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/MessageImageVideoItem.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/MessageImageVideoItem.kt @@ -24,6 +24,7 @@ import androidx.core.view.isVisible import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyModelClass import im.vector.riotx.R +import im.vector.riotx.core.glide.GlideApp import im.vector.riotx.features.home.room.detail.timeline.helper.ContentUploadStateTrackerBinder import im.vector.riotx.features.media.ImageContentRenderer @@ -60,6 +61,7 @@ abstract class MessageImageVideoItem : AbsMessageItem