Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 21534897538717811f9b0da9926e13e63b664911
Author: Dustin Lam <dustinlam@google.com>
Date: Fri Nov 05 16:27:51 2021
Add LoadStates arguments to static PagingData constructors
Implmented as a separate event to enforce non-null LoadStates in
PageEvent.Insert. We can simply check if sourceLoadStates is `null`
to see if we should dispatch LoadStates, as if LoadStates are provided,
sourceLoadStates is always required to be non-null.
Test: ./gradlew paging:paging-common:test
Relnote: "By default, PagingData.from() and PagingData.empty() will no
longer affect CombinedLoadStates on the presenter side. A new overload
that allows passing sourceLoadStates and remoteLoadStates in to these
constructors has been added to maintain the existing behavior of setting
LoadStates to be fully terminal (i.e., NotLoading(endOfPaginationReached
= false)), with the option to include remote states as well if needed.
If LoadStates are not passed, then the previous CombinedLoadStates
will be maintained on the presenter side when it receives the static
PagingData."
Fixes: 205344028
Change-Id: Ic3ce54f8984e2f1d76b3f3e3412b3e41a837f1db
M paging/paging-common/api/restricted_current.txt
M paging/paging-common/api/public_plus_experimental_current.txt
M paging/paging-common/src/test/kotlin/androidx/paging/FlattenedPageEventStorageTest.kt
M paging/paging-runtime/src/androidTest/java/androidx/paging/AsyncPagingDataDifferTest.kt
M paging/paging-common/src/main/kotlin/androidx/paging/PageFetcher.kt
M paging/paging-common/src/test/kotlin/androidx/paging/PagingDataDifferTest.kt
M paging/paging-common/src/main/kotlin/androidx/paging/PagePresenter.kt
M paging/paging-common/api/current.txt
M paging/paging-common/src/main/kotlin/androidx/paging/LegacyPagingSource.kt
M paging/paging-common/src/main/kotlin/androidx/paging/Separators.kt
M paging/paging-common/src/main/kotlin/androidx/paging/PageEvent.kt
M paging/paging-common/src/test/kotlin/androidx/paging/PageEventTest.kt
M paging/paging-common/src/test/kotlin/androidx/paging/ProcessPageEventCallbackCapture.kt
M paging/paging-common/src/test/kotlin/androidx/paging/TestUtils.kt
M paging/paging-common/src/test/kotlin/androidx/paging/ContiguousPagedListTest.kt
M paging/paging-common/src/main/kotlin/androidx/paging/PagingDataDiffer.kt
M paging/paging-common/src/main/kotlin/androidx/paging/PagingData.kt
A paging/paging-common/src/main/kotlin/androidx/paging/internal/Constants.kt
https://android-review.googlesource.com/1883552
Branch: androidx-main
commit 21534897538717811f9b0da9926e13e63b664911
Author: Dustin Lam <dustinlam@google.com>
Date: Fri Nov 05 16:27:51 2021
Add LoadStates arguments to static PagingData constructors
Implmented as a separate event to enforce non-null LoadStates in
PageEvent.Insert. We can simply check if sourceLoadStates is `null`
to see if we should dispatch LoadStates, as if LoadStates are provided,
sourceLoadStates is always required to be non-null.
Test: ./gradlew paging:paging-common:test
Relnote: "By default, PagingData.from() and PagingData.empty() will no
longer affect CombinedLoadStates on the presenter side. A new overload
that allows passing sourceLoadStates and remoteLoadStates in to these
constructors has been added to maintain the existing behavior of setting
LoadStates to be fully terminal (i.e., NotLoading(endOfPaginationReached
= false)), with the option to include remote states as well if needed.
If LoadStates are not passed, then the previous CombinedLoadStates
will be maintained on the presenter side when it receives the static
PagingData."
Fixes: 205344028
Change-Id: Ic3ce54f8984e2f1d76b3f3e3412b3e41a837f1db
M paging/paging-common/api/restricted_current.txt
M paging/paging-common/api/public_plus_experimental_current.txt
M paging/paging-common/src/test/kotlin/androidx/paging/FlattenedPageEventStorageTest.kt
M paging/paging-runtime/src/androidTest/java/androidx/paging/AsyncPagingDataDifferTest.kt
M paging/paging-common/src/main/kotlin/androidx/paging/PageFetcher.kt
M paging/paging-common/src/test/kotlin/androidx/paging/PagingDataDifferTest.kt
M paging/paging-common/src/main/kotlin/androidx/paging/PagePresenter.kt
M paging/paging-common/api/current.txt
M paging/paging-common/src/main/kotlin/androidx/paging/LegacyPagingSource.kt
M paging/paging-common/src/main/kotlin/androidx/paging/Separators.kt
M paging/paging-common/src/main/kotlin/androidx/paging/PageEvent.kt
M paging/paging-common/src/test/kotlin/androidx/paging/PageEventTest.kt
M paging/paging-common/src/test/kotlin/androidx/paging/ProcessPageEventCallbackCapture.kt
M paging/paging-common/src/test/kotlin/androidx/paging/TestUtils.kt
M paging/paging-common/src/test/kotlin/androidx/paging/ContiguousPagedListTest.kt
M paging/paging-common/src/main/kotlin/androidx/paging/PagingDataDiffer.kt
M paging/paging-common/src/main/kotlin/androidx/paging/PagingData.kt
A paging/paging-common/src/main/kotlin/androidx/paging/internal/Constants.kt
Description
Currently, there's no way to prevent the static PagingData constructors,
PagingData.from(List)
andPagingData.empty()
from interfering with LoadState.Ideally it would accept an argument to pass through a specific state, and if
null
, is ignored for LoadState updates.