diff --git a/core-app/src/main/java/com/one/coreapp/ui/base/adapters/BaseAsyncAdapter.kt b/core-app/src/main/java/com/one/coreapp/ui/base/adapters/BaseAsyncAdapter.kt index 136db72d..ab0e10a6 100644 --- a/core-app/src/main/java/com/one/coreapp/ui/base/adapters/BaseAsyncAdapter.kt +++ b/core-app/src/main/java/com/one/coreapp/ui/base/adapters/BaseAsyncAdapter.kt @@ -6,7 +6,6 @@ import androidx.annotation.Keep import androidx.recyclerview.widget.* import androidx.viewbinding.ViewBinding import com.one.coreapp.App -import com.one.coreapp.TRANSITION abstract class BaseAsyncAdapter( itemCallback: DiffUtil.ItemCallback? = null, @@ -100,11 +99,23 @@ class BaseBindingViewHolder(val binding: B, val viewType: Int) class DefaultItemCallback : DiffUtil.ItemCallback() { override fun areItemsTheSame(oldItem: T, newItem: T): Boolean { + return oldItem.areItemsTheSame() == newItem.areItemsTheSame() } override fun areContentsTheSame(oldItem: T, newItem: T): Boolean { - return false + + val payloads = ArrayList() + + val oldItemCompare = oldItem.getContentsCompare() + val newItemCompare = newItem.getContentsCompare() + + oldItemCompare.forEachIndexed { index, pair -> + + if (pair.first != newItemCompare.getOrNull(index)?.first) payloads.add(pair.second) + } + + return payloads.isEmpty() } override fun getChangePayload(oldItem: T, newItem: T): Any? {