blob: 40e6e9ca45409eb9932008676221ef8f99e4c4e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
package mx.trackermap.TrackerMap.android.devices
import androidx.recyclerview.widget.DiffUtil
import mx.trackermap.TrackerMap.client.models.UnitInformation
class DevicesDiffCallback(
private val oldList: List<UnitInformation>,
private val newList: List<UnitInformation>
): DiffUtil.Callback() {
override fun getOldListSize() = oldList.size
override fun getNewListSize() = newList.size
override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int) =
oldList[oldItemPosition].device.id == newList[newItemPosition].device.id
override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int) =
(oldList[oldItemPosition].position?.id == newList[newItemPosition].position?.id) && newItemPosition != 0
}
|