@Test public void shouldShowTheCustomRegimenWhenTheFormIsMissedAndNotAuthorised() { RnRForm rnRForm = new RnRForm(); rnRForm.setStatus(RnRForm.STATUS.DRAFT_MISSED); rnRForm.setRegimenItemListWrapper(getRegimeTypeList()); rnRForm.setRegimenThreeLinesWrapper(getRegimeItemThreeLines()); when(presenter.getRnRForm()).thenReturn(rnRForm); mmiaRegimeList.initView(totalView, totalPharmacy, tvTotalPharmacyTitle, presenter); assertEquals(6, mmiaRegimeList.getChildCount()); }
public void initView(TextView totalView, TextView totalPharmacy, TextView tvTotalPharmacyTitle, MMIARequisitionPresenter presenter) { this.presenter = presenter; this.isPharmacyEmpty = presenter.getRnRForm().getRegimenThreeLineListWrapper().isEmpty(); this.dataList = presenter.getRnRForm().getRegimenItemListWrapper(); this.editTotalTexts = new ArrayList<>(); this.editPharmacyTexts = new ArrayList<>(); initCategoryList(dataList); this.totalView = totalView; this.totalPharmacy = totalPharmacy; this.totalPharmacyTitle = tvTotalPharmacyTitle; for (int i = 0; i < adults.size(); i++) { addItemView(adults.get(i), i); } if (isCustomEnable()) { addAdultBtnView(); } for (int i = 0; i < paediatrics.size(); i++) { addItemView(paediatrics.get(i), adults.size() + i); } if (isCustomEnable()) { addPaediatricsBtnView(); } totalView.setText(String.valueOf(getTotal(COUNTTYPE.AMOUNT))); totalPharmacy.setText(String.valueOf(getTotal(COUNTTYPE.PHARMACY))); editTotalTexts.get(editTotalTexts.size() - 1).setImeOptions(EditorInfo.IME_ACTION_DONE); if (editPharmacyTexts.size() > 0) { editPharmacyTexts.get(editPharmacyTexts.size() - 1).setImeOptions(EditorInfo.IME_ACTION_DONE); } post(() -> initAdultAndChildrenHeaderHeight()); }
MMIARegimeList extends LinearLayout { public void initView(TextView totalView, TextView totalPharmacy, TextView tvTotalPharmacyTitle, MMIARequisitionPresenter presenter) { this.presenter = presenter; this.isPharmacyEmpty = presenter.getRnRForm().getRegimenThreeLineListWrapper().isEmpty(); this.dataList = presenter.getRnRForm().getRegimenItemListWrapper(); this.editTotalTexts = new ArrayList<>(); this.editPharmacyTexts = new ArrayList<>(); initCategoryList(dataList); this.totalView = totalView; this.totalPharmacy = totalPharmacy; this.totalPharmacyTitle = tvTotalPharmacyTitle; for (int i = 0; i < adults.size(); i++) { addItemView(adults.get(i), i); } if (isCustomEnable()) { addAdultBtnView(); } for (int i = 0; i < paediatrics.size(); i++) { addItemView(paediatrics.get(i), adults.size() + i); } if (isCustomEnable()) { addPaediatricsBtnView(); } totalView.setText(String.valueOf(getTotal(COUNTTYPE.AMOUNT))); totalPharmacy.setText(String.valueOf(getTotal(COUNTTYPE.PHARMACY))); editTotalTexts.get(editTotalTexts.size() - 1).setImeOptions(EditorInfo.IME_ACTION_DONE); if (editPharmacyTexts.size() > 0) { editPharmacyTexts.get(editPharmacyTexts.size() - 1).setImeOptions(EditorInfo.IME_ACTION_DONE); } post(() -> initAdultAndChildrenHeaderHeight()); } }
MMIARegimeList extends LinearLayout { public void initView(TextView totalView, TextView totalPharmacy, TextView tvTotalPharmacyTitle, MMIARequisitionPresenter presenter) { this.presenter = presenter; this.isPharmacyEmpty = presenter.getRnRForm().getRegimenThreeLineListWrapper().isEmpty(); this.dataList = presenter.getRnRForm().getRegimenItemListWrapper(); this.editTotalTexts = new ArrayList<>(); this.editPharmacyTexts = new ArrayList<>(); initCategoryList(dataList); this.totalView = totalView; this.totalPharmacy = totalPharmacy; this.totalPharmacyTitle = tvTotalPharmacyTitle; for (int i = 0; i < adults.size(); i++) { addItemView(adults.get(i), i); } if (isCustomEnable()) { addAdultBtnView(); } for (int i = 0; i < paediatrics.size(); i++) { addItemView(paediatrics.get(i), adults.size() + i); } if (isCustomEnable()) { addPaediatricsBtnView(); } totalView.setText(String.valueOf(getTotal(COUNTTYPE.AMOUNT))); totalPharmacy.setText(String.valueOf(getTotal(COUNTTYPE.PHARMACY))); editTotalTexts.get(editTotalTexts.size() - 1).setImeOptions(EditorInfo.IME_ACTION_DONE); if (editPharmacyTexts.size() > 0) { editPharmacyTexts.get(editPharmacyTexts.size() - 1).setImeOptions(EditorInfo.IME_ACTION_DONE); } post(() -> initAdultAndChildrenHeaderHeight()); } MMIARegimeList(Context context);  MMIARegimeList(Context context, AttributeSet attrs); }
MMIARegimeList extends LinearLayout { public void initView(TextView totalView, TextView totalPharmacy, TextView tvTotalPharmacyTitle, MMIARequisitionPresenter presenter) { this.presenter = presenter; this.isPharmacyEmpty = presenter.getRnRForm().getRegimenThreeLineListWrapper().isEmpty(); this.dataList = presenter.getRnRForm().getRegimenItemListWrapper(); this.editTotalTexts = new ArrayList<>(); this.editPharmacyTexts = new ArrayList<>(); initCategoryList(dataList); this.totalView = totalView; this.totalPharmacy = totalPharmacy; this.totalPharmacyTitle = tvTotalPharmacyTitle; for (int i = 0; i < adults.size(); i++) { addItemView(adults.get(i), i); } if (isCustomEnable()) { addAdultBtnView(); } for (int i = 0; i < paediatrics.size(); i++) { addItemView(paediatrics.get(i), adults.size() + i); } if (isCustomEnable()) { addPaediatricsBtnView(); } totalView.setText(String.valueOf(getTotal(COUNTTYPE.AMOUNT))); totalPharmacy.setText(String.valueOf(getTotal(COUNTTYPE.PHARMACY))); editTotalTexts.get(editTotalTexts.size() - 1).setImeOptions(EditorInfo.IME_ACTION_DONE); if (editPharmacyTexts.size() > 0) { editPharmacyTexts.get(editPharmacyTexts.size() - 1).setImeOptions(EditorInfo.IME_ACTION_DONE); } post(() -> initAdultAndChildrenHeaderHeight()); } MMIARegimeList(Context context);  MMIARegimeList(Context context, AttributeSet attrs); void initView(TextView totalView, TextView totalPharmacy, TextView tvTotalPharmacyTitle, MMIARequisitionPresenter presenter); void initAdultAndChildrenHeaderHeight(); List<RegimenItem> getDataList(); void deHighLightTotal(); boolean hasEmptyField(); void refreshRegimeView(); void addCustomRegimenItem(Regimen regimen); boolean isCompleted(); long getTotal(COUNTTYPE counttype); void setRegimeListener(MMIARegimeListener regimeListener); }
MMIARegimeList extends LinearLayout { public void initView(TextView totalView, TextView totalPharmacy, TextView tvTotalPharmacyTitle, MMIARequisitionPresenter presenter) { this.presenter = presenter; this.isPharmacyEmpty = presenter.getRnRForm().getRegimenThreeLineListWrapper().isEmpty(); this.dataList = presenter.getRnRForm().getRegimenItemListWrapper(); this.editTotalTexts = new ArrayList<>(); this.editPharmacyTexts = new ArrayList<>(); initCategoryList(dataList); this.totalView = totalView; this.totalPharmacy = totalPharmacy; this.totalPharmacyTitle = tvTotalPharmacyTitle; for (int i = 0; i < adults.size(); i++) { addItemView(adults.get(i), i); } if (isCustomEnable()) { addAdultBtnView(); } for (int i = 0; i < paediatrics.size(); i++) { addItemView(paediatrics.get(i), adults.size() + i); } if (isCustomEnable()) { addPaediatricsBtnView(); } totalView.setText(String.valueOf(getTotal(COUNTTYPE.AMOUNT))); totalPharmacy.setText(String.valueOf(getTotal(COUNTTYPE.PHARMACY))); editTotalTexts.get(editTotalTexts.size() - 1).setImeOptions(EditorInfo.IME_ACTION_DONE); if (editPharmacyTexts.size() > 0) { editPharmacyTexts.get(editPharmacyTexts.size() - 1).setImeOptions(EditorInfo.IME_ACTION_DONE); } post(() -> initAdultAndChildrenHeaderHeight()); } MMIARegimeList(Context context);  MMIARegimeList(Context context, AttributeSet attrs); void initView(TextView totalView, TextView totalPharmacy, TextView tvTotalPharmacyTitle, MMIARequisitionPresenter presenter); void initAdultAndChildrenHeaderHeight(); List<RegimenItem> getDataList(); void deHighLightTotal(); boolean hasEmptyField(); void refreshRegimeView(); void addCustomRegimenItem(Regimen regimen); boolean isCompleted(); long getTotal(COUNTTYPE counttype); void setRegimeListener(MMIARegimeListener regimeListener); public int adultHeight; public int childrenHeight; public boolean isPharmacyEmpty; }