You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class ItemsDiffCallback : DefaultDiffCallback<ViewModel>() {
override fun areItemsTheSame(oldItem: ViewModel, newItem: ViewModel): Boolean {
if (oldItem is ProjectsList.Data) {
return if (newItem is ProjectsList.Data) {
oldItem.id == newItem.id
} else {
false
}
} else if (newItem is ProjectsList.Data) {
return false
}
return super.areItemsTheSame(oldItem, newItem)
}
override fun areContentsTheSame(oldItem: ViewModel, newItem: ViewModel): Boolean {
return super.areContentsTheSame(oldItem, newItem)
}
override fun getChangePayload(oldItem: ViewModel, newItem: ViewModel): Any? {
if (oldItem is ProjectsList.Data) {
if (newItem is ProjectsList.Data) {
val payload: ArrayList<Long> = ArrayList()
payload.add(System.currentTimeMillis())
return payload
}
}
val payload = super.getChangePayload(oldItem, newItem)
return payload
}
}
Inside ProjectsList.Data:
override fun equals(obj: Any?): Boolean {
if (obj is Data) {
val pm: Data = obj
return pm.id == this.id
}
return false
}
So, always when i use setItems(projectsList.data) its replace my current list by projectsList.data (items various). Собственно, how to добавить элементы в список не перезаписав текущие?
The text was updated successfully, but these errors were encountered:
Inside ProjectsList.Data:
So, always when i use
setItems(projectsList.data)
its replace my current list byprojectsList.data
(items various). Собственно, how to добавить элементы в список не перезаписав текущие?The text was updated successfully, but these errors were encountered: