$ show android/architecture-samples
This is the official Android Architecture Samples repository, specifically the 'main' branch which demonstrates a modern Android app architecture using Jetpack Compose, Navigation Compose, Hilt for dependency injection, Room for local persistence, and Kotlin Coroutines/Flow for asynchronous operations. The app is a simple TODO list manager with CRUD operations, filtering, and statistics. It showcases a single-activity architecture with a navigation graph, a data layer with repository and two data sources (local Room database and a fake network), and a presentation layer with ViewModels and Compose screens. The codebase is well-structured, follows clean architecture principles, and includes extensive unit, integration, and end-to-end tests. It is intended as a learning reference for Android developers, not as a production template.
The LLM identified 3 files worth highlighting for reuse:
Provides clean, isolated extension functions for mapping between three data models: Task (external), LocalTask (Room entity), and NetworkTask (network DTO). Each mapping is a simple one-liner, and the file uses @JvmName annotations to handle type erasure for list mappings. This pattern is highly reusable in any Android project with multiple data sources, as it centralizes model conversion logic and keeps the data layer decoupled.
A generic sealed class representing the result of an asynchronous operation: Loading, Error (with error message resource ID), and Success (with data). This is a common but well-crafted pattern used throughout the app's ViewModels to expose UI state. It is self-contained, has no internal dependencies, and can be extracted into any Kotlin project to standardize async state handling.
Defines a custom SharingStarted strategy called WhileUiSubscribed that keeps upstream flows active for a short timeout (5 seconds) after the UI stops observing, to handle configuration changes gracefully. This is a reusable utility for any Android app using StateFlow to expose data to the UI, preventing unnecessary recomputation while avoiding resource leaks.