mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-01-22 06:45:30 +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 folderDrawable: Drawable
|
||||||
private lateinit var fileDrawable: Drawable
|
private lateinit var fileDrawable: Drawable
|
||||||
|
private var currentItemsHash = fileDirItems.hashCode()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
initDrawables()
|
initDrawables()
|
||||||
@ -387,10 +388,13 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateItems(newItems: MutableList<FileDirItem>) {
|
fun updateItems(newItems: MutableList<FileDirItem>) {
|
||||||
|
if (newItems.hashCode() != currentItemsHash) {
|
||||||
|
currentItemsHash = newItems.hashCode()
|
||||||
fileDirItems = newItems
|
fileDirItems = newItems
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
finishActMode()
|
finishActMode()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onViewRecycled(holder: ViewHolder?) {
|
override fun onViewRecycled(holder: ViewHolder?) {
|
||||||
super.onViewRecycled(holder)
|
super.onViewRecycled(holder)
|
||||||
|
Loading…
Reference in New Issue
Block a user