Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Home is the main Register screen which user sees right after Login. There you control the overall flow of application and navigation to different registers. This also setups different background services which need to run for optimized working of app. This also starts FormSyncer service.

To start a Home screen you just need to implement goToHome() in your login activity as mentioned in Login and navigation is taken care of by core app. Now you need two things.

  1. Create a view or layout for your Home as done here
  2. Create an Activity extending NativeHomeActivity from core app. This would take care all background and sync services. Find a working example here


The Home screen here represent 4 registers each having a different type of service. Following are main components of Home

  1. App logo .. TBD How to change the logo without code
  2. Unsynced forms count - Shows the data entries which have not been submitted to server yet
  3. Register - Explained in detail below
  4. Non Register modules - Any additional components which do not follow the standard register layout.

Register

A register is a class im core app and is the main component which controls the naviation to different services and this is the most important part where you have to provide the implementation. Following are main components of register which must be provided when initializing Home

  1. Permission or Role : Which permission or role of user should be checked to allow him see this view. TBD role
  2. Container Id : The id of register main Layout or container. This is to control visibility of register
  3. Register Button Id : The id on button which implements the navigation on click event. This allows forwarding all onclick events to custom listener
  4. Register Click Listener : The onClickListener for this register
  5. Register Count Views : The badges which display counts for registers
    1. Each Register count view has following components
      1. View Id : This is the id of TextView which is display for count
      2. Table : Which table it displays data from. This is the bindtype where data is managed for given beneficiary. Read more about Bind Types.
      3. Filter : Any custom filter to be applied to count query
      4. Postfix : Any post fix to add to badge incase there are multiple badges for one register. This is to distinguish count type
      5. Count Method : Should app automatically calculates count or developer want to provide count using a custom complex query. Possible values AUTO, MANUAL, NONE

Following is an example of how you initialize a Register with two badges

Example Register Initialization
Register myRegister = initRegister("View Permission For Register in OpenMRS", R.id.myRegisterContainer, R.id.btn_my_register, onRegisterStartListener,
        new RegisterCountView[]{
           new RegisterCountView(R.id.txt_my_count_type_1, "mybindType1", "", "B1", CountMethod.AUTO),
           new RegisterCountView(R.id.txt_my_count_type_2, "mybindType2", "", "B2", CountMethod.AUTO),
        });
Example Home Activity
 





  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.