mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-01-05 21:38:33 +01:00
refresh items only if they changed
This commit is contained in:
parent
f4f2a2ccbb
commit
25e4564b1e
@ -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?) {
|
||||
|
Loading…
Reference in New Issue
Block a user