Skip to content

Amir-yazdanmanesh/MVI-JetpackCompose-Hilt-Clean

Repository files navigation

GitComposeApp (Jetpack Compose + MVI + Unit Testing)

Language

GitComposeApp is a modern sample project that demonstrates how to build scalable and maintainable Android applications by leveraging Jetpack Compose and Kotlin's latest features. It integrates Compose with MVI architecture and highlights the use of key Android tools like Kotlin Flow and Hilt for dependency injection.

The app serves as an example of clean Android development, focusing on how to structure an app efficiently using the latest frameworks and libraries.

Features

  • UI Components

    • Built entirely with Jetpack Compose, Android's native declarative UI toolkit.
    • Styled with Material Design guidelines for consistent and engaging user interfaces.
  • Technologies

    • Kotlin used across the project, ensuring concise and expressive code.
    • Asynchronous data handling with Coroutines and Flow.
    • Hilt for streamlined dependency injection.
    • Retrofit for network calls.
    • Image loading with Coil.
  • Architecture

    • Single Activity design utilizing Jetpack Navigation.
    • MVI (Model-View-Intent) architecture for unidirectional data flow and clear separation of concerns.
    • Android Architecture Components (ViewModel, LiveData) to handle state and lifecycle-aware components.
    • KTX Extensions for simplified Kotlin code in Jetpack.

App Architecture Overview!

The app follows the MVI architectural pattern, separating concerns into distinct layers for better maintainability and scalability. Each screen is driven by states, actions, and effects.

Architecture layers:

  • View: Compose-based UI that listens for state updates and user events.
  • ViewModel: Handles logic, processes user actions, and updates the view state.
  • Model: Responsible for fetching and providing data, encapsulating business logic in repositories.

Core Components:

  1. State - A data class representing the UI's state (e.g., loading status, data to display).
  2. Event - A user-triggered action passed from the UI to the ViewModel (e.g., button clicks).
  3. Effect - One-off events like navigation actions, displaying a SnackBar, or showing a Toast.

These components work together to implement a clear, unidirectional data flow. The ViewModel mediates between the view and model, ensuring separation of concerns and predictable behavior.

Dark Mode & Light Mode Previews

Below are the previews of both dark and light modes, giving users a seamless experience across themes:

Dark Theme UI Light Theme UI

If you enjoy this project or find it helpful, please give it a star ⭐!