PrintfulTechnicalTask is an Android application that uses an retrofit to fetch data from a web through an API and displays the data as a list. This application makes use of the Unsplash API.
This project makes use of the following tools and solutions:
- 100% Kotlin
- Modern architecture (Clean Architecture, Model-View-ViewModel)
- Android Jetpack
- A single-activity architecture ( using the Navigation component to manage Fragment operations.)
- Pagination
- Dependency Injection
- Material design
Minimum API level is set to 22, so the presented approach is suitable for over 92.3% of devices running Android as at the time of writing this.
-
Tech-stack
-
Kotlin + Coroutines - perform background operations
-
Hilt - dependency injection
-
Retrofit - networking
-
- Navigation - deal with whole in-app navigation
- LiveData - notify views about database change
- Lifecycle - perform an action when lifecycle state changes
- ViewModel - store and manage UI-related data in a lifecycle conscious way
- View Binding - a feature that allows you to more easily write code that interacts with views
-
-
Architecture
- Clean Architecture (at module level)
- MVVM (presentation layer)
- Android Architecture components (ViewModel, LiveData, Navigation, SafeArgs plugin)
-
Gradle
- Gradle Kotlin DSL
- Plugins (SafeArgs)
Clean Architecture is the "core architecture" of this application. The main purpose of this approach is to achieve a separation of concerns which Clean architecture helps with and in making the code loosely coupled. This approach results in a more testable and flexible code. This approach divides the project in 3 modules: presentation, data and domain.
- Presentation: Layer with the Android Framework, the MVVM pattern and the DI module. Depends on domain to access the use cases and on DI, to inject dependencies. This is the layer closest
to what the user sees on the screen.
- MVVM: The Model View ViewModel pattern helps with the separation of concerns, dividing the user interface with the logic behind. It combines very well with Android Architecture Components like LiveData and DataBinding.
- Domain: This is also known as viewModel. It is the core layer of the application with the business logic. It contains the use cases, in charge of calling the correct repository or data member.The domain layer is independent of any other layers.
- Data: Layer with the responsibility of managing the application data and exposes these data sources as repositories to the domain layer. Typical responsibilities of this layer is to retrieve data from the internet and optionally cache this data locally.
Dependency injection is closely related to two SOLID concepts: dependency inversion, which states that high level modules should not depend on low level modules, both should depend on abstractions; and single responsibility principle, which states that every class or module is responsible for just a single piece of functionality. This application makes use of DaggerHilt as a DI library.