IWeather Android Application

This project was created as a demo project for implementing latest frameworks, Android APIs, tools, and techniques.
It follows Clean architecture design pattern. Project files are divided into three layers (presentation, domain, and data).

It contains Production Code, Unit Tests for domain layer classes and ViewModels in presentation layer, and Instrumentation Tests for Room database related classes in data layer.
You can use it as a reference for using the tools described at the end of this file.
If you want to contribute to this repository by reviewing my code, refactor it, or add new features, You are almost welcomed.

Screenshots

   

Installation

  • First you need to create an account on OpenWeatherMap
  • Then you need to create an API Key.
  • In your gradle.properties file enter the code below:
    apiKey = “{YOUR_API_KEY}”

How to use

  • Please check that your device is connected to the internet.
  • Tap on Add City button.
  • Enter city name, Country code as shown in the screenshots above.
  • Then city with it’s related historical data will be cached in your device. So you can access it later without needing to internet connection.
  • You can add cities as much as you want.
  • Tab on your city name, then it will navigate to city historical screen.
  • Tab on an item from the historical data items to navigate to the details screen.

Built With

  • Kotlin – As a programming language.
  • Coroutines – For multithreading while handling requests to the server and local database.
  • Navigation Component – To handle app navigation.
  • Multidex – To enable creating multi dex files because of using set of libraries that reached the maximum size of single dex file.
  • Model-View-ViewModel(MVVM) – Offers an implementation of observer design pattern.
  • Data Binding – It helps in decoratively binding UI elements of our layout to data source of our app.
  • Retrofit – It is a type-safe REST client for Android, Java and Kotlin developed by Square. The library provides a powerful framework for authenticating and interacting with APIs and sending network requests with OkHttp.
  • Room DB – To manage SQLite database easily and avoid a lot boilerplate code.
  • Glide – It is a fast and efficient open source media management and image loading framework for Android that wraps media decoding, memory and disk caching, and resource pooling into a simple and easy to use interface.
  • Timber – It helps in logging while debugging your app. and all logging code will not be embedded in the released APK.
  • Hilt – It is arguably the most used Dependency Injection, or DI, framework for Android. Many Android projects use Dagger to simplify building and providing dependencies across the app. It gives you the ability to create specific scopes, modules, and components, where each forms a piece of a puzzle: The dependency graph.
  • Clean Architecture – Applying Clean Architecture and Solid Principles to build a robust, maintainable, and testable application.
  • MockWebServer – This library makes it easy to test that your app Does The Right Thing when it makes HTTP and HTTPS calls. It lets you specify which responses to return and then verify that requests were made as expected.
  • Google Truth – Truth makes your test assertions and failure messages more readable. Similar to AssertJ, it natively supports many JDK and Guava types, and it is extensible to others.
  • Kotlin Flow – In coroutines, a flow is a type that can emit multiple values sequentially, as opposed to suspend functions that return only a single value. For example, you can use a flow to receive live updates from a database. I replaced LiveData objects in ViewModels with StateFlow objects. it is much easier for unit testing.

License

Please review the following license agreement

GitHub

View Github