An android example app using the GitHub API to display GitHub's most popular repositories based on their star count.
Note that there is no authentication setup in the app which means that the app is limited to 10 requests per minute. However, this also means that you can easily test the error handling in the app.
An MVVM/MVI architecture where the UI has ViewModel
s that observes the state of interactors and all state changes is delivered with partial states updating the interactors state object in a unidirectional way without side effects.
The app consists of three modules:
- the UI
ViewModel
s- Interactors
- Repositories
- Network services
ObjectMapper
s
- Domain model objects mapped from the network model objects.
- Network service interfaces that the
data
module implements.
There is unit tests that you can find in the app
module. It's using OkHttps
MockWebServer
that reads a copy of the GitHub API response from the resources
folder and like that you can unit test everything from ViewModel
s all the way down to the network services and this can run on a CI server without any need of an emulator or device.
All the communication between the different layers are using RxKotlin.
To talk to the REST API.
For dependency injection.
This library goes hand in hand with data binding where you pretty much never have to make your own adapters again.
It contains a HashCodeBuilder
that is very convenient to use when you wanna ensure unique ids for your adapters.