From 194f1862c618a00a14d553655ab9c3391c5d8f43 Mon Sep 17 00:00:00 2001 From: Georgy Turev Date: Thu, 29 Apr 2021 20:06:15 +0500 Subject: [PATCH] Add recyclerview submit with callback + up version --- recyclerview-adapters/build.gradle | 2 +- .../adapters/DelegationListAdapter.kt | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/recyclerview-adapters/build.gradle b/recyclerview-adapters/build.gradle index 8b8971b..f52284b 100644 --- a/recyclerview-adapters/build.gradle +++ b/recyclerview-adapters/build.gradle @@ -10,7 +10,7 @@ dependencies { constraints { implementation("androidx.recyclerview:recyclerview") { version { - require '1.0.0' + require '1.1.0' } } implementation("androidx.core:core-ktx") { diff --git a/recyclerview-adapters/src/main/java/ru/touchin/roboswag/recyclerview_adapters/adapters/DelegationListAdapter.kt b/recyclerview-adapters/src/main/java/ru/touchin/roboswag/recyclerview_adapters/adapters/DelegationListAdapter.kt index 32824ed..2320911 100644 --- a/recyclerview-adapters/src/main/java/ru/touchin/roboswag/recyclerview_adapters/adapters/DelegationListAdapter.kt +++ b/recyclerview-adapters/src/main/java/ru/touchin/roboswag/recyclerview_adapters/adapters/DelegationListAdapter.kt @@ -71,6 +71,19 @@ open class DelegationListAdapter(config: AsyncDifferConfig) : Recy */ fun submitList(list: List?) = differ.submitList(list) + /** + * Submits a new list to be diffed, and displayed. + * + * The commit callback can be used to know when the List is committed, but note that it + * may not be executed. If List B is submitted immediately after List A, and is + * committed directly, the callback associated with List A will not be run. + * + * @param newList The new List. + * @param commitCallback Optional runnable that is executed when the List is committed, if + * it is committed. + */ + fun submitList(list: List?, commitCallback: (() -> Unit)?) = differ.submitList(list, commitCallback) + /** * Same as [submitList] with fast simple remove all items of a previous list */