diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java
index c85117cfc6..d990b218d4 100644
--- a/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java
+++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java
@@ -161,4 +161,18 @@ public boolean showIconsForChildrenUnderTwoAndGirlsAgeNineToEleven(){
public boolean showBottomNavigation() {
return false;
}
+
+ @Override
+ public boolean disableChildRegistrationTitleGoBack() {
+ return true;
+ }
+
+ public boolean showReportsDescription() {
+ return true;
+ }
+
+ @Override
+ public boolean showReportsDivider() {
+ return true;
+ }
}
diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/fragment/BaseHomeVisitImmunizationFragmentFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/fragment/BaseHomeVisitImmunizationFragmentFlv.java
index f1a505d05d..16ae4d30cf 100644
--- a/opensrp-chw/src/lmh/java/org/smartregister/chw/fragment/BaseHomeVisitImmunizationFragmentFlv.java
+++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/fragment/BaseHomeVisitImmunizationFragmentFlv.java
@@ -2,9 +2,11 @@
import android.os.Bundle;
import android.view.View;
+import android.widget.DatePicker;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.VisibleForTesting;
import org.smartregister.chw.anc.contract.BaseAncHomeVisitContract;
import org.smartregister.chw.anc.domain.VaccineDisplay;
@@ -42,7 +44,17 @@ public static BaseHomeVisitImmunizationFragmentFlv getInstance(final BaseAncHome
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
- DatePickerUtils.themeDatePicker(singleDatePicker, new char[]{'d', 'm', 'y'});
+ callDatePickerUtilsThemeDatePicker(singleDatePicker, new char[]{'d', 'm', 'y'});
super.onViewCreated(view, savedInstanceState);
}
+
+ @VisibleForTesting
+ void callDatePickerUtilsThemeDatePicker(DatePicker datePicker, char[] ymdOrder){
+ DatePickerUtils.themeDatePicker(datePicker, ymdOrder);
+ }
+
+ @Override
+ protected void setDatePickerTheme(DatePicker picker) {
+ callDatePickerUtilsThemeDatePicker(picker, new char[]{'d', 'm', 'y'});
+ }
}
diff --git a/opensrp-chw/src/lmh/res/drawable/ic_navigate_next_grey_24dp.xml b/opensrp-chw/src/lmh/res/drawable/ic_navigate_next_grey_24dp.xml
new file mode 100644
index 0000000000..c809dbee8f
--- /dev/null
+++ b/opensrp-chw/src/lmh/res/drawable/ic_navigate_next_grey_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_receive.xml b/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_receive.xml
new file mode 100644
index 0000000000..e1a5381c8c
--- /dev/null
+++ b/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_receive.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_send.xml b/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_send.xml
new file mode 100644
index 0000000000..558afc034d
--- /dev/null
+++ b/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_send.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/opensrp-chw/src/lmh/res/drawable/p2p_card_text_color_selector.xml b/opensrp-chw/src/lmh/res/drawable/p2p_card_text_color_selector.xml
new file mode 100644
index 0000000000..c58a8cb97e
--- /dev/null
+++ b/opensrp-chw/src/lmh/res/drawable/p2p_card_text_color_selector.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/opensrp-chw/src/lmh/res/layout/fragment_mode_select.xml b/opensrp-chw/src/lmh/res/layout/fragment_mode_select.xml
new file mode 100644
index 0000000000..f04c2bb05e
--- /dev/null
+++ b/opensrp-chw/src/lmh/res/layout/fragment_mode_select.xml
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/opensrp-chw/src/lmh/res/layout/reports_fragment_item.xml b/opensrp-chw/src/lmh/res/layout/reports_fragment_item.xml
new file mode 100644
index 0000000000..7484b7756a
--- /dev/null
+++ b/opensrp-chw/src/lmh/res/layout/reports_fragment_item.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/opensrp-chw/src/lmh/res/values/strings.xml b/opensrp-chw/src/lmh/res/values/strings.xml
index 8db5da557b..8a335cb6dd 100644
--- a/opensrp-chw/src/lmh/res/values/strings.xml
+++ b/opensrp-chw/src/lmh/res/values/strings.xml
@@ -29,4 +29,11 @@
Transfer Data
All Children
Add New Family
+
+ Transfer Data
+ Tap to start receiving data from nearby device
+ Tap to start sending data to nearby device
+ List of children who can take the vaccines at a date in the future
+ Number of vaccine doses needed for children who can take the vaccine at a date in the future
+ Number on vaccines provided and child deaths in my area
\ No newline at end of file
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationValidator.java b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationValidator.java
index 798da170fc..63f3a056e8 100644
--- a/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationValidator.java
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationValidator.java
@@ -43,7 +43,7 @@ public ImmunizationValidator(
) {
vaccineSchedules = VisitVaccineUtil.getSchedule(vaccinesGroups, specialVaccines, vaccineCategory);
for (org.smartregister.immunization.domain.Vaccine vaccine : vaccines) {
- administeredVaccines.put(vaccine.getName(), vaccine.getDate());
+ administeredVaccines.put(vaccine.getName().toLowerCase(), vaccine.getDate());
}
}
@@ -134,8 +134,14 @@ public void onChanged(String s) {
// add all the received vaccines in the map
if (prevFragment != null) {
for (VaccineDisplay display : prevFragment.getVaccineDisplays().values()) {
- if (display.getValid())
- receivedVacs.put(display.getVaccineWrapper().getName(), display.getDateGiven());
+ String displayName = display.getVaccineWrapper().getName().toLowerCase();
+ if (display.getValid()) {
+ receivedVacs.put(displayName, display.getDateGiven());
+ } else if (receivedVacs.containsKey(displayName)
+ && !display.getValid() // If not valid, remove from administered vaccines
+ ) {
+ receivedVacs.remove(displayName);
+ }
}
}
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java b/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java
index 980c57199d..f427febde8 100644
--- a/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java
@@ -443,6 +443,12 @@ public interface Flavor {
boolean showBottomNavigation();
+ boolean disableChildRegistrationTitleGoBack();
+
+ boolean showReportsDescription();
+
+ boolean showReportsDivider();
+
}
}
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java b/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java
index 869b433eee..4652d3cfaa 100644
--- a/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java
@@ -221,4 +221,18 @@ public boolean showIconsForChildrenUnderTwoAndGirlsAgeNineToEleven(){
public boolean showBottomNavigation() {
return true;
}
+
+ @Override
+ public boolean disableChildRegistrationTitleGoBack() {
+ return false;
+ }
+
+ public boolean showReportsDescription() {
+ return false;
+ }
+
+ @Override
+ public boolean showReportsDivider() {
+ return false;
+ }
}
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/domain/ReportType.java b/opensrp-chw/src/main/java/org/smartregister/chw/domain/ReportType.java
index 130202568d..3179bd8aa5 100644
--- a/opensrp-chw/src/main/java/org/smartregister/chw/domain/ReportType.java
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/domain/ReportType.java
@@ -4,14 +4,29 @@
public class ReportType implements ListContract.Identifiable {
- private String id;
- private String name;
+ private final String id;
+ private final String name;
+ private String description;
public ReportType(String id, String name) {
this.id = id;
this.name = name;
}
+ public ReportType(String id, String name, String description){
+ this.id = id;
+ this.name = name;
+ this.description = description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
@Override
public String getID() {
return id;
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ChildRegisterFragment.java b/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ChildRegisterFragment.java
index 75e8208061..6dc279a2ad 100644
--- a/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ChildRegisterFragment.java
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ChildRegisterFragment.java
@@ -64,6 +64,11 @@ protected void initializePresenter() {
public void setupViews(android.view.View view) {
super.setupViews(view);
+ if (ChwApplication.getApplicationFlavor().disableChildRegistrationTitleGoBack()) {
+ android.view.View titleLayout = view.findViewById(R.id.title_layout);
+ titleLayout.setOnClickListener(null);
+ }
+
if (ChwApplication.getApplicationFlavor().hasDefaultDueFilterForChildClient()) {
android.view.View dueOnlyLayout = view.findViewById(org.smartregister.chw.core.R.id.due_only_layout);
dueOnlyLayout.setVisibility(android.view.View.VISIBLE);
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/fragment/DefaultBaseHomeVisitImmunizationFragment.java b/opensrp-chw/src/main/java/org/smartregister/chw/fragment/DefaultBaseHomeVisitImmunizationFragment.java
index 56f3983551..a8e2da9061 100644
--- a/opensrp-chw/src/main/java/org/smartregister/chw/fragment/DefaultBaseHomeVisitImmunizationFragment.java
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/fragment/DefaultBaseHomeVisitImmunizationFragment.java
@@ -249,6 +249,14 @@ private void onVariedResponsesMode() {
redrawView();
}
+ /**
+ * Sets theme for generated DatePickers
+ * @param picker
+ */
+ protected void setDatePickerTheme(DatePicker picker){
+ // no-op but may be extended in child fragments to set date picker theme
+ }
+
private void generateDatePickerViews() {
int x = 0;
while (vaccineViews.size() > x) {
@@ -257,6 +265,7 @@ private void generateDatePickerViews() {
View layout = inflater.inflate(R.layout.custom_single_vaccine_view, null);
TextView question = layout.findViewById(R.id.vaccines_given_when_title_question);
DatePicker datePicker = layout.findViewById(R.id.earlier_date_picker);
+ setDatePickerTheme(datePicker);
String translatedVaccineName = NCUtils.getStringResourceByName(vaccineView.vaccineName.toLowerCase().replace(" ", "_"), getActivity());
question.setText(getString(R.string.when_vaccine, translatedVaccineName));
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ReportsFragment.java b/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ReportsFragment.java
index 7c90f54d95..6a3b3441f4 100644
--- a/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ReportsFragment.java
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ReportsFragment.java
@@ -9,6 +9,7 @@
import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -16,6 +17,7 @@
import org.smartregister.chw.activity.FragmentBaseActivity;
import org.smartregister.chw.adapter.ListableAdapter;
import org.smartregister.chw.adapter.ReportsFragmentAdapter;
+import org.smartregister.chw.application.ChwApplication;
import org.smartregister.chw.contract.ListContract;
import org.smartregister.chw.core.custom_views.NavigationMenu;
import org.smartregister.chw.domain.ReportType;
@@ -47,9 +49,15 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
presenter.fetchList(() -> {
List list = new ArrayList<>();
- list.add(new ReportType(getString(R.string.eligible_children), getString(R.string.eligible_children)));
- list.add(new ReportType(getString(R.string.doses_needed), getString(R.string.doses_needed)));
- list.add(new ReportType(getString(R.string.community_activity), getString(R.string.community_activity)));
+ if (ChwApplication.getApplicationFlavor().showReportsDescription()){
+ list.add(new ReportType(getString(R.string.eligible_children), getString(R.string.eligible_children), getString(R.string.eligible_children_description)));
+ list.add(new ReportType(getString(R.string.doses_needed), getString(R.string.doses_needed), getString(R.string.doses_needed_description)));
+ list.add(new ReportType(getString(R.string.community_activity), getString(R.string.community_activity), getString(R.string.community_activity_description)));
+ }else {
+ list.add(new ReportType(getString(R.string.eligible_children), getString(R.string.eligible_children)));
+ list.add(new ReportType(getString(R.string.doses_needed), getString(R.string.doses_needed)));
+ list.add(new ReportType(getString(R.string.community_activity), getString(R.string.community_activity)));
+ }
return list;
});
@@ -61,9 +69,13 @@ public void bindLayout() {
RecyclerView recyclerView = view.findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(false);
- RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
+ LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(layoutManager);
+ if (ChwApplication.getApplicationFlavor().showReportsDivider()){
+ recyclerView.addItemDecoration(new DividerItemDecoration(requireContext(), layoutManager.getOrientation()));
+ }
+
progressBar = view.findViewById(R.id.progress_bar);
progressBar.setVisibility(View.GONE);
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/viewholder/ReportViewHolder.java b/opensrp-chw/src/main/java/org/smartregister/chw/viewholder/ReportViewHolder.java
index 38aae34a6e..07df1c1741 100644
--- a/opensrp-chw/src/main/java/org/smartregister/chw/viewholder/ReportViewHolder.java
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/viewholder/ReportViewHolder.java
@@ -6,28 +6,39 @@
import androidx.annotation.NonNull;
import org.smartregister.chw.R;
+import org.smartregister.chw.application.ChwApplication;
import org.smartregister.chw.contract.ListContract;
import org.smartregister.chw.domain.ReportType;
public class ReportViewHolder extends ListableViewHolder {
private TextView tvName;
+ private TextView tvDesc;
private View currentView;
public ReportViewHolder(@NonNull View itemView) {
super(itemView);
currentView = itemView;
tvName = itemView.findViewById(R.id.tvName);
+ if (ChwApplication.getApplicationFlavor().showReportsDescription()) {
+ tvDesc = itemView.findViewById(R.id.tvDesc);
+ }
}
@Override
public void bindView(ReportType reportType, ListContract.View view) {
tvName.setText(reportType.getName());
+ if (tvDesc != null){
+ tvDesc.setText(reportType.getDescription());
+ }
currentView.setOnClickListener(v -> view.onListItemClicked(reportType, v.getId()));
}
@Override
public void resetView() {
tvName.setText("");
+ if (tvDesc != null){
+ tvDesc.setText("");
+ }
}
}
diff --git a/opensrp-chw/src/main/res/drawable/ic_navigate_next_black_24dp.xml b/opensrp-chw/src/main/res/drawable/ic_navigate_next_black_24dp.xml
index 24835127dd..125885ad41 100644
--- a/opensrp-chw/src/main/res/drawable/ic_navigate_next_black_24dp.xml
+++ b/opensrp-chw/src/main/res/drawable/ic_navigate_next_black_24dp.xml
@@ -1,9 +1,9 @@
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z" />
diff --git a/opensrp-chw/src/main/res/layout/activity_fragment_base.xml b/opensrp-chw/src/main/res/layout/activity_fragment_base.xml
index ac77838660..b7983b317d 100644
--- a/opensrp-chw/src/main/res/layout/activity_fragment_base.xml
+++ b/opensrp-chw/src/main/res/layout/activity_fragment_base.xml
@@ -2,6 +2,7 @@
-
+ android:paddingRight="25dp"
+ android:paddingBottom="20dp">
-
+ android:orientation="vertical"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/ivNext"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+
+
+
+
+
+ android:layout_height="30dp"
+ android:src="@drawable/ic_navigate_next_black_24dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
-
\ No newline at end of file
+
diff --git a/opensrp-chw/src/test/java/org/smartregister/chw/fragment/ChildRegisterFragmentTest.java b/opensrp-chw/src/test/java/org/smartregister/chw/fragment/ChildRegisterFragmentTest.java
index 2815047873..bde1b95491 100644
--- a/opensrp-chw/src/test/java/org/smartregister/chw/fragment/ChildRegisterFragmentTest.java
+++ b/opensrp-chw/src/test/java/org/smartregister/chw/fragment/ChildRegisterFragmentTest.java
@@ -19,6 +19,8 @@
import org.smartregister.Context;
import org.smartregister.CoreLibrary;
import org.smartregister.chw.BaseUnitTest;
+import org.smartregister.chw.R;
+import org.smartregister.chw.application.ChwApplication;
import org.smartregister.chw.core.presenter.CoreChildRegisterFragmentPresenter;
import org.smartregister.commonregistry.CommonRepository;
import org.smartregister.domain.FetchStatus;
@@ -27,8 +29,13 @@
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -93,12 +100,30 @@ public void testSetupViews() {
when(fragment.getActivity()).thenReturn(activity);
when(fragment.getContext()).thenReturn(activity);
View view = LayoutInflater.from(activity).inflate(org.smartregister.chw.core.R.layout.fragment_base_register, null);
+ View dueOnlyLayout = view.findViewById(org.smartregister.chw.core.R.id.due_only_layout);
+ doNothing().when(fragment).toggleFilterSelection(eq(dueOnlyLayout));
fragment.setupViews(view);
- View dueOnlyLayout = view.findViewById(org.smartregister.chw.core.R.id.due_only_layout);
dueOnlyLayout.setVisibility(View.VISIBLE);
assertEquals(View.VISIBLE, dueOnlyLayout.getVisibility());
}
+
+ @Test
+ public void testSetUpViewsWithDisableChildRegistrationTitleGoBack(){
+ when(fragment.getActivity()).thenReturn(activity);
+ when(fragment.getContext()).thenReturn(activity);
+ View view = LayoutInflater.from(activity).inflate(org.smartregister.chw.core.R.layout.fragment_base_register, null);
+ View dueOnlyLayout = view.findViewById(org.smartregister.chw.core.R.id.due_only_layout);
+ doNothing().when(fragment).toggleFilterSelection(eq(dueOnlyLayout));
+ fragment.setupViews(view);
+
+ View titleLayout = view.findViewById(R.id.title_layout);
+ if (ChwApplication.getApplicationFlavor().disableChildRegistrationTitleGoBack()){
+ assertFalse(titleLayout.hasOnClickListeners());
+ }else{
+ assertTrue(titleLayout.hasOnClickListeners());
+ }
+ }
}
diff --git a/opensrp-chw/src/testLmh/java/org/smartregister/chw/fragment/BaseHomeVisitImmunizationFragmentFlvTest.java b/opensrp-chw/src/testLmh/java/org/smartregister/chw/fragment/BaseHomeVisitImmunizationFragmentFlvTest.java
new file mode 100644
index 0000000000..79d5e27491
--- /dev/null
+++ b/opensrp-chw/src/testLmh/java/org/smartregister/chw/fragment/BaseHomeVisitImmunizationFragmentFlvTest.java
@@ -0,0 +1,36 @@
+package org.smartregister.chw.fragment;
+
+import android.widget.DatePicker;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.AdditionalMatchers;
+import org.mockito.Spy;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+public class BaseHomeVisitImmunizationFragmentFlvTest {
+
+ @Spy
+ BaseHomeVisitImmunizationFragmentFlv fragmentFlv;
+
+ @Before
+ public void setUp(){
+ initMocks(this);
+ }
+
+ @Test
+ public void testSetDatePickerThemeSetsCorrectFormat() {
+ DatePicker datePicker = mock(DatePicker.class);
+ doNothing().when(fragmentFlv).callDatePickerUtilsThemeDatePicker(any(), any());
+ fragmentFlv.setDatePickerTheme(datePicker);
+ verify(fragmentFlv).callDatePickerUtilsThemeDatePicker(eq(datePicker), AdditionalMatchers.aryEq(new char[]{'d', 'm', 'y'}));
+ }
+
+
+}