Fountain Coroutines static factory
This module provides a Listing
component based on a Retrofit Coroutine adapter like this one.
Network Support Listing Creator for paged endpoints
A Listing with Network support for paged endpoints can be created invoking createNetworkListing
.
There's only one required structure, CoroutineNetworkDataSourceAdapter<out ListResponse<Value>>
, that Fountain uses to handle the paging.
In addition, there are some optional parameters that you can define:
firstPage: Int
: The initial page number, by default its value is 1.ioServiceCoroutineDispatcher : CoroutineDispatcher
: The CoroutineDispatcher that will be used to make the service call. By default, the library will use Dispatchers.IO.coroutineScope: CoroutineScope
: Define the scope where the coroutines will run.pagedListConfig: PagedList.Config
: The paged list configuration.In this object you can specify several options, for example the
pageSize
and theinitialPageSize
.
Network Support Listing Creator for not paged endpoints
A Listing with Network support for not paged endpoints can be created invoking createNotPagedNetworkListing
.
There's only one required structure, NotPagedCoroutinePageFetcher<out ListResponse<Value>>
, that Fountain uses to handle the paging.
In addition, there are some optional parameters that you can define:
ioServiceCoroutineDispatcher : CoroutineDispatcher
: The CoroutineDispatcher that will be used to make the service call. By default, the library will use Dispatchers.IO.coroutineScope: CoroutineScope
: Define the scope where the coroutines will run.
Cache + Network Support Listing Creator for paged endpoints
A Listing with Cache + Network Support for paged endpoints can be created invoking the createNetworkWithCacheSupportListing
There are two required components:
A
CoroutineNetworkDataSourceAdapter<out ListResponse<Value>>
to fetch all pages.A
CachedDataSourceAdapter<Value>
to take control of theDataSource
.
In addition, there are some optional parameters that you can define:
firstPage: Int
: The initial page number, by default its value is 1.ioServiceCoroutineDispatcher : CoroutineDispatcher
: The CoroutineDispatcher that will be used to make the service call. By default, the library will use Dispatchers.IO.ioDatabaseCoroutineDispatcher : CoroutineDispatcher
: The CoroutineDispatcher through which the database transactions will be made. By default the library will use a single thread CoroutineDispatcher.coroutineScope: CoroutineScope
: Define the scope where the coroutines will run.pagedListConfig: PagedList.Config
: The paged list configuration.In this object you can specify several options, for example the
pageSize
and theinitialPageSize
.
Cache + Network Support Listing Creator for not paged endpoints
A Listing with Cache + Network Support for not paged endpoints can be created invoking the createNotPagedNetworkWithCacheSupportListing
There are two required components:
A
NotPagedCoroutinePageFetcher<out ListResponse<Value>>
to fetch all pages.A
CachedDataSourceAdapter<Value>
to take control of theDataSource
.
In addition, there are some optional parameters that you can define:
ioServiceCoroutineDispatcher : CoroutineDispatcher
: The CoroutineDispatcher that will be used to make the service call. By default, the library will use Dispatchers.IO.ioDatabaseCoroutineDispatcher : CoroutineDispatcher
: The CoroutineDispatcher through which the database transactions will be made. By default the library will use a single thread CoroutineDispatcher.coroutineScope: CoroutineScope
: Define the scope where the coroutines will run.
Last updated