The final app looks like this:
Before running this app,check to confirm there is a file named apikeys.properties else if not found please, create a file named "apikeys.properties", add to the project level files and then add the keys using same format same as shown below:
eg.
WEATHER_API_KEY ="XXXXXXXX"Design a two-page mobile weather application detailing the weather information for cities in the table below
-
Page One: should contain a grid or list showing all the cities in the table below with Images / Icon to represent each city. Add extra information on each item in the grid such as name of city, country of city, weather forecast for city and any other information as deemed fit.
-
Page two: this should contain a detailed weather report of the selected city in page one above. A user should be able to select any city in page one and Page two should display the weather forecast for the selected city.
* The app uses the single activity approach and uses Jetpack navigation to navigate across screen.
* The WeatherApp class contains an instance of the Dagger component and the a method which can be overridden in the test sourceSet inorder to setup dagger [WeatherTest App]
* The WeatherFragment class contains the home page which is seen on launch of the application. The application uses flow to get the stream of data asynchronously and stores it to the Room database which serves as a single source of truth for the UI,
* The Data (Remote and local) and UI packages have their models and communication between the packages are achieved by using mappers to convert form one model to the other.Design patterns used where singleton,Factory and Builder design patterns
* The setup for testing(End to End,UI,Integration and Unit test where done), and a few unit test where written
* The user can also refresh the Weather Updates
* Write more tests
* Add Test coverage dependency (Jacoco) and setup
* Add more comments and Setup (Dokka) for the purpose of documentation
-
Tech-stack
- Kotlin - a cross-platform, statically typed, general-purpose programming language with type inference.
- Coroutines - perform background operations.
- Flow - handle the stream of data asynchronously that executes sequentially.
- Dagger - handles dependency injection
- ViewBinding - feature that allows you to more easily write code that interacts with views
- Parcelable - Plugin provides a Parcelable implementation generator.
- Jetpack
- Room - a persistence library provides an abstraction layer over SQLite.
- LiveData - is an observable data holder.
- ViewModel - store and manage UI-related data in a lifecycle conscious way.
- Navigation component- helps to implement navigation.
- Android KTX- Provides concise, idiomatic Kotlin to Jetpack, Android platform, and other APIs.
-
Architecture
- MVVM - Model View View Model
-
Tests
- Unit Tests (JUnit) - a simple framework to write repeatable tests.
- Truth - Assertion library
MIT License
Copyright (c) 2021 Favour Olije
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
