A modern, theme-aware Android weather application built with Kotlin that provides current weather conditions and a 5-day forecast specifically for cities across the Kurdistan region and surrounding areas.
- Current Weather: Displays real-time temperature, weather description, humidity, and wind speed with intuitive icons.
- Dynamic 5-Day Forecast: Provides a detailed forecast for the next 5 days, showing daily High/Low temperatures and expected conditions with a modern "glassmorphism" UI in dark mode.
- Settings Page: A dedicated settings screen to customize your experience.
- City Selector: Choose from over 40 major cities in Kurdistan from the settings menu.
- Unit Customization: Toggle between Celsius (°C) and Fahrenheit (°F).
- Dark Mode Support: Full support for Dark Mode with a beautiful deep indigo gradient, automatically saved and applied globally.
- Persistent Preferences: The app remembers your selected city, unit preference, and theme even after closing.
- Language: Kotlin
- Networking: Retrofit2
- JSON Parsing: Gson
- Asynchronous Programming: Kotlin Coroutines & Lifecycle Scope
- Architecture: ViewBinding, Custom Application class for global theme management.
- UI Components: RecyclerView, NestedScrollView, Material Design 3, Custom Vector Graphics.
This application uses the OpenWeatherMap API (5 Day / 3 Hour Forecast endpoint) to fetch weather data.
- Endpoint:
https://api.openweathermap.org/data/2.5/forecast - Units: Supports both
metricandimperialunits based on user selection.
- Android Studio (Ladybug or newer recommended)
- Minimum SDK: 24 (Android 7.0)
- An active OpenWeatherMap API Key
-
Clone the repository:
git clone https://github.com/apollocked/Weather-app.git
-
Open in Android Studio:
- Open Android Studio and select
Open. - Navigate to the project folder and click
OK.
- Open Android Studio and select
-
Run the App:
- Connect your Android device or start an emulator.
- Click the
Runbutton in Android Studio.
- Added Settings Activity: Moved city selection and unit toggles to a dedicated page for a cleaner main UI.
- Implemented Global Dark Mode: Added a manual toggle that overrides system settings and persists across app restarts.
- UI Refinement: Added professional icons for wind, humidity, and temperature highlights.
- Theme-Aware Backgrounds: Background gradients now transition dynamically between light blue and deep night indigo.
- Improved Readability: Fixed contrast issues in city selection menus for dark mode users.
The app uses a custom WeatherApplication class to intercept the launch process and apply the user's saved darkMode preference before any activities are created. This prevents "theme flickering" and ensures a consistent experience.
By passing the units parameter dynamically to Retrofit, the app handles conversion server-side, ensuring that both current weather and the 5-day forecast remain accurate to the selected metric.
com.example.weatherapp
├── adaptor
│ └── ForecastAdapter.kt # RecyclerView adapter with dynamic unit symbols
├── models
│ ├── WeatherApi.kt # Retrofit Interface
│ └── WeatherResponse.kt # Data models for API responses
├── Utilis
│ └── CityNames.kt # Centralized city database
├── MainActivity.kt # Main weather display and logic
├── SettingsActivity.kt # User preferences and theme management
└── WeatherApplication.kt # Global state and theme initialization
This project is open-source and available under the MIT License.
- Weather data provided by OpenWeatherMap.
- Built to provide localized, high-quality weather information for the Kurdistan region.
Made with ❤️ in Kurdistan