Example Android project in Kotlin which uses the https://www.metaweather.com/ api.
- Android Jetpack
- MVVM architecture
- AndroidX
- Dagger 2
- Kotlin
- Coroutines
- Retrofit
- Glide
- Lint
- Ktlint
- LeakCanary
- Unit tests (JUnit, Truth, etc.)
MetaWeather is a single-Activity Android application which uses MVVM architecture:
Each layer in the architecture is loosely coupled, mostly with interfaces. The solution is extendable, well-maintainable, and also testable by isolating the different layers/components. The architecture tries to follow the most-used clean code and SOLID principles together with some design patterns like Singleton, Factory, and Dependency Injection.
The application uses two different data sources: local and remote. The application communicates with the remote data source via RESTful API with a Retrofit HTTP client. The local data source is an SQLite database implemented with Room. The application uses the local data source as a source of truth, always. If the local data is outdated, it's going to be updated before showing it. It's also possible to force to update the local data from the remote source by using the pull-to-refresh gesture.
The project contains an example for unit testing. It's also possible to test the different components either with unit or instrumented (or even end-to-end Espresso) tests in the future.
The project can be compiled by running the build-project.sh
file.