Simple proyect to showcase clean arquitecture and and modern android development skills.
Require Android Studio 4.1
- 100% Kotlin
- Modern architecture (Clean Architecture, Model-View-ViewModel)
- Android Jetpack
- Single-activity architecture (Navigation component)
- Reactive UI
- View Binding
- Testing (Unit, UI) --> PENDING
- Static analysis tools
- Material design
Min API level is set to 21
- Tech-stack
- Kotlin + Coroutines - perform background operations
- Retrofit - networking
- Jetpack
- Navigation - deal with whole in-app navigation
- LiveData - notify views about database change
- Room - deal with SQLite database interactions
- ViewModel - store and manage UI-related data in a lifecycle conscious way
- Architecture
- Clean Architecture
- MVVM (presentation layer)
- Android Architecture components (ViewModel, LiveData, Navigation, SafeArgs plugin)
- Tests - Pending (Next)
- Gradle
This layer is closest to what the user sees on the screen. The app
layer uses MVVM
using ViewModel
to preserve data on configuration changes)
App layer depends on Domain and Data layers.
Components:
- Views (Fragment) - presents data on the screen and pass user interactions to View Model
- ViewModel - dispatches (through
LiveData
) state changes to the view and deals with user interactions - ViewState - common state for a single view
This is the core layer of the application. Notice that the domain
layer is independent of any other layers. This allows to make domain models and business logic independent from other layers.
Components:
- UseCase - contains business logic
- DomainModel - defines the core structure of the data that will be used within the application
- Repository interface - required to keep the
domain
layer independent from thedata layer
Manages application data and exposes these data sources as repositories to the domain
layer. Used to retrieve data from the internet using retrofit and caching this data locally in a SQLite database using room.
Data layer depends only on Domain, implementing interfaces domain layer exposes.
Components:
- Repository - Handles data and exposes it to the
domain
layer. - Mapper - maps
data model
todomain model
(to keepdomain
layer independent from thedata
layer). Here mappers are implemented as functions in Model classes. - RetrofitService - defines a set of API endpoints.
- DataModel - defines the structure of the data retrieved from the network or databases and contains annotations
To open this project follow any of the next steps:
- Android Studio -> File -> New -> From Version control -> Git
- Enter
https://github.com/gonzaloguzzardi/android-clean-arquitecture.git
into URL field
- Run
git clone https://github.com/gonzaloguzzardi/android-clean-arquitecture.git
- Android Studio -> File -> Open