stop loading thumbnails of recycled views

This commit is contained in:
tibbi 2017-03-18 17:34:47 +01:00
parent 7b175c2e0d
commit 2f3695c753
1 changed files with 10 additions and 1 deletions

View File

@ -204,9 +204,14 @@ class ItemsAdapter(val activity: SimpleActivity, var mItems: MutableList<FileDir
views.add(holder.bindView(multiSelectorMode, multiSelector, mItems[position], position))
}
override fun onViewRecycled(holder: ViewHolder?) {
super.onViewRecycled(holder)
holder?.stopLoad()
}
override fun getItemCount() = mItems.size
class ViewHolder(val activity: SimpleActivity, view: View, val itemClick: (FileDirItem) -> (Unit)) : SwappingHolder(view, MultiSelector()) {
class ViewHolder(val activity: SimpleActivity, val view: View, val itemClick: (FileDirItem) -> (Unit)) : SwappingHolder(view, MultiSelector()) {
fun bindView(multiSelectorCallback: ModalMultiSelectorCallback, multiSelector: MultiSelector, fileDirItem: FileDirItem, pos: Int): View {
itemView.apply {
item_name.text = fileDirItem.name
@ -263,6 +268,10 @@ class ItemsAdapter(val activity: SimpleActivity, var mItems: MutableList<FileDir
itemClick(fileDirItem)
}
}
fun stopLoad() {
Glide.clear(view.item_icon)
}
}
interface ItemOperationsListener {