fountain v0.4.0 Release Notes

Release Date: 2018-10-23 // over 5 years ago
  • 🚀 Released on 2018-10-23. Big Breaking changes:

    Fountain modules

    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'
    }
    

    👍 Not paged endpoint support

    👍 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.

    Factory constructors

    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 a Listing component from a common paged Retrofit service implementation.
    • createNotPagedNetworkListing: A constructor to get a Listing component from a common not paged Retrofit service implementation.
    • 👍 createNetworkWithCacheSupportListing: A constructor to get a Listing component with cache support from a common paged Retrofit service implementation.
    • 👍 createNotPagedNetworkWithCacheSupportListing: A constructor to get a Listing component with cache support from a common not paged Retrofit service implementation.

    NetworkDataSourceAdapter creators

    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.