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.
- 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
Coming Soon
- Language: Kotlin
- Minimum SDK: 28 (Android 9.0)
- Target SDK: 34 (Android 14)
- Build System: Gradle with Kotlin DSL
- 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)
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
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)
git clone https://github.com/DarshReddy/WeatherX.git
cd WeatherXWeatherX uses the OpenWeatherMap API. You'll need to obtain an API key:
- Sign up at OpenWeatherMap to get a free API key
- Create a
gradle.propertiesfile in the root directory (if it doesn't exist) - 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.
Open the project in Android Studio and let Gradle sync all dependencies.
- Open the project in Android Studio
- Build > Make Project (or press
Ctrl+F9/Cmd+F9) - Run the app on an emulator or physical device
# Debug build
./gradlew assembleDebug
# Release build
./gradlew assembleRelease
# Install on connected device
./gradlew installDebug./gradlew test./gradlew connectedAndroidTest- Data Layer: The
WeatherRepositoryhandles API calls through Retrofit - Domain Layer:
WeatherForecastsUseCaseprocesses forecast data and groups by day - Presentation Layer:
WeatherViewModelmanages UI state using LiveDataWeatherActivityobserves ViewModel and updates UIWeatherForecastAdapterdisplays the forecast list
GET /weather- Current weather data for a cityGET /forecast- 5-day weather forecast with 3-hour intervals
The app currently defaults to "Bengaluru". To change this:
- Open
app/src/main/java/com/apps10x/weatherx/ui/WeatherActivity.kt - Modify the
CITYconstant in the companion object:
companion object {
private const val CITY = "YourCityName"
}Network timeouts can be adjusted in ApplicationModule.kt:
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)The app requires the following permission:
INTERNET- To fetch weather data from the API
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- The app currently supports only a single hardcoded city
- No location-based weather detection yet
- Limited error message customization
- 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
This project is open source and available for educational purposes.
- 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