# kunminx/jetpack-mvvm-best-practice

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/kunminx-jetpack-mvvm-best-practice).**

8,928 stars · 1,650 forks · Java

## Links

- GitHub: https://github.com/KunMinX/Jetpack-MVVM-Best-Practice
- awesome-repositories: https://awesome-repositories.com/repository/kunminx-jetpack-mvvm-best-practice.md

## Topics

`jetpack` `mvvm`

## Description

This project is a reference implementation of the Model-View-ViewModel pattern using Android Jetpack components. It serves as an architecture template and layering guide, dividing application code into view, domain, and data layers to ensure a unidirectional flow of dependencies.

The implementation focuses on state management and configuration change handling. It demonstrates how to synchronize UI updates across multiple screens using shared state containers and preserves application state during transitions between portrait and landscape orientations.

The codebase covers a broad surface of Android architecture, including data flow management, the repository pattern for data abstraction, and the use of lifecycle-aware containers to maintain a single source of truth.

## Tags

### Software Engineering & Architecture

- [MVVM Architectures](https://awesome-repositories.com/f/software-engineering-architecture/mvvm-architectures.md) — Provides a reference implementation of the MVVM architecture to separate UI layout from application logic. ([source](https://github.com/kunminx/jetpack-mvvm-best-practice#readme))
- [UI Data Observers](https://awesome-repositories.com/f/software-engineering-architecture/architectural-design-patterns/state-management/reactive-subscription-systems/observer-patterns/ui-data-observers.md) — Uses observable data holders to automatically notify and update the user interface when state changes.
- [UI Data Binding](https://awesome-repositories.com/f/software-engineering-architecture/architectural-design-patterns/state-management/reactive-subscription-systems/observer-patterns/ui-data-observers/ui-data-binding.md) — Binds view components to data streams so the interface updates automatically upon source-of-truth changes.
- [Android Implementations](https://awesome-repositories.com/f/software-engineering-architecture/clean-architecture-frameworks/android-implementations.md) — Demonstrates a clean architecture implementation for Android with separated domain, data, and presentation layers.
- [Domain Data Presentation Layers](https://awesome-repositories.com/f/software-engineering-architecture/logic-and-presentation-separation/domain-data-presentation-layers.md) — Divides the application into view, domain, and data layers to enforce dependency inversion. ([source](https://github.com/kunminx/jetpack-mvvm-best-practice#readme))
- [Lifecycle-Aware State Management](https://awesome-repositories.com/f/software-engineering-architecture/memory-usage-analysis/memory-leak-prevention/lifecycle-aware-state-management.md) — Integrates Jetpack ViewModel to manage UI state and data flow during configuration changes.
- [Layered Architectures](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/layering-presentation/layered-architectures.md) — Organizes the codebase into distinct functional layers to separate concerns and ensure unidirectional data flow.

### Data & Databases

- [Repository Patterns](https://awesome-repositories.com/f/data-databases/backend-data-access-layers/repository-patterns.md) — Abstracts data sources into a single API to decouple business logic from network or local database implementations.
- [Data Flow Orchestrators](https://awesome-repositories.com/f/data-databases/data-flow-orchestrators.md) — Manages the movement of data between layers to ensure a single source of truth.
- [Android Examples](https://awesome-repositories.com/f/data-databases/persistent-application-state/screen-state-managers/android-examples.md) — Provides a reference implementation for synchronizing UI updates and exchanging data between screens using shared state containers.

### User Interface & Experience

- [Lifecycle-Aware State Holders](https://awesome-repositories.com/f/user-interface-experience/event-driven-state-managers/lifecycle-aware-state-holders.md) — Utilizes lifecycle-aware containers to preserve UI state during configuration changes like screen rotations.
- [Cross-View State Synchronizations](https://awesome-repositories.com/f/user-interface-experience/cross-view-state-synchronizations.md) — Shares and updates information across multiple views and fragments to maintain interface consistency.
- [Layout Orientation Recalculation](https://awesome-repositories.com/f/user-interface-experience/screen-orientation-detection/device-orientation-controllers/layout-orientation-recalculation.md) — Preserves application state and avoids errors when switching between portrait and landscape modes. ([source](https://github.com/kunminx/jetpack-mvvm-best-practice#readme))
- [Screen Orientation Management](https://awesome-repositories.com/f/user-interface-experience/screen-orientation-detection/screen-orientation-management.md) — Manages display rotation and state preservation when switching between portrait and landscape orientations.
- [Orientation Change Restorations](https://awesome-repositories.com/f/user-interface-experience/scroll-interaction-handlers/scroll-state-controllers/scroll-restoration/scroll-position-maintenance/orientation-change-restorations.md) — Implements patterns to preserve application state during device orientation changes.
- [UI State Synchronization](https://awesome-repositories.com/f/user-interface-experience/ui-state-synchronization.md) — Distributes updates across multiple views using a centralized data source to keep the interface consistent. ([source](https://github.com/kunminx/jetpack-mvvm-best-practice#readme))

### Mobile Development

- [Jetpack Navigation Components](https://awesome-repositories.com/f/mobile-development/jetpack-navigation-components.md) — Implements screen transitions and argument passing using the Jetpack Navigation component.
- [Shared State Containers](https://awesome-repositories.com/f/mobile-development/shared-state-containers.md) — Passes information between different screens using shared state containers for reliable communication. ([source](https://github.com/kunminx/jetpack-mvvm-best-practice#readme))
