A modern, clean, and feature-rich Android Weather application built with Kotlin and Jetpack Compose. This project follows Clean Architecture principles and is structured into multiple modules to ensure scalability, high testability, and long-term maintainability.
- Real-time Weather: Get current weather, hourly forecast, and 5-day daily forecast for any location.
- Smart Search: Autocomplete search suggestions to quickly find cities across the globe.
- Current Location: Automatic weather detection based on your device's GPS coordinates.
- Persistent Favorites: Save your favorite locations for quick access, with offline caching support.
- Smart Refresh: Optimized "Smart Pull-to-Refresh" that respects a 5-minute threshold to reduce unnecessary API calls while keeping data fresh.
- Modern UI: Fully built with Jetpack Compose and Material 3, supporting both Dark and Light themes.
- Deterministic Architecture: Injected Dispatcher and Time providers to ensure predictable behavior and 100% stable testing.
This project is built with a test-first mindset, achieving a comprehensive 80%+ line coverage milestone across all architectural layers.
- Unit Tests: Full coverage for ViewModels, UseCases, Mappers, and Repositories using MockK.
- Flow Testing: Complex asynchronous streams verified using Turbine.
- Integration Tests: Network layer verified against a local MockWebServer.
- UI Tests: Robust instrumented tests for Compose screens and components on real devices/emulators.
- Database Tests: Instrumented Room DAO tests using in-memory databases.
The project is designed using Clean Architecture and MVVM patterns, separated into clear layers through a multi-module setup:
:app: The UI layer containing Jetpack Compose screens, ViewModels, and Dependency Injection setup.:domain: The core business logic containing UseCases, Domain Models, and Repository interfaces. IncludesDispatcherProviderandTimeProviderabstractions for deterministic execution.:data: The orchestration layer that implements repositories and coordinates between local and remote data sources.:network: Remote data source implementation using Retrofit, featuring custom call adapters for robust error handling.:database: Local persistence layer using Room Database and TypeConverters.:location: Device-specific location services using FusedLocationProvider.:model: Shared data transfer objects (DTOs) used for API communication.
- Language: Kotlin
- UI Framework: Jetpack Compose with Material 3
- Dependency Injection: Hilt
- Networking: Retrofit & OkHttp
- Testing: MockK, Turbine, MockWebServer
- Coverage: Kotlin Kover
- Local Database: Room
- Serialization: Kotlinx Serialization
- Async & Flow: Coroutines & Flow
- Clone the repository.
- Obtain an API key from WeatherAPI.
- Add your API key to
local.properties:API_KEY=your_api_key_here
To run the full suite of unit tests and generate a coverage report:
./gradlew test koverHtmlReportThe report will be available at build/reports/kover/html/index.html.
To run instrumented UI and Database tests (requires a connected device/emulator):
./gradlew connectedDebugAndroidTestDeveloped as a showcase for professional Android engineering standards.