Skip to content

ayevbeosa/DashboardLoader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coroutines Mastery Showcase (Jetpack Compose Edition) 🚀

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.

🌟 Key Features

1. Parallel Execution (async / await)

Fetches User Profile and User Stats simultaneously using async within a coroutineScope.

  • Impact: Reduces loading time by running I/O operations in parallel.

2. Modern UI (Jetpack Compose)

Builds the UI using declarative Compose functions instead of XML.

  • Impact: Reduces boilerplate and ensures UI is a direct reflection of the State.

3. Dependency Injection with Hilt

  • 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.

4. Lifecycle-Aware State (collectAsStateWithLifecycle)

Consumes the ViewModel's StateFlow using the latest Compose APIs.

  • Impact: Automatically pauses flow collection when the app is backgrounded, optimizing system resources.

5. Robust Architecture (MVVM)

Clean separation of concerns. The ViewModel holds no reference to the View, making the code testable and modular.

🛠 Tech Stack

  • Language: Kotlin
  • UI: Jetpack Compose (Material3)
  • Architecture: MVVM (Model-View-ViewModel)
  • Concurrency: Kotlin Coroutines & Flow
  • Testing: JUnit 4, kotlinx-coroutines-test

🧪 Testing

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).

🚀 How to Run

  1. Clone the repository.
  2. Open in Android Studio (Giraffe or newer recommended).
  3. Sync Gradle and Run on an emulator.

About

An Android app that simulates a Dashboard feature that aggregates data from multiple network sources, demonstrating how to decouple heavy asynchronous logic from the UI, ensuring the app remains responsive and battery-efficient.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages