Skip to content

DarshReddy/WeatherX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WeatherX 🌀️

WeatherX is a modern Android weather application that provides current weather information and 4-day weather forecasts for cities. Built with Kotlin, it follows clean architecture principles and modern Android development best practices.

Features ✨

  • Current Weather: View real-time weather information including temperature and city name
  • 4-Day Forecast: Get weather forecasts for the next 4 days with daily average temperatures
  • Clean UI: Modern, user-friendly interface with Material Design components
  • Offline Handling: Error handling with retry functionality when network issues occur
  • Edge-to-Edge Display: Optimized for modern Android devices with full-screen support

Screenshots πŸ“±

Coming Soon

Technologies & Architecture πŸ—οΈ

Tech Stack

  • Language: Kotlin
  • Minimum SDK: 28 (Android 9.0)
  • Target SDK: 34 (Android 14)
  • Build System: Gradle with Kotlin DSL

Architecture & Libraries

  • Architecture Pattern: MVVM (Model-View-ViewModel) with Clean Architecture
  • Dependency Injection: Dagger Hilt
  • Networking:
    • Retrofit 2.9.0
    • OkHttp3
    • Moshi for JSON parsing
  • Async Operations: Kotlin Coroutines
  • UI Components:
    • ViewBinding
    • Material Design Components
    • RecyclerView for forecast list
  • Testing:
    • JUnit 4
    • Mockito (Kotlin & Inline)
    • AndroidX Test (Espresso & JUnit)

Project Structure

app/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”œβ”€β”€ java/com/apps10x/weatherx/
β”‚   β”‚   β”‚   β”œβ”€β”€ data/              # Data models and repository
β”‚   β”‚   β”‚   β”œβ”€β”€ di/                # Dependency injection modules
β”‚   β”‚   β”‚   β”œβ”€β”€ domain/            # Business logic and use cases
β”‚   β”‚   β”‚   β”œβ”€β”€ network/           # API service interfaces
β”‚   β”‚   β”‚   β”œβ”€β”€ ui/                # Activities, ViewModels, Adapters
β”‚   β”‚   β”‚   β”œβ”€β”€ utils/             # Utility classes and extensions
β”‚   β”‚   β”‚   └── WeatherXApplication.kt
β”‚   β”‚   └── res/                   # Resources (layouts, drawables, etc.)
β”‚   β”œβ”€β”€ test/                      # Unit tests
β”‚   └── androidTest/               # Instrumented tests

Prerequisites πŸ“‹

Before you begin, ensure you have the following installed:

  • Android Studio (Hedgehog | 2023.1.1 or newer recommended)
  • JDK 8 or higher
  • Android SDK with API level 34
  • Gradle 8.4.0+ (included via wrapper)

Setup & Configuration βš™οΈ

1. Clone the Repository

git clone https://github.com/DarshReddy/WeatherX.git
cd WeatherX

2. Configure API Key

WeatherX uses the OpenWeatherMap API. You'll need to obtain an API key:

  1. Sign up at OpenWeatherMap to get a free API key
  2. Create a gradle.properties file in the root directory (if it doesn't exist)
  3. Add the following properties:
baseUrl="https://api.openweathermap.org/data/2.5/"
appId="YOUR_API_KEY_HERE"

Important: Make sure gradle.properties is listed in .gitignore to keep your API key secure.

3. Sync Project

Open the project in Android Studio and let Gradle sync all dependencies.

Building the Project πŸ”¨

Using Android Studio

  1. Open the project in Android Studio
  2. Build > Make Project (or press Ctrl+F9 / Cmd+F9)
  3. Run the app on an emulator or physical device

Using Command Line

# Debug build
./gradlew assembleDebug

# Release build
./gradlew assembleRelease

# Install on connected device
./gradlew installDebug

Running Tests πŸ§ͺ

Unit Tests

./gradlew test

Instrumented Tests

./gradlew connectedAndroidTest

How It Works πŸ”„

  1. Data Layer: The WeatherRepository handles API calls through Retrofit
  2. Domain Layer: WeatherForecastsUseCase processes forecast data and groups by day
  3. Presentation Layer:
    • WeatherViewModel manages UI state using LiveData
    • WeatherActivity observes ViewModel and updates UI
    • WeatherForecastAdapter displays the forecast list

API Endpoints Used

  • GET /weather - Current weather data for a city
  • GET /forecast - 5-day weather forecast with 3-hour intervals

Configuration πŸ”§

Changing the Default City

The app currently defaults to "Bengaluru". To change this:

  1. Open app/src/main/java/com/apps10x/weatherx/ui/WeatherActivity.kt
  2. Modify the CITY constant in the companion object:
companion object {
    private const val CITY = "YourCityName"
}

Network Timeout Configuration

Network timeouts can be adjusted in ApplicationModule.kt:

.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)

Permissions πŸ“±

The app requires the following permission:

  • INTERNET - To fetch weather data from the API

Contributing 🀝

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Known Issues πŸ›

  • The app currently supports only a single hardcoded city
  • No location-based weather detection yet
  • Limited error message customization

Future Enhancements πŸš€

  • Add location-based weather detection
  • Support for multiple cities with search functionality
  • Detailed weather information (humidity, wind speed, pressure)
  • Weather maps and radar
  • Dark mode theme support
  • Widgets for home screen
  • Weather alerts and notifications

License πŸ“„

This project is open source and available for educational purposes.

Acknowledgments πŸ™

  • Weather data provided by OpenWeatherMap API
  • Built with modern Android development tools and libraries
  • Icons and design inspired by Material Design guidelines

Made with ❀️ by the WeatherX Team

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages