Fixed
Status Update
Comments
cc...@google.com <cc...@google.com> #2
See also related
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 86445f1b2ea2494f49ae2fee118c878ba510c568
Author: Dustin Lam <dustinlam@google.com>
Date: Mon Dec 28 15:21:36 2020
Make terminal separator behavior configurable
Adds an enum allowing a choice between waiting for both PagingSource and
RemoteMediator to resolve, or to simply await for PagingSource to
resolve allowing the use-case where initial load can immediately prepend
a header without requiring the user to scroll to see it even when using
RemoteMediator.
Relnote: "Allow configuration of terminal separator (header / footer)
behavior with an additional optional SeparatorType parameter. The two
options are:
* FULLY_COMPLETE - existing behavior; wait for both PagingSource and
RemoteMediator to mark endOfPaginationReached before adding terminal
separators. If RemoteMediator is not used, remote loadState is
ignored. This is primarily useful if you only want to show section
separators when the section is fully loaded, including fetching from
remote source e.g., network.
* SOURCE_COMPLETE - only wait for PagingSource to mark
endOfPaginationReached even if RemoteMediator is used. This allows
headers and footers to be presented synchronously with the initial
load, which prevents users from needing to scroll to see terminal
separators."
Test: ./gradlew paging:paging-common:test
Fixes: 174700218
Change-Id: Ibe9938d069e66d0deae806dc44684f3a05e651a0
M paging/common/api/current.txt
M paging/common/api/public_plus_experimental_current.txt
M paging/common/api/restricted_current.txt
M paging/common/src/main/kotlin/androidx/paging/PagingDataTransforms.kt
M paging/common/src/main/kotlin/androidx/paging/Separators.kt
M paging/common/src/test/kotlin/androidx/paging/HeaderFooterTest.kt
M paging/common/src/test/kotlin/androidx/paging/SeparatorsTest.kt
M paging/common/src/test/kotlin/androidx/paging/SeparatorsWithRemoteMediatorTest.kt
M paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/V3ViewModel.kt
M paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3room/V3RoomViewModel.kt
https://android-review.googlesource.com/1537142
Branch: androidx-main
commit 86445f1b2ea2494f49ae2fee118c878ba510c568
Author: Dustin Lam <dustinlam@google.com>
Date: Mon Dec 28 15:21:36 2020
Make terminal separator behavior configurable
Adds an enum allowing a choice between waiting for both PagingSource and
RemoteMediator to resolve, or to simply await for PagingSource to
resolve allowing the use-case where initial load can immediately prepend
a header without requiring the user to scroll to see it even when using
RemoteMediator.
Relnote: "Allow configuration of terminal separator (header / footer)
behavior with an additional optional SeparatorType parameter. The two
options are:
* FULLY_COMPLETE - existing behavior; wait for both PagingSource and
RemoteMediator to mark endOfPaginationReached before adding terminal
separators. If RemoteMediator is not used, remote loadState is
ignored. This is primarily useful if you only want to show section
separators when the section is fully loaded, including fetching from
remote source e.g., network.
* SOURCE_COMPLETE - only wait for PagingSource to mark
endOfPaginationReached even if RemoteMediator is used. This allows
headers and footers to be presented synchronously with the initial
load, which prevents users from needing to scroll to see terminal
separators."
Test: ./gradlew paging:paging-common:test
Fixes: 174700218
Change-Id: Ibe9938d069e66d0deae806dc44684f3a05e651a0
M paging/common/api/current.txt
M paging/common/api/public_plus_experimental_current.txt
M paging/common/api/restricted_current.txt
M paging/common/src/main/kotlin/androidx/paging/PagingDataTransforms.kt
M paging/common/src/main/kotlin/androidx/paging/Separators.kt
M paging/common/src/test/kotlin/androidx/paging/HeaderFooterTest.kt
M paging/common/src/test/kotlin/androidx/paging/SeparatorsTest.kt
M paging/common/src/test/kotlin/androidx/paging/SeparatorsWithRemoteMediatorTest.kt
M paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/V3ViewModel.kt
M paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3room/V3RoomViewModel.kt
Description
It is sometimes desirable to show the header / footer before all items have loaded or before remote has returned.
We should think about how we can make this configurable, perhaps through an additional param into PagingData.insertSeparators().