From c506786d1a8700d6e9d88a3de2ec707d4203c149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manne=20=C3=96hlund?= Date: Tue, 6 Oct 2020 13:04:27 +0200 Subject: [PATCH] Update migration guide --- MIGRATION.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/MIGRATION.md b/MIGRATION.md index d3f3536..4625f33 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -165,6 +165,42 @@ open class SimpleItemViewHolder(parentView: ViewGroup) : SmartViewHolder( }) ``` +## Diff util + +#### NEW v5.0.0 + +With smart-recycler-adapter-diffutil extension library + +```groovy +dependencies { + implementation 'io.github.manneohlund:smart-recycler-adapter-diffutil:X.Y.Z' +} +``` + +No `DiffUtilExtensionBuilder` needed anymore. + +```kotlin +SmartRecyclerAdapter + .items(items) + .map(Integer::class, SimpleItemViewHolder::class) + .add(SimpleDiffUtilExtension(predicate)) + .into(recyclerView) +``` + +#### OLD 4.X.X + +```kotlin +val adapter = SmartRecyclerAdapter + .items(items) + .map(Integer::class, SimpleItemViewHolder::class) + .into(recyclerView) + +diffUtilExtension = DiffUtilExtensionBuilder().apply { + smartRecyclerAdapter = adapter + diffPredicate = predicate +}.build() +``` + # 4.X.X & 3.X.X ### ViewEvent Migration