Buffer / conflate last hint sent to hintChannel across generations
Provides an initial value to new generations of Pager based on the last
hint, to allow new generations to fulfill prefetchDistance after REFRESH
Improves the use case where a developer implements getRefreshKey
in a way that returns the same list after invalidate, which would cause
a user who has already scrolled to an end of a list to be unable to scroll
further in that direction.
Conflation is handled within AsyncPagedDataDiffer, which has access to
DiffResult returned by DiffUtil, so it can map ViewportHints across
generations.
Fixes: 147155784
Test: ./gradlew paging:paging-runtime:test
Change-Id: Ic16116a64cbee1667b5fbc54ce74e37949628edf
diff --git a/testutils/testutils-ktx/build.gradle b/testutils/testutils-ktx/build.gradle
index bf332d5..39fbde1 100644
--- a/testutils/testutils-ktx/build.gradle
+++ b/testutils/testutils-ktx/build.gradle
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
import static androidx.build.dependencies.DependenciesKt.*
plugins {
@@ -24,8 +27,17 @@
dependencies {
api(KOTLIN_STDLIB)
api(KOTLIN_COROUTINES_CORE)
+ api(KOTLIN_COROUTINES_TEST)
+ api(JUNIT)
}
androidx {
toolingProject = true
}
+
+// Allow usage of Kotlin's @Experimental annotation, which is itself experimental.
+tasks.withType(KotlinCompile).configureEach {
+ kotlinOptions {
+ freeCompilerArgs += ["-Xuse-experimental=kotlin.Experimental"]
+ }
+}