avoid recycling contact images if the activity is destroyed

This commit is contained in:
tibbi 2018-01-29 18:53:35 +01:00
parent 197eb7b60c
commit 7063b9ffd2

View File

@ -13,6 +13,7 @@ import com.bumptech.glide.signature.ObjectKey
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
import com.simplemobiletools.commons.extensions.isActivityDestroyed
import com.simplemobiletools.commons.interfaces.MyAdapterListener
import com.simplemobiletools.contacts.R
import com.simplemobiletools.contacts.activities.SimpleActivity
@ -124,6 +125,8 @@ class SelectContactsAdapter(val activity: SimpleActivity, val contacts: List<Con
override fun onViewRecycled(holder: ViewHolder?) {
super.onViewRecycled(holder)
Glide.with(activity).clear(holder?.itemView?.contact_tmb!!)
if (!activity.isActivityDestroyed()) {
Glide.with(activity).clear(holder?.itemView?.contact_tmb!!)
}
}
}