All notable changes to this project will be documented in this file.
Released on 2018-11-16.
- Upgrade kotlin version to 1.3 and coroutines version to 1.0.1.
- Upgrade Android target version to 28
Released on 2018-10-23. Big Breaking changes:
The library now has 3 different modules:
- Coroutine module: Uses a Coroutine Retrofit adapter to fetch the pages.
- Retrofit module: Uses a simple Retrofit call to fetch the pages.
- RxJava2 module: Uses a RxJava2 Retrofit adapter to fetch the pages.
These modules are independent and none of them are strictly required. The new dependencies are:
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
// This dependency is required only if you want to use a Retrofit service without a special adapter.
implementation 'com.github.xmartlabs.fountain:fountain-retrofit:0.4.0'
// This dependency is required only if you want to use a Coroutine retrofit adapter.
implementation 'com.github.xmartlabs.fountain:fountain-coroutines:0.4.0'
// This dependency is required only if you want to use a RxJava2 retrofit adapter.
implementation 'com.github.xmartlabs.fountain:fountain-rx2:0.4.0'
}
Although Fountain was designed to work with paged endpoints, it also supports working with not paged endpoints. That means that you can use all [Listing] features in services that return a list that's not paged.
There's one static factory object class for each each dependency.
- FountainCoroutines: Used to get a [Listing] from a Retrofit service which uses a Coroutine adapter.
- FountainRetrofit: Used to get a [Listing] from a Retrofit service without using a special adapter.
- FountainRx: Used to get a [Listing] from a Retrofit service which uses a RxJava2 adapter.
Each static factory has the same constructors with different params:
createNetworkListing
: A constructor to get aListing
component from a common paged Retrofit service implementation.createNotPagedNetworkListing
: A constructor to get aListing
component from a common not paged Retrofit service implementation.createNetworkWithCacheSupportListing
: A constructor to get aListing
component with cache support from a common paged Retrofit service implementation.createNotPagedNetworkWithCacheSupportListing
: A constructor to get aListing
component with cache support from a common not paged Retrofit service implementation.
If you use either ListResponseWithPageCount
or ListResponseWithEntityCount
you can convert a PageFetcher
to a NetworkDataSourceAdapter
using these extensions:
fun <ServiceResponse : ListResponseWithEntityCount<*>>
PageFetcher<ServiceResponse>.toTotalEntityCountNetworkDataSourceAdapter(firstPage: Int)
fun <ServiceResponse : ListResponseWithPageCount<*>>
PageFetcher<ServiceResponse>.toTotalPageCountNetworkDataSourceAdapter(firstPage: Int)
To more about these changes you can read the full documentation here.
Released on 2018-09-12.
- Improve
NetworkState
structure #28. Now that structure has the requestedpage
number,pageSize
,isFirstPage
,isLastPage
.
Breaking changes:
The NetworkState
data class is replaced by a sealed class
and the Status
enum was removed.
Released on 2018-07-23.
- Added the possibility of using different models on Network and DataSource sources.
Fountain.createNetworkWithCacheSupportListing
now requires two type declarations #28. - Fix issue when the initialization process throws an Exception #29.
Released on 2018-07-05. This is the initial version.