Application uses a Model-View-Presenter (MVP) architecture without using any architectural frameworks.
The app consists of three UI screens:
- Meals - Where a list of meals is displayed
- Checkout - shows a list of checked out meals
- Notification - displays any notifications
In this version of the app, each screen is implemented using the following classes and interfaces:
- A contract class which defines communication between the view and the presenter.
- A Fragment which implements the view interface.
- A presenter which implements the presenter interface in the corresponding contract.
A presenter typically hosts business logic associated with a particular feature, and the corresponding view handles the Android UI work. The view contains almost no logic; it converts the presenter's commands to UI actions, and listens for user actions, which are then passed to the presenter.
A single Activity is used to create all fragments and corresponding presenters. The use of both activities and fragments allows for a better separation of concerns which complements this implementation of MVP.
A Repository pattern is used to encapsulate local and remote data access. You simply specify the data you want and the repository will fetch it for you. An abstract repository is defined which contains the logic needed for all repositories. It also inherently makes offline use simple. Code can be found here.
Dagger Android is used so dagger can handle dependency injection for Activities and Fragments which is normally handled by the OS. Code can be found here.
Unit tests for presenters, repositories are found here.
Espresso UI tests are found here.
Realm is used to handle local data storage. Code can be found here.
The back is handled through Firebase data which stores and syncs data across all devices in real time. The code that handles firebase database access is found here.
Push notifications are used to send orders to admins and notify users that there order has been accepted. Firebase Cloud Messaging handles downstream notifications. Code can be found here.