aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.idea/codeStyles/codeStyleConfig.xml4
-rw-r--r--fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/SingleFastAdapter.kt13
2 files changed, 13 insertions, 4 deletions
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
index 0f7bc51..a55e7a1 100644
--- a/.idea/codeStyles/codeStyleConfig.xml
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -1,5 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
- <option name="USE_PER_PROJECT_SETTINGS" value="true" />
+ <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
-</component>
+</component> \ No newline at end of file
diff --git a/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/SingleFastAdapter.kt b/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/SingleFastAdapter.kt
index e183bde..ebb8048 100644
--- a/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/SingleFastAdapter.kt
+++ b/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/SingleFastAdapter.kt
@@ -20,6 +20,7 @@ import com.mikepenz.fastadapter.GenericItem
import com.mikepenz.fastadapter.IAdapter
import com.mikepenz.fastadapter.IItemAdapter
import com.mikepenz.fastadapter.adapters.ItemAdapter
+import com.mikepenz.fastadapter.diff.DiffCallback
import com.mikepenz.fastadapter.diff.FastAdapterDiffUtil
/**
@@ -51,7 +52,15 @@ class SingleFastAdapter private constructor(val adapter: ItemAdapter<GenericItem
throw IllegalStateException("SingleFastAdapter only allows one adapter.")
}
- fun setWithDiff(items: List<GenericItem>, detectMoves: Boolean = true) {
- FastAdapterDiffUtil.set(adapter, items, detectMoves)
+ fun setWithDiff(
+ items: List<GenericItem>,
+ detectMoves: Boolean = true,
+ callback: DiffCallback<GenericItem>? = null
+ ) {
+ if (callback == null) {
+ FastAdapterDiffUtil.set(adapter, items, detectMoves)
+ } else {
+ FastAdapterDiffUtil.set(adapter, items, callback, detectMoves)
+ }
}
}