A simple Weather App built using OpenWeatherMap API that provides the required weather details at a glance.
The app displays the most relevant weather information based on the current location of the user. It displays the nearest approximate user location (City & Country), it's temperature, weather conditions, sunrise and sunset time, humidity, pressure, wind speed and rainfall.
The app is written entirely in Kotlin and uses the Gradle build system. The architecture is built around Android Architecture Components. The logic is kept away from Activities and Fragments and moved it to ViewModels following the MVVM Architecture and inline with the best practice. The data is observed using LiveData and update changes in the UI.
It uses the latest Jetpack Components.
- Retrofit: A type-safe HTTP Client for Android and Java.
- Dagger2: Compile-time framework for Dependency Injection.
The app uses Retrofit to streamline interaction with the OpenWeatherMap API. It is used to retrieve the JSON response and makes use of Moshi converter to parse the JSON response to Java objects and vice versa.
The app uses Dagger to remove the biolerplate code and handles dependencies between Actvities, Fragments and classes. All activities and classes use Dagger to eliminate manual dependency injection.
- Syncs API data with locally in Room Database to save battery and reduce API calls.
- Implements Kotlin Coroutines to manage background tasks effectively and reduce the need for callbacks while dealing with APIs.
The background changes based on the time of day.
- Morning
- Twilight
- Night
- Weather Information of User specified location, to make it more useful.