Details view
Details View is the full data display for any beneficiary. Usually this view is launched by a click on row layout in Main datagrid. This view is supposed to display all data by different form submission for the beneficiary. This can also display data for other beneficiaries related to current beneficiary. For example displaying all children of a mother in details view of mother record.
This is done extending DetailFragment which has following main components
- Layout
- Title
- ID
- Profile Picture Container
- Default Profile Picture Resource
- Bind Type
- Custom View
- Client Data
Example Details View
public class HouseholdDetailFragment extends DetailFragment { @Override protected int layoutResId() { return R.layout.my_detail_view_layout; } @Override protected String pageTitle() { return "My Row Details"; } @Override protected String titleBarId() { return client.getColumnmaps().get("my_id_column"); } @Override protected Integer profilePicContainerId() { return R.id.my_profile_imageview; } @Override protected Integer defaultProfilePicResId() { if(client == null || client.getColumnmaps().get("gender") == null){ return null; } String gender = client.getColumnmaps().get("gender"); if (gender.equalsIgnoreCase("male")) { return R.drawable.male; } else if (gender.toLowerCase().contains("trans")) { return R.drawable.transgender; } else if (gender.equalsIgnoreCase("female")) { return R.drawable.female; } return null; } @Override protected String bindType() { return "mybindType"; } @Override protected boolean allowImageCapture() { // Whether to allow capturing pictures for beneficiary. If true, launches camera on clicking profile picture icon return false; } @Override protected void generateView() { // Handle and fill your custom view with data from client } }
This site is no longer maintained. Please visit docs.opensrp.io for current documentation.