This project was an Android Challenge I was assigned to. After completing it, I decided to share it as a sample project using MVP + RxJava and Dagger. Of course it needs improvement so it would be a great oppotunity to learn and get new ideas about best practices, MVP, Dependency Injection and unit tests. Feel free to share ideas, suggestions and PRs! =)
The challenge here is to build an app in which people can see the weather forecast. The user can select a city from a list of cities and see a 5 day weather forecast for the selected city.
Required functionality:
-
The weather information should be retrieved from a live 3rd party service;
-
The city list should default to Dublin, London, New York and Barcelona;
-
The user must be able to add to the city list;
-
The user must be able to remove a city from the city list;
-
All changes should be persistent. If the user adds or remove a city then the change should persists when the application is restarted;
-
The user must be able to refresh the weather forecast;
-
The application should present the forecasts as a graphical display.
I used an architecture based on the MVP pattern and followed some Clean Architecture concepts. The application is divided in three main packages: Model, Data and View.
- Model: Domain rules (not applicable in this case) and models.
- Data: Responsible for managing the flow of data used in the application.
- View (View + Presenter): Responsible for the presentation layer.
- RxJava
- Retrofit + OkHttp
- ButterKnife
- ORMLite
- Gson
- Dagger