NetworkPagingSource
Author
skydoves (Jaewoong Eum)
Since
1.0.0
NetworkPagingSource is a implementation of PagingSource that was designed to load pages of data for an instance of PagingData and to be combined with Pager. You return NetworkPagingSource for your Retrofit service method by adding PagingCallAdapterFactory to your Retrofit.Builder.
If you want to return NetworkPagingSource, you must use the PagingKeyConfig and PagingKey to your method and parameter for providing proper paging configurations to the adapter factory.
PagingData queries data from its NetworkPagingSource in response, which came from the network response as the user scrolls in a RecyclerView. To control how and when a PagingData queries data from its PagingSource, see PagingConfig, which defines behavior such as PagingConfig.pageSize and PagingConfig.prefetchDistance.
Basically, the default page key starts from the offsetPageKey that will be decided by the call value of the parameter, which is annotated with PagingKey.