diff --git a/opensrp-chw-core/build.gradle b/opensrp-chw-core/build.gradle index 6ca0403be4..8cc289fb0c 100644 --- a/opensrp-chw-core/build.gradle +++ b/opensrp-chw-core/build.gradle @@ -143,7 +143,7 @@ dependencies { exclude group: 'xpp3', module: 'xpp3' } - api('org.smartregister:opensrp-client-native-form:1.14.5.5.1-SNAPSHOT@aar') { + api('org.smartregister:opensrp-client-native-form:1.14.5.5.2-TEST-SNAPSHOT@aar') { transitive = true exclude group: 'com.android.support', module: 'appcompat-v7' exclude group: 'com.android.support', module: 'cardview-v7' diff --git a/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreAncMemberProfileActivity.java b/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreAncMemberProfileActivity.java index 843c3bfe6f..0580d6f3ac 100644 --- a/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreAncMemberProfileActivity.java +++ b/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreAncMemberProfileActivity.java @@ -13,6 +13,8 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.vijay.jsonwizard.domain.Form; + import org.jeasy.rules.api.Rules; import org.joda.time.LocalDate; import org.joda.time.Months; @@ -109,9 +111,17 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { } } + public Form getForm(){ + Form form = new Form(); + form.setActionBarBackground(R.color.family_actionbar); + form.setWizard(false); + return form; + } + public void startFormActivity(JSONObject formJson) { - startActivityForResult(CoreJsonFormUtils.getJsonIntent(this, formJson, - Utils.metadata().familyMemberFormActivity), JsonFormUtils.REQUEST_CODE_GET_JSON); + startActivityForResult( + CoreJsonFormUtils.getJsonIntent(this, formJson,Utils.metadata().familyMemberFormActivity, getForm()), + JsonFormUtils.REQUEST_CODE_GET_JSON); } // to chw diff --git a/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreChildProfileActivity.java b/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreChildProfileActivity.java index 4c8d5b97a2..08cc5cafc8 100644 --- a/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreChildProfileActivity.java +++ b/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreChildProfileActivity.java @@ -28,6 +28,7 @@ import androidx.viewpager.widget.ViewPager; import com.google.android.material.appbar.AppBarLayout; +import com.vijay.jsonwizard.domain.Form; import org.apache.commons.lang3.tuple.Triple; import org.jetbrains.annotations.NotNull; @@ -323,10 +324,18 @@ public Context getContext() { return this; } + public Form getForm(){ + Form form = new Form(); + form.setActionBarBackground(R.color.family_actionbar); + form.setWizard(false); + return form; + } + @Override public void startFormActivity(JSONObject jsonForm) { - startActivityForResult(CoreJsonFormUtils.getJsonIntent(this, jsonForm, - Utils.metadata().familyMemberFormActivity), JsonFormUtils.REQUEST_CODE_GET_JSON); + startActivityForResult( + CoreJsonFormUtils.getJsonIntent(this, jsonForm,Utils.metadata().familyMemberFormActivity, getForm()), + JsonFormUtils.REQUEST_CODE_GET_JSON); } @Override diff --git a/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreFamilyOtherMemberProfileActivity.java b/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreFamilyOtherMemberProfileActivity.java index da00022be2..9e7a34e7d2 100644 --- a/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreFamilyOtherMemberProfileActivity.java +++ b/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreFamilyOtherMemberProfileActivity.java @@ -213,16 +213,19 @@ protected abstract BaseProfileContract.Presenter getFamilyOtherMemberActivityPre protected abstract CoreFamilyMemberFloatingMenu getFamilyMemberFloatingMenu(); + public Form getForm(){ + Form form = new Form(); + form.setActionBarBackground(R.color.family_actionbar); + form.setWizard(false); + return form; + } + public void startFormActivity(JSONObject jsonForm) { Intent intent = new Intent(this, Utils.metadata().familyMemberFormActivity); intent.putExtra(Constants.JSON_FORM_EXTRA.JSON, jsonForm.toString()); - - Form form = new Form(); - form.setActionBarBackground(R.color.family_actionbar); - form.setWizard(false); - intent.putExtra(JsonFormConstants.JSON_FORM_KEY.FORM, form); + intent.putExtra(JsonFormConstants.JSON_FORM_KEY.FORM, getForm()); startActivityForResult(intent, JsonFormUtils.REQUEST_CODE_GET_JSON); } diff --git a/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreFamilyProfileActivity.java b/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreFamilyProfileActivity.java index e6d2c22615..707f47e1cd 100644 --- a/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreFamilyProfileActivity.java +++ b/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CoreFamilyProfileActivity.java @@ -18,6 +18,9 @@ import androidx.fragment.app.Fragment; import androidx.viewpager.widget.ViewPager; +import com.vijay.jsonwizard.constants.JsonFormConstants; +import com.vijay.jsonwizard.domain.Form; + import org.apache.commons.lang3.StringUtils; import org.greenrobot.eventbus.EventBus; import org.json.JSONObject; @@ -278,6 +281,23 @@ public void updateHasPhone(boolean hasPhone) { } } + public Form getFormConfig(){ + Form form = new Form(); + form.setActionBarBackground(R.color.family_actionbar); + form.setWizard(false); + return form; + } + + @Override + public void startFormActivity(JSONObject jsonForm) { + Intent intent = new Intent(this, Utils.metadata().familyMemberFormActivity); + intent.putExtra(Constants.JSON_FORM_EXTRA.JSON, jsonForm.toString()); + + intent.putExtra(JsonFormConstants.JSON_FORM_KEY.FORM, getFormConfig()); + + startActivityForResult(intent, JsonFormUtils.REQUEST_CODE_GET_JSON); + } + @Override protected void initializePresenter() { familyBaseEntityId = getIntent().getStringExtra(Constants.INTENT_KEY.FAMILY_BASE_ENTITY_ID); diff --git a/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CorePncMemberProfileActivity.java b/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CorePncMemberProfileActivity.java index 9ccb3b797b..f94f5ac3f1 100644 --- a/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CorePncMemberProfileActivity.java +++ b/opensrp-chw-core/src/main/java/org/smartregister/chw/core/activity/CorePncMemberProfileActivity.java @@ -13,6 +13,8 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.vijay.jsonwizard.domain.Form; + import org.json.JSONObject; import org.smartregister.chw.anc.domain.MemberObject; import org.smartregister.chw.anc.util.NCUtils; @@ -101,10 +103,18 @@ protected static CommonPersonObjectClient getClientDetailsByBaseEntityID(@NonNul return getCommonPersonObjectClient(baseEntityId); } + public Form getForm(){ + Form form = new Form(); + form.setActionBarBackground(R.color.family_actionbar); + form.setWizard(false); + return form; + } + @Override public void startFormActivity(JSONObject formJson) { - startActivityForResult(CoreJsonFormUtils.getJsonIntent(this, formJson, - org.smartregister.family.util.Utils.metadata().familyMemberFormActivity), JsonFormUtils.REQUEST_CODE_GET_JSON); + startActivityForResult( + CoreJsonFormUtils.getJsonIntent(this, formJson,org.smartregister.family.util.Utils.metadata().familyMemberFormActivity, getForm()), + JsonFormUtils.REQUEST_CODE_GET_JSON); } protected List getChildren(MemberObject memberObject) { diff --git a/opensrp-chw-core/src/main/java/org/smartregister/chw/core/utils/CoreJsonFormUtils.java b/opensrp-chw-core/src/main/java/org/smartregister/chw/core/utils/CoreJsonFormUtils.java index e81bed6462..8f369b081e 100644 --- a/opensrp-chw-core/src/main/java/org/smartregister/chw/core/utils/CoreJsonFormUtils.java +++ b/opensrp-chw-core/src/main/java/org/smartregister/chw/core/utils/CoreJsonFormUtils.java @@ -76,12 +76,16 @@ public class CoreJsonFormUtils extends org.smartregister.family.util.JsonFormUti private static final String LOCATION_UUIDS = "location_uuids"; public static Intent getJsonIntent(Context context, JSONObject jsonForm, Class activityClass) { - Intent intent = new Intent(context, activityClass); - intent.putExtra(Constants.JSON_FORM_EXTRA.JSON, jsonForm.toString()); Form form = new Form(); form.setActionBarBackground(R.color.family_actionbar); form.setWizard(false); - intent.putExtra(JsonFormConstants.JSON_FORM_KEY.FORM, form); + return getJsonIntent(context, jsonForm, activityClass, form); + } + + public static Intent getJsonIntent(Context context, JSONObject jsonForm, Class activityClass, Form formConfig){ + Intent intent = new Intent(context, activityClass); + intent.putExtra(Constants.JSON_FORM_EXTRA.JSON, jsonForm.toString()); + intent.putExtra(JsonFormConstants.JSON_FORM_KEY.FORM, formConfig); return intent; }