# SunZones
Track sunrise, sunset and daylight across multiple locations around the world. A minimal, single-screen Android app with time-aware gradient backgrounds, animated sun/moon arcs, and a yearly daylight chart.
## Screenshots
## Features
- **Multi-location tracking** -- swipe between saved locations to see real-time sun and moon data
- **Sunrise & sunset times** with day/night length and countdown to next sunrise
- **Animated sun/moon arc** -- a visual progress indicator showing where the sun (or moon) is in its path across the sky
- **Moon phase & illumination** -- current lunar phase emoji and illumination percentage
- **Time-of-day gradients** -- card backgrounds shift dynamically through sunrise, morning, midday, afternoon, sunset, twilight and night palettes
- **Yearly daylight chart** -- scrollable month-by-month visualization of day length and sunrise/sunset distribution
- **Timezone-aware** -- each location stores its own IANA timezone, so times are always correct regardless of where your device is
- **Search or GPS** -- add locations by city name search or use your current position
- **Polish & English** -- full i18n with `values/` and `values-pl/` string resources
## Architecture
Clean MVVM, single-activity Jetpack Compose app with Hilt dependency injection.
```
Room DB (Flow)
-> LocationDao -> LocationRepository -> GetLocationsUseCase
-> CalculateSunTimesUseCase -> SunLocation (UI model)
-> MainViewModel (StateFlow) -> Compose UI
```
| Layer | Responsibility |
|---|---|
| `data/local` | Room entity, DAO, database |
| `data/repository` | Thin DAO wrapper, current-location replacement logic |
| `domain/usecase` | Sun/moon calculations via commons-suncalc, yearly daylight aggregation |
| `domain/model` | `SunLocation` (computed fields), `MonthDaylight` (chart data) |
| `ui/main` | `HorizontalPager` of `SunCard` composables, 60-second auto-refresh |
| `ui/addlocation` | Geocoder search + GPS, timezone resolution via Android ICU |
| `di` | Hilt module providing Room, DAO, Geocoder, FusedLocationProviderClient |
## Tech stack
| | |
|---|---|
| Language | Kotlin |
| UI | Jetpack Compose, Material 3 |
| DI | Hilt |
| Database | Room |
| Sun/moon math | [commons-suncalc](https://github.com/shred/commons-suncalc) 3.11 |
| Location | Google Play Services FusedLocationProviderClient |
| Geocoding | Android Geocoder |
| Timezone lookup | `android.icu.util.TimeZone` (built-in) |
| Min SDK | 26 (Android 8.0) |
| Target SDK | 35 (Android 15) |
## Build
Requires **Java 17** and the Android SDK.
```bash
export JAVA_HOME="/opt/homebrew/Cellar/openjdk@17/17.0.18/libexec/openjdk.jdk/Contents/Home"
./gradlew assembleDebug
```
## License
[MIT](LICENSE) -- Pawel Orzech