优化
This commit is contained in:
1 parent
6b07f6974b
commit
4c8e358727
1 file changed
+5
-8
@@ -62,14 +62,11 @@ abstract class DiffRecyclerAdapter<ITEM, VB : ViewBinding>(protected val context
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun setItem(position: Int, item: ITEM) {
|
||||
withContext(Dispatchers.Default) {
|
||||
synchronized(asyncListDiffer) {
|
||||
kotlin.runCatching {
|
||||
val list = ArrayList(asyncListDiffer.currentList)
|
||||
list[position] = item
|
||||
asyncListDiffer.submitList(list)
|
||||
}
|
||||
fun setItem(position: Int, item: ITEM) {
|
||||
synchronized(asyncListDiffer) {
|
||||
kotlin.runCatching {
|
||||
asyncListDiffer.currentList[position] = item
|
||||
notifyItemChanged(position)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user