A streamlined Android application demonstrating Kotlin Coroutines, Structured Concurrency, and Jetpack Compose.
This project simulates a "Dashboard" feature that aggregates data from multiple network sources. It demonstrates how to decouple heavy asynchronous logic from the UI, ensuring the app remains responsive and battery-efficient.
Fetches User Profile and User Stats simultaneously using async within a coroutineScope.
- Impact: Reduces loading time by running I/O operations in parallel.
Builds the UI using declarative Compose functions instead of XML.
- Impact: Reduces boilerplate and ensures UI is a direct reflection of the State.
- Decoupling: Uses @Inject and @HiltViewModel to remove hardcoded dependencies.
- Testability: Easily swap real repositories for fakes/mocks in Unit Tests.
- Scope Management: Automatically manages the lifecycle of the Repository and ViewModel.
Consumes the ViewModel's StateFlow using the latest Compose APIs.
- Impact: Automatically pauses flow collection when the app is backgrounded, optimizing system resources.
Clean separation of concerns. The ViewModel holds no reference to the View, making the code testable and modular.
- Language: Kotlin
- UI: Jetpack Compose (Material3)
- Architecture: MVVM (Model-View-ViewModel)
- Concurrency: Kotlin Coroutines & Flow
- Testing: JUnit 4, kotlinx-coroutines-test
Run the included Unit Tests in DashboardViewModelTest.kt to verify the coroutine logic using Virtual Time.
(Tests are independent of the UI framework, so they remain valid even after switching to Compose).
- Clone the repository.
- Open in Android Studio (Giraffe or newer recommended).
- Sync Gradle and Run on an emulator.