Build an android app to retrieve weather information based on their searching criteria and show the searched results on the dashboard screen.
- Written by Kotlin.
- Used MVVM design pattern.
- Used Retrofit as a REST client to call and retrieve data from OpenWeatherMapsAPI.
- Used Hilt for dependency injection.
- Accessibility for Disability Supports.
- MVVM architecture: https://developer.android.com/jetpack/guide
- Retrofit: https://square.github.io/retrofit/
- Hilt: https://developer.android.com/training/dependency-injection/hilt-android
- Caching: https://bapspatil.medium.com/caching-with-retrofit-store-responses-offline-71439ed32fda
- Talkback: https://medium.com/microsoft-mobile-engineering/android-accessibility-resolving-common-talkback-issues-3c45076bcdf6
The project is built using the MVVM model. The package structure will look like below:
All the architecture components are as follows:
- Unit test: mockito, junit4, robolectric
- LiveData: Notify views of any data changes.
- ViewModel: Manage UI-related data in a lifecycle-conscious way.
- Lifecycles: Manages activity lifecycles of our app.
The Android application is written by Kotlin is able to
- Retrieve the weather information from OpenWeatherMapsAPI.
- Allow users to enter the searching term.
- Proceed to search if the search term length is at least 3 characters.
- Show the searched results as a list.
- Able to handle failures like network down, etc.
- Caching mechanism to prevent the app from generating a bunch of API requests.
- Manage caching mechanism & lifecycle.
- Support the disability to read out the text with Talkback.
- Support the disability to scale large text for those who can't see the text clearly.
The application can be enhanced more for
- Add more local test for ui.
- Unit test for Exception case (
Checked exception
issue), ApiService interface.
- I have done a Unit test for logic code (
Repository
,ViewModel
) and some basic test cases for UI test (View
). - UI from the requirement is not good enough, need to discuss and improve later.
Below are the obligatory requirements that you must meet to run the project:
- Adding configuration in your
local.properties
file.
BASE_URL="<your OpenWeatherMapsAPI domain>"
WEATHER_APP_ID="<OpenWeatherMapsAPI App Id>"
Example:
BASE_URL="https://somedomain.org/"
WEATHER_APP_ID="Your app id string with 32 characters long"
sync
your project