A Simple Movie App with offline caching Built using Kotlin

Movies App

License
API
Kotlin
MVVM

Overview

Enjoy an exclusive experience by watching the latest movies

  • Most Popular Movies.
  • Top Rated Movies.
  • Discover Movie Details.
  • Offline caching.

Project Architecture:

This project follows the Clean Architecture structure and MVI. It has UseCases that encapsulate a single, specific task that is part of the application’s business logic. Repository layer, providing a single source of truth for data. The UI layer uses all the components and classes related to the Android framework to get the data from the ViewModel layer and display it on the UI.

App Modules:

  • Remote – This module handles data interaction with the Network Http requests(Retrofit).
  • Local – This module handles data interaction with the database(RoomDB).
  • Data – This Kotlin module implements the repository interface defined in the domain layer, providing a single source of truth for data. It can only access the domain module.
  • Domain – This Kotlin module contains UseCases that encapsulate a single, specific task that is part of the application’s business logic. It cannot access any other module.
  • Presentation – This Android module uses MVI with ViewModels exposing StateFlow that the UI consumes. The ViewModel does not know anything about its consumers. It can only access the UseCases module and it is handel the UI State. Also it has the UI layer that uses all the components and classes related to the Android framework to display data from the ViewModel layer on the UI.
  • App – This module handles the DI(Dependency injection).

Data and Dependenciy Flow:

This illustration from the clean architecture book shows the dependencies between the layers in a project and the way data flows between them. (our app use the same thing).

Tech stack – Library:

  • Kotlin – Kotlin is a modern statically typed programming language used by over 60% of professional Android developers that helps boost productivity, developer satisfaction, and code safety.
  • Jetpack Compose – Jetpack Compose is Android’s recommended modern toolkit for building native UI. It simplifies and accelerates UI development on Android.
  • Room – Room is a persistence library that provides an abstraction layer over the SQLite database to allow a more robust database.
  • Retrofit – A type-safe HTTP client for Android.
  • OkHttp – OkHttp is an efficient HTTP & HTTP/2 client for Android applications.
  • Coroutines – A coroutine is a concurrency design pattern that you can use on Android to simplify code that executes asynchronously
  • Dagger-Hilt – for dependency injection.
  • JetPack
    • StateFlow – For reactive style programming (from VM to UI).
    • Lifecycle – Used get lifecyle event of an activity or fragment and performs some action in response to change
    • ViewModel – Stores UI-related data that isn’t destroyed on UI changes.
  • Material-Components – Material design components like ripple animation, cardView.

How to build on your environment

Add your API key for tmdb in local.properties file.

  • apiKey=YOUR_API_KEY

TODO

  • Movie Screen
  • Movie Details Screen
  • Ktlint or Detekt
  • Use Jetpack Compose
  • Offline caching

Find this repository useful?

Support it by joining stargazers for this repository.

GitHub

View Github

Leave a Reply

Your email address will not be published. Required fields are marked *