-
Notifications
You must be signed in to change notification settings - Fork 36
MVC in Android Client
The Buendia client is (roughly) modeled around the MVC pattern. This document describes how the client architecture conforms to this pattern.
The model is split into two pieces--the server data model and the client data model, as the server's representation of data differs in some ways from the client model.
The server data model is represented by simple beans in the <base>/net/model
package.
The client data model is represented by classes in the /data/app package and described in detail here.
The view is provided by fragments and activities in the /ui package. Each view should, ideally, define and update UI elements.
Views inherit from a few common base classes:
-
BaseActivity
acts as the basis for all activities, providing a status update and troubleshooting mechanism. -
BaseLoggedInActivity
, which extendsBaseActivity
, acts as the basis for most activities, adding a logged-in user and logout/settings menu to the action bar, as well as basic state tracking (LOADING
,SYNCING
,LOADED
). -
ProgressFragment
, which is used in most activities, displays a progress bar/spinner or content based on its state (LOADING
,ERROR
,LOADED
). -
PatientSearchActivity
, which is the basis for many activities, adds Search and Add Patient buttons. Controller
Each activity is controlled primarily by one or more controllers. The controller(s) are responsible for:
- Listening for events on one or more
EventBus
and/orCrudEventBus
objects, which provide a publisher/subscriber interface for various events - Performing CRUD operations on any application data
- Changing the state of a
ProgressFragment
orBaseLoggedInActivity
- Making network requests
Most controllers should also provide methods for requesting and releasing resources, including database handles, cursors, etc. These methods should also register and unregister from EventBus and CrudEventBus
objects, as necessary. Currently, all controllers have init()
and suspend()
methods for this purpose, which are called when the view is paused or resumed, respectively. There is no base interface asserting that these methods must exist, however.
About the software
System Overview
Client Application
Server Application
Server Platform
Development practices
GitHub Usage
Java Style
Testing
Releases
For field users and testers
Software Install and Configuration
Upon Receiving Your Gear
Setting Up a Tablet
Setting Up a Server
Setting Up an Access Point
Reference Configuration