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 fe1c6c3563..2e3431f853 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
@@ -93,7 +93,7 @@ public boolean showChildrenUnder5() {
@Override
public boolean launchChildClientsAtLogin() {
- return true;
+ return false;
}
@Override
@@ -175,4 +175,24 @@ public boolean showReportsDescription() {
public boolean showReportsDivider() {
return true;
}
+
+ @Override
+ public boolean hideChildRegisterPreviousNextIcons() {
+ return true;
+ }
+
+ @Override
+ public boolean hideFamilyRegisterPreviousNextIcons() {
+ return true;
+ }
+
+ @Override
+ public boolean showFamilyRegisterNextInToolbar() {
+ return true;
+ }
+
+ @Override
+ public boolean onFamilySaveGoToProfile() {
+ return true;
+ }
}
diff --git a/opensrp-chw/src/lmh/res/values/drawables.xml b/opensrp-chw/src/lmh/res/values/drawables.xml
new file mode 100644
index 0000000000..9c824aacc9
--- /dev/null
+++ b/opensrp-chw/src/lmh/res/values/drawables.xml
@@ -0,0 +1,4 @@
+
+
+ - @drawable/ic_input_add
+
\ No newline at end of file
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildRegisterActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildRegisterActivity.java
index 958d5e62b4..f3e29155f1 100644
--- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildRegisterActivity.java
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildRegisterActivity.java
@@ -2,8 +2,11 @@
import android.content.Intent;
+import com.vijay.jsonwizard.domain.Form;
+
import org.json.JSONObject;
import org.smartregister.chw.anc.util.Constants;
+import org.smartregister.chw.application.ChwApplication;
import org.smartregister.chw.core.activity.CoreChildRegisterActivity;
import org.smartregister.chw.core.contract.CoreChildRegisterContract;
import org.smartregister.chw.core.utils.CoreConstants;
@@ -49,4 +52,14 @@ protected void onActivityResultExtended(int requestCode, int resultCode, Intent
}
}
}
+
+ @Override
+ public Form getFormConfig() {
+ Form currentConfig = super.getFormConfig();
+ if (ChwApplication.getApplicationFlavor().hideChildRegisterPreviousNextIcons()){
+ currentConfig.setHideNextIcon(true);
+ currentConfig.setHidePreviousIcon(true);
+ }
+ return currentConfig;
+ }
}
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyRegisterActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyRegisterActivity.java
index c8afb3f9cd..94ce107a89 100644
--- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyRegisterActivity.java
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyRegisterActivity.java
@@ -6,14 +6,18 @@
import android.view.View;
import com.google.android.material.bottomnavigation.BottomNavigationView;
+import com.vijay.jsonwizard.domain.Form;
+import org.smartregister.chw.R;
import org.smartregister.chw.application.ChwApplication;
import org.smartregister.chw.core.activity.CoreFamilyRegisterActivity;
import org.smartregister.chw.core.custom_views.NavigationMenu;
import org.smartregister.chw.fragment.FamilyRegisterFragment;
import org.smartregister.chw.listener.ChwBottomNavigationListener;
+import org.smartregister.chw.presenter.FamilyRegisterPresenter;
import org.smartregister.chw.util.Constants;
import org.smartregister.chw.util.Utils;
+import org.smartregister.family.model.BaseFamilyRegisterModel;
import org.smartregister.helper.BottomNavigationHelper;
import org.smartregister.view.fragment.BaseRegisterFragment;
@@ -35,6 +39,11 @@ public static void registerBottomNavigation(
}
}
+ @Override
+ protected void initializePresenter() {
+ this.presenter = new FamilyRegisterPresenter(this, new BaseFamilyRegisterModel());
+ }
+
@Override
protected void registerBottomNavigation() {
super.registerBottomNavigation();
@@ -57,4 +66,20 @@ protected void onCreate(Bundle savedInstanceState) {
protected BaseRegisterFragment getRegisterFragment() {
return new FamilyRegisterFragment();
}
+
+
+ @Override
+ public Form getFormConfig() {
+ Form currentConfig = super.getFormConfig();
+ if (ChwApplication.getApplicationFlavor().hideFamilyRegisterPreviousNextIcons()){
+ currentConfig.setHidePreviousIcon(true);
+ currentConfig.setHideNextIcon(true);
+ }
+ if (ChwApplication.getApplicationFlavor().showFamilyRegisterNextInToolbar()){
+ currentConfig.setHideNextButton(true);
+ currentConfig.setNextLabel(getString(R.string.next));
+ currentConfig.setShowNextInToolbarWhenWizard(true);
+ }
+ return currentConfig;
+ }
}
\ No newline at end of file
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 f3800e5e85..2881b389e3 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
@@ -449,6 +449,14 @@ public interface Flavor {
boolean showReportsDivider();
+ boolean hideChildRegisterPreviousNextIcons();
+
+ boolean hideFamilyRegisterPreviousNextIcons();
+
+ boolean showFamilyRegisterNextInToolbar();
+
+ boolean onFamilySaveGoToProfile();
+
}
}
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 7613c2abeb..e8202ee4ea 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
@@ -235,4 +235,22 @@ public boolean showReportsDescription() {
public boolean showReportsDivider() {
return false;
}
+
+ public boolean hideChildRegisterPreviousNextIcons(){
+ return false;
+ }
+
+ public boolean hideFamilyRegisterPreviousNextIcons(){
+ return false;
+ }
+
+ @Override
+ public boolean showFamilyRegisterNextInToolbar() {
+ return false;
+ }
+
+ @Override
+ public boolean onFamilySaveGoToProfile() {
+ return false;
+ }
}
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/presenter/FamilyRegisterPresenter.java b/opensrp-chw/src/main/java/org/smartregister/chw/presenter/FamilyRegisterPresenter.java
new file mode 100644
index 0000000000..b5c6f0e00b
--- /dev/null
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/presenter/FamilyRegisterPresenter.java
@@ -0,0 +1,45 @@
+package org.smartregister.chw.presenter;
+
+import android.content.Intent;
+
+import org.smartregister.chw.application.ChwApplication;
+import org.smartregister.chw.interactor.FamilyProfileInteractor;
+import org.smartregister.domain.FetchStatus;
+import org.smartregister.family.contract.FamilyRegisterContract;
+import org.smartregister.family.domain.FamilyEventClient;
+import org.smartregister.family.presenter.BaseFamilyRegisterPresenter;
+import org.smartregister.family.util.Constants;
+import org.smartregister.family.util.Utils;
+import org.smartregister.view.contract.BaseRegisterContract;
+
+import java.util.List;
+
+public class FamilyRegisterPresenter extends BaseFamilyRegisterPresenter {
+ public FamilyRegisterPresenter(FamilyRegisterContract.View view, FamilyRegisterContract.Model model) {
+ super(view, model);
+ }
+
+ @Override
+ public void onRegistrationSaved(boolean isEditMode, boolean isSaved, List familyEventClientList) {
+ if (ChwApplication.getApplicationFlavor().onFamilySaveGoToProfile()){
+ BaseRegisterContract.View view = viewReference == null? null : viewReference.get();
+ if (view != null && view.getContext() != null) {
+// view.refreshList(FetchStatus.fetched);
+
+ FamilyEventClient familyEventClient = familyEventClientList.get(0);
+ FamilyEventClient headEventClient = familyEventClientList.get(1);
+ Intent intent = new Intent(view.getContext(), Utils.metadata().profileActivity);
+ intent.putExtra(Constants.INTENT_KEY.FAMILY_BASE_ENTITY_ID, familyEventClient.getClient().getBaseEntityId());
+// intent.putExtra("family_head", Utils.getValue(patient.getColumnmaps(), "family_head", false));
+// intent.putExtra("primary_caregiver", Utils.getValue(patient.getColumnmaps(), "primary_caregiver", false));
+// intent.putExtra("village_town", Utils.getValue(patient.getColumnmaps(), "village_town", false));
+// intent.putExtra("family_name", Utils.getValue(patient.getColumnmaps(), "first_name", false));
+// intent.putExtra("go_to_due_page", goToDuePage);
+ view.getContext().startActivity(intent);
+ view.hideProgressDialog();
+ }
+ }else{
+ super.onRegistrationSaved(isEditMode, isSaved, familyEventClientList);
+ }
+ }
+}