This repository is a weather application to display the current weather ☔ at the user’s location and a
5-day forecast using the Open Weather API as well as photos of a saved location from The Flickr API
This app enable users to:
- See the weather details as well as a 5 days forecast of their current location
- Search and save locations as favorite
- View public photos of a saved location
- delete or refresh weather details of a saved location.
Home (Dark Theme) | Home (Light Theme) |
---|---|
Saved Locations (Dark Theme) | (Light Theme) |
---|---|
Maps |
---|
Screen Recording |
---|
Screen_recording_20231005_155142.mov |
Tech Tools | Usage/Purpose |
---|---|
Kotlin | Language |
Jetpack Compose | UI creation library |
Compose Navigation | Navigate between Compose Screen |
Compose Paging | Managing multiple pages of data |
Coil | 🖼️ Image Loading Library |
Coroutines | 🧵 Asynchronous Programming |
StateFlow | Observable Data and state holder |
Dependency injection with Hilt | 💉 Dependency Injection Library |
Retrofit | 🌐 Used for Networking |
OkHTTP | 🌐 HTTP Client required by Retrofit Library for Networking |
Kotlinx Serialization | 🌐 Use to serialize and deserialize Kotlin objects to JSON |
Kotlin Gradle | ⚙️ All the gradle files are written in pure kotlin |
AndroidX | Android library for core functionalities |
ViewModel | Manage data and UI State in lifecycle-aware fashion |
Room DB | 💾 For local data storage |
android-maps-compose | Show saved locations on the Map |
Testing
Testing Tools | Usage/Purpose |
---|---|
Junit | Unit Testing |
Mockk | Data Mocking |
Truth | Unit Testing |
Turbine | Flow Testing |
Other Tools/Project setup
Tools | Usage/Purpose |
---|---|
Gradle secrets plugin | A Gradle plugin for providing your secrets to your Android project |
Hilt(DI) | Dependency Injection Library |
Kotlin Symbol Processing (KSP) | code generation for Room and Hilt libraries |
Timber | For local Logging |
Lottie Compose | Icon and images animations |
Gradle version catalogs | Gradle Dependencies management |
Spotless | For Code formatting check how to setup |
Other Tools
Workflow Tools | Usage/Purpose |
---|---|
Bitrise | For CI/CD |
Fastlane | Local gradle tasks automation |
jacoco | For code coverage reporting generation |
codecov | Code coverage reporting - Get Code Coverage Insights Directly in the CI/CD Workflow |
This App is based on the MVVM architecture and the Repository pattern, which follows the Google's official architecture guidance.
- Each layer follows unidirectional event/data flow; the UI layer emits user events to the data layer, and the data layer exposes data as a stream to other layers.
- The data layer is designed to work independently of other layers and must be pure, which means it doesn't have any dependencies on the other layers.
With this loosely coupled architecture, it increases the usability of components and scalability of the app
The Project uses 2 api :
- OpenWeather API 🔑 for Weather Data and.
- The Flickr API 🔑 to fetch paginated photos of a give location
- Google Maps API key 🔑
This project fetches weather data from the OpenWeather API.
To begin the setup, you'll need to create an account and get a free API key.
- Create an account at openweathermap.org
- Go to settings from the profile icon
- Click on API
- Click on Create
This project fetches photos data from The Flickr API.
To begin the setup, you'll need to create an account and get a free API key.
How to create your Flickr API keys, go to Flickr
- Create an Application - You will first need to create an application. Click on “create your first”.
- Request an API Key - Then, make a request for an API key by clicking on “Request an API Key - check this guide with visuals
- Get a Maps API key
in your local.properties
you will need to add your API keys and copy the urls for the two apis
#Insert at ~/local.properties
#OPEN_WEATHER
OPEN_WEATHER_APP_ID = <insert your OperWeather API Key>
OPEN_WEATHER_BASE_URL= https://api.openweathermap.org/
OPEN_WEATHER_ICONS_URL= http://openweathermap.org/img/wn/
#Fliker
FLICKR_PHOTOS_BASE_URL = https://www.flickr.com/services/rest/
FLICKR_API_KEY = <insert your Flickr API Key>
#Maps API Key
MAPS_API_KEY = <insert YOUR Maps >
This project uses the Hilt for dependency Injection. After opening this project in your Android Studio you might get some error which is due unavailability of a few classes. You need to make a project
or try to build the project, this will generate all the required classes for Hilt.
Environment
- Android Studio Giraffe | 2022.3.1 Patch 1
- JDK 17
Weather - ForecastApp
Copyright (c) 2023 Awesome Jim (https://github.com/AwesomeJim/weather-forecast/).
This App is distributed under the terms of the Apache License (Version 2.0).
See the [license](https://github.com/AwesomeJim/weather-forecast/blob/main/LICENSE) for more information.