refresh items only if they changed

This commit is contained in:
tibbi 2018-02-17 11:35:01 +01:00
parent f4f2a2ccbb
commit 25e4564b1e

View file

@ -42,6 +42,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
private lateinit var folderDrawable: Drawable
private lateinit var fileDrawable: Drawable
private var currentItemsHash = fileDirItems.hashCode()
init {
initDrawables()
@ -387,9 +388,12 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
}
fun updateItems(newItems: MutableList<FileDirItem>) {
fileDirItems = newItems
notifyDataSetChanged()
finishActMode()
if (newItems.hashCode() != currentItemsHash) {
currentItemsHash = newItems.hashCode()
fileDirItems = newItems
notifyDataSetChanged()
finishActMode()
}
}
override fun onViewRecycled(holder: ViewHolder?) {