Skip to content

Latest commit

Β 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌦️ WeatherApp - Modern Android MVVM Architecture

A clean, modern, and production-ready Android application that displays real-time weather information and a 7-day forecast using the OpenWeatherMap API. Built with Kotlin and following modern Android development practices, this project showcases a robust implementation of the MVVM (Model-View-ViewModel) architectural pattern.


πŸš€ Key Features

  • Real-time Weather Data: Fetches live temperature, humidity, wind speed, and weather descriptions.
  • Dynamic Themes: Automatically switches the app UI background and weather icons (e.g., Sunny/Cloudy/Rainy) based on current weather conditions.
  • 7-Day Forecast: Displays a clean forecast list using a dynamic RecyclerView.
  • Robust Error Handling: Professional status code handling (401, 404, etc.) and explicit network connectivity checks via a generic sealed class state management system.

πŸ› οΈ Tech Stack & Dependencies

This project leverages the official Android Jetpack libraries and modern networking tools:

  • Language: Kotlin
  • Architecture: MVVM (Model-View-ViewModel)
  • Networking: Retrofit2 & Gson Converter (Type-safe HTTP client & JSON parser)
  • HTTP Logging: OkHttp Logging Interceptor (For inspecting network requests in Logcat)
  • Asynchronous Processing: Kotlin Coroutines (Non-blocking network requests)
  • Jetpack Components:
    • ViewModel (Retains UI data through configuration changes)
    • LiveData (Lifecycle-aware data observation)
    • View Binding (Null-safe UI component interaction)

πŸ“‚ Project Folder Structure

The code-base follows a strict layer-by-feature / layer-by-type separation to ensure clean boundaries, scalability, and ease of testing.

com.example.weatherapp/
β”‚
β”œβ”€β”€ data/                         # Data Layer (Network, Models, Repositories)
β”‚   β”œβ”€β”€ model/                    # Pure Kotlin Data Classes mapped from JSON Response
β”‚   β”‚   β”œβ”€β”€ Clouds.kt
β”‚   β”‚   β”œβ”€β”€ Coord.kt
β”‚   β”‚   β”œβ”€β”€ Main.kt
β”‚   β”‚   β”œβ”€β”€ Sys.kt
β”‚   β”‚   β”œβ”€β”€ Weather.kt
β”‚   β”‚   β”œβ”€β”€ WeatherResponse.kt    # Root API response model
β”‚   β”‚   └── Wind.kt
β”‚   β”‚
β”‚   β”œβ”€β”€ remote/                   # Network Configuration Components
β”‚   β”‚   β”œβ”€β”€ WeatherApiService.kt  # Retrofit Endpoint definitions interface
β”‚   β”‚   └── RetrofitClient.kt     # Singleton OkHttpClient & Retrofit provider
β”‚   β”‚
β”‚   └── repository/               # Single Source of Truth for Data Operations
β”‚       └── WeatherRepository.kt  # Handles API logic and maps responses to States
β”‚
β”œβ”€β”€ ui/                           # UI Layer (Activities, ViewModels, Adapters)
β”‚   β”œβ”€β”€ adapter/
β”‚   β”‚   └── ForecastAdapter.kt    # RecyclerView Adapter using View Binding for 7-day list
β”‚   β”‚
β”‚   └── weather/
β”‚       β”œβ”€β”€ WeatherActivity.kt    # Renders UI, handles clicks, and observes ViewModel
β”‚       └── WeatherViewModel.kt   # Communicates with Repository using Coroutines & updates LiveData
β”‚
└── utils/                        # Shared Helpers & Utility Components
    β”œβ”€β”€ Constants.kt              # App-wide fixed configurations (BASE_URL, API_KEY, Units)
    └── Resource.kt               # Generic Sealed Class for managing API States (Loading, Success, Error)

About

🌦️ A modern Android Weather application built with Kotlin, demonstrating clean architecture using MVVM, Coroutines, LiveData, Retrofit2, and View Binding with the OpenWeatherMap API.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages