Timeline: clear some resources when unbind

This commit is contained in:
ganfra 2019-11-12 20:34:19 +01:00
parent 6dc5b126d6
commit 0e0db67aef
3 changed files with 12 additions and 0 deletions

View file

@ -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
}
}

View file

@ -139,6 +139,7 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : BaseEventItem<H>() {
override fun unbind(holder: H) {
holder.readMarkerView.unbind()
holder.readReceiptsView.unbind()
super.unbind(holder)
}

View file

@ -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<MessageImageVideoItem.Hold
}
override fun unbind(holder: Holder) {
GlideApp.with(holder.view.context.applicationContext).clear(holder.imageView)
contentUploadStateTrackerBinder.unbind(attributes.informationData.eventId)
super.unbind(holder)
}