🎬Flick is an Android app that consumes the TMDB API to get details about upcoming movies, popular movies, top rated movies and shows in general. This app has been built using Kotlin as the base programming language. While building Flick, I am trying to follow the MVVM architecture.
1. To learn how to structure a software using clean architecture concepts.
2. To solidify my knowledge on some of the android jetpack components.
3. To use dependency injection with Koin.
- Screenshots
- Prerequisite
- Clean Architecture MVVM
- Dependency injection with Koin
Say you want to use TMDB in your future or upcoming projects, what you'll need is an API key, which is really easy to generate. You will want to visit the site here and just follow through the guide to creating your key.
The different parts of this app are represented by different layers of circles as the iamge above depicts. As you move to the center circles, your software artifacts become more abstract. Inner circles tend to contain the business rules of our application. A layer should not know about the activities of a layer above it but a layer can understand components of a layer beneath it.
1. Domain
This is the most abstract layer of our application. It defines the business logic of our application and the necessary models of entities. What goes in the domain layer?
- Entity models: Components that bundle the info that will be used in our application.
- Repository Declarations: Definitions you want implemented by repositories from other layers.
- Use cases: Are objects that have just one action, to do something specific by utilizing the repository.
2. Data
This layer acts as the entry points of data that we require in our application. These can either be data from remote infrastructure or data persisted locally. What goes in the data layer?
- Repository implementations: These implement the repository declared in our domain layer
- Service Declarations: These artifacts are responsible for providing data and are the ones that feed the repository class.
3. Presentation
This is the layer that contains UI related business
This project uses many of the popular libraries, plugins and tools of the android ecosystem.
-
Hilt - Dependency Injection library.
-
- Android KTX - Provide concise, idiomatic Kotlin to Jetpack and Android platform APIs.
- AndroidX - Major improvement to the original Android Support Library, which is no longer maintained.
- Lifecycle - Perform actions in response to a change in the lifecycle status of another component, such as activities and fragments.
- LiveData - Lifecycle-aware, meaning it respects the lifecycle of other app components, such as activities, fragments, or services.
- ViewModel - Designed to store and manage UI-related data in a lifecycle conscious way. The ViewModel class allows data to survive configuration changes such as screen rotations.
- Data Binding - Allows you to bind UI components in your layouts to data sources in your app using a declarative format rather than programmatically.
- Room - Provides an abstraction layer over SQLite used for offline data caching.
- Navigation Component-Component that allows easier implementation of navigation from simple button clicks to more complex patterns.
-
MotionLayout - Helps create and manage beautiful UI animations.
-
Retrofit - Type-safe http client and supports coroutines out of the box.
-
GSON - JSON Parser,used to parse requests on the data layer for Entities and understands Kotlin non-nullable and default parameters.
-
OkHttp-Logging-Interceptor - Logs HTTP request and response data.
-
Coroutines - Library Support for coroutines.
-
Flow - Flows are built on top of coroutines and can provide multiple values. A flow is conceptually a stream of data that can be computed asynchronously.
-
Timber-Library for easier logging.
-
Material Design - Build awesome beautiful UIs.
-
Glide- Image Library from loading images from the database and cacheing in memory.
-
kotlinx.coroutines - Library Support for coroutines,provides runBlocking coroutine builder used in tests.
-
Truth - Assertions Library,provides readability as far as assertions are concerned.
-
MockWebServer - Web server for testing HTTP clients, verify requests and responses on the TMDB API with the retrofit client.