Add LoadResult.Invalid support for Paging2 This change adds LoadResult.Invalid support for Paging2 leveraging PagingSource, such as LivePagedList and RxPagedList. In the event of a PagingSource returning LoadResult.Invalid to its PagedList, paging will detach the PagedList to stop attempts to load on this PagedList and invalidate the PagingSource. If no initial page is provided to PagedList.Builder and the initial load fails with a LoadResult.Invalid, an IllegalStateException will be thrown. To use a PagingSource that supports invalidation, use a PagedList builder that accepts a factory method for PagingSource or DataSource.Factory such as LivePagedList. Bug: 192013267 Test: ./gradlew :paging:paging-common:test Test: ./gradlew :paging:paging-runtime:cC Test: ./gradlew :paging:paging-rxjava2:test Test: ./gradlew :paging:paging-rxjava3:test Change-Id: I97de7e67cc5fe01b2c5c5a8e13bd1926c5ca2cde
diff --git a/paging/rxjava3/build.gradle b/paging/rxjava3/build.gradle index 5b5bf91..5755ccd 100644 --- a/paging/rxjava3/build.gradle +++ b/paging/rxjava3/build.gradle
@@ -33,9 +33,11 @@ testImplementation(project(":internal-testutils-common")) testImplementation(project(":internal-testutils-paging")) + testImplementation(project(":internal-testutils-ktx")) testImplementation(libs.junit) testImplementation(libs.kotlinTest) testImplementation(libs.kotlinCoroutinesTest) + testImplementation(libs.truth) androidTestImplementation(libs.testExtJunit) androidTestImplementation(libs.testCore)