Skip to content

apollocked/Weather-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kurdistan Weather App

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.

Features

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

Tech Stack

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

API Reference

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 metric and imperial units based on user selection.

Getting Started

Prerequisites

  • Android Studio (Ladybug or newer recommended)
  • Minimum SDK: 24 (Android 7.0)
  • An active OpenWeatherMap API Key

Installation

  1. Clone the repository:

    git clone https://github.com/apollocked/Weather-app.git
  2. Open in Android Studio:

    • Open Android Studio and select Open.
    • Navigate to the project folder and click OK.
  3. Run the App:

    • Connect your Android device or start an emulator.
    • Click the Run button in Android Studio.

Recent Updates

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

Logic Explanation

Theme Management

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.

Unit Conversion

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.

Project Structure

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

License

This project is open-source and available under the MIT License.

Acknowledgements

  • Weather data provided by OpenWeatherMap.
  • Built to provide localized, high-quality weather information for the Kurdistan region.

Made with ❤️ in Kurdistan

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages