From c97cec3d1575b87e50b7ccbc264af8adbebbb2b4 Mon Sep 17 00:00:00 2001 From: vend Date: Wed, 21 Jun 2023 14:14:19 +0500 Subject: [PATCH 1/9] added the maked character support --- .../vijay/jsonwizard/constants/JsonFormConstants.java | 1 + .../com/vijay/jsonwizard/widgets/EditTextFactory.java | 10 ++++++++-- .../jsonwizard/widgets/NativeEditTextFactory.java | 5 +++++ gradle.properties | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/constants/JsonFormConstants.java b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/constants/JsonFormConstants.java index 1a9b69aed..b034aaef8 100644 --- a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/constants/JsonFormConstants.java +++ b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/constants/JsonFormConstants.java @@ -148,6 +148,7 @@ public class JsonFormConstants { public static final String EXPANDED = "expanded"; public static final String EXPAND_ON_TEXT_CHANGE = "expand_on_text_change"; public static final String NUMBER = "number"; + public static final String PASSWORD = "password"; public static final String TOP_MARGIN = "top_margin"; public static final String BOTTOM_MARGIN = "bottom_margin"; public static final String LEFT_MARGIN = "left_margin"; diff --git a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/EditTextFactory.java b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/EditTextFactory.java index 6a05a3bbb..52aafac0e 100644 --- a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/EditTextFactory.java +++ b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/EditTextFactory.java @@ -19,6 +19,7 @@ import android.text.InputType; import android.text.TextUtils; import android.text.TextWatcher; +import android.text.method.PasswordTransformationMethod; import android.util.Patterns; import android.view.LayoutInflater; import android.view.View; @@ -117,7 +118,6 @@ protected List attachJson(String stepName, Context context, JsonFormFragme RelativeLayout editTextLayout = rootLayout.findViewById(R.id.edit_text_layout); MaterialEditText editText = editTextLayout.findViewById(R.id.edit_text); ImageView editButton = editTextLayout.findViewById(R.id.material_edit_text_edit_button); - FormUtils.setEditButtonAttributes(jsonObject, editText, editButton, listener); attachLayout(stepName, context, formFragment, jsonObject, editText, editButton); @@ -190,15 +190,21 @@ public void run() { addCumulativeTotalValidator(jsonObject, formFragment, editText, stepName, (JsonApi) context); // edit type check String editType = jsonObject.optString(JsonFormConstants.EDIT_TYPE); + editText.setSingleLine(false); if (!TextUtils.isEmpty(editType)) { if (JsonFormConstants.NUMBER.equals(editType)) { editText.setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); } else if (JsonFormConstants.NAME.equals(editType)) { editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS); } + else if (JsonFormConstants.PASSWORD.equals(editType)) + { + editText.setTransformationMethod(PasswordTransformationMethod.getInstance()); + } + } - editText.setSingleLine(false); + editText.addTextChangedListener(new GenericTextWatcher(stepName, formFragment, editText)); attachRefreshLogic(context, jsonObject, editText); } diff --git a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/NativeEditTextFactory.java b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/NativeEditTextFactory.java index 169f5431e..2c0f2fd2a 100644 --- a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/NativeEditTextFactory.java +++ b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/NativeEditTextFactory.java @@ -4,6 +4,7 @@ import android.os.Build; import android.text.InputType; import android.text.TextUtils; +import android.text.method.PasswordTransformationMethod; import android.util.Patterns; import android.view.LayoutInflater; import android.view.View; @@ -144,6 +145,10 @@ protected void makeFromJson(String stepName, Context context, JsonFormFragment f } else if ("name".equals(editType)) { editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS); } + else if ("password".equals(editType)) + { + editText.setTransformationMethod(PasswordTransformationMethod.getInstance()); + } } editText.addTextChangedListener(new GenericTextWatcher(stepName, formFragment, editText)); diff --git a/gradle.properties b/gradle.properties index 5abb92c86..2c363ec8b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=3.1.1-SNAPSHOT +VERSION_NAME=3.1.3-SNAPSHOT VERSION_CODE=1 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Native Form Json Wizard From 049ab85791fb87c6db3114a1bd8f66bf59fdcb41 Mon Sep 17 00:00:00 2001 From: vend Date: Wed, 21 Jun 2023 14:21:34 +0500 Subject: [PATCH 2/9] code reformatted --- .../jsonwizard/widgets/EditTextFactory.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/EditTextFactory.java b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/EditTextFactory.java index 52aafac0e..9cf44f9d3 100644 --- a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/EditTextFactory.java +++ b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/EditTextFactory.java @@ -1,18 +1,5 @@ package com.vijay.jsonwizard.widgets; -import static com.vijay.jsonwizard.constants.JsonFormConstants.DEFAULT_CUMULATIVE_VALIDATION_ERR; -import static com.vijay.jsonwizard.constants.JsonFormConstants.DEFAULT_RELATIVE_MAX_VALIDATION_ERR; -import static com.vijay.jsonwizard.constants.JsonFormConstants.DEFAULT_RELATIVE_MIN_VALIDATION_ERR; -import static com.vijay.jsonwizard.constants.JsonFormConstants.KEY; -import static com.vijay.jsonwizard.constants.JsonFormConstants.RELATED_FIELDS; -import static com.vijay.jsonwizard.constants.JsonFormConstants.RELATIVE_VALIDATION_EXCEPTION; -import static com.vijay.jsonwizard.constants.JsonFormConstants.STEP1; -import static com.vijay.jsonwizard.constants.JsonFormConstants.V_CUMULATIVE_TOTAL; -import static com.vijay.jsonwizard.constants.JsonFormConstants.V_RELATIVE_MAX; -import static com.vijay.jsonwizard.constants.JsonFormConstants.V_RELATIVE_MIN; -import static com.vijay.jsonwizard.utils.FormUtils.fields; -import static com.vijay.jsonwizard.utils.FormUtils.getFieldJSONObject; - import android.content.Context; import android.text.Editable; import android.text.InputFilter; @@ -61,6 +48,19 @@ import timber.log.Timber; +import static com.vijay.jsonwizard.constants.JsonFormConstants.DEFAULT_CUMULATIVE_VALIDATION_ERR; +import static com.vijay.jsonwizard.constants.JsonFormConstants.DEFAULT_RELATIVE_MAX_VALIDATION_ERR; +import static com.vijay.jsonwizard.constants.JsonFormConstants.DEFAULT_RELATIVE_MIN_VALIDATION_ERR; +import static com.vijay.jsonwizard.constants.JsonFormConstants.KEY; +import static com.vijay.jsonwizard.constants.JsonFormConstants.RELATED_FIELDS; +import static com.vijay.jsonwizard.constants.JsonFormConstants.RELATIVE_VALIDATION_EXCEPTION; +import static com.vijay.jsonwizard.constants.JsonFormConstants.STEP1; +import static com.vijay.jsonwizard.constants.JsonFormConstants.V_CUMULATIVE_TOTAL; +import static com.vijay.jsonwizard.constants.JsonFormConstants.V_RELATIVE_MAX; +import static com.vijay.jsonwizard.constants.JsonFormConstants.V_RELATIVE_MIN; +import static com.vijay.jsonwizard.utils.FormUtils.fields; +import static com.vijay.jsonwizard.utils.FormUtils.getFieldJSONObject; + public class EditTextFactory implements FormWidgetFactory { public static final int MIN_LENGTH = 0; @@ -203,8 +203,6 @@ else if (JsonFormConstants.PASSWORD.equals(editType)) } } - - editText.addTextChangedListener(new GenericTextWatcher(stepName, formFragment, editText)); attachRefreshLogic(context, jsonObject, editText); } From 49bec102a2d3fde24c9e8630fb27d9b9c04a54ad Mon Sep 17 00:00:00 2001 From: vend Date: Fri, 23 Jun 2023 16:52:21 +0500 Subject: [PATCH 3/9] added field character referencing in forms --- .../constants/JsonFormConstants.java | 1 + .../edittext/ReferenceFieldValidator.java | 25 +++++++++++++++++++ .../jsonwizard/widgets/EditTextFactory.java | 11 ++++++++ 3 files changed, 37 insertions(+) create mode 100644 android-json-form-wizard/src/main/java/com/vijay/jsonwizard/validators/edittext/ReferenceFieldValidator.java diff --git a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/constants/JsonFormConstants.java b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/constants/JsonFormConstants.java index b034aaef8..d9190ca03 100644 --- a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/constants/JsonFormConstants.java +++ b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/constants/JsonFormConstants.java @@ -57,6 +57,7 @@ public class JsonFormConstants { public static final String BEHAVIOUR = "behaviour"; public static final String RESULT = "result"; public static final String VALUE = "value"; + public static final String V_EQUALS = "v_equals"; public static final String KEYS = "keys"; public static final String SECOND_VALUE = "second_value"; public static final String OPENMRS_ENTITY_PARENT = "openmrs_entity_parent"; diff --git a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/validators/edittext/ReferenceFieldValidator.java b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/validators/edittext/ReferenceFieldValidator.java new file mode 100644 index 000000000..b5db28f4b --- /dev/null +++ b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/validators/edittext/ReferenceFieldValidator.java @@ -0,0 +1,25 @@ +package com.vijay.jsonwizard.validators.edittext; + +import androidx.annotation.NonNull; + +import com.rengwuxian.materialedittext.MaterialEditText; +import com.rengwuxian.materialedittext.validation.METValidator; + +import org.jetbrains.annotations.NotNull; + +public class ReferenceFieldValidator extends METValidator { + MaterialEditText referenceField; + public ReferenceFieldValidator(@NonNull @NotNull String errorMessage,MaterialEditText referenceField) { + super(errorMessage); + this.referenceField = referenceField; + } + + @Override + public boolean isValid(@NonNull @NotNull CharSequence charSequence, boolean isEmpty) { + if(!isEmpty) { + String referenceText = referenceField.getText().toString(); + return referenceText.equals(charSequence.toString()); + } + return true; + } +} diff --git a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/EditTextFactory.java b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/EditTextFactory.java index 9cf44f9d3..45ff0b47b 100644 --- a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/EditTextFactory.java +++ b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/EditTextFactory.java @@ -31,6 +31,7 @@ import com.vijay.jsonwizard.validators.edittext.MaxNumericValidator; import com.vijay.jsonwizard.validators.edittext.MinLengthValidator; import com.vijay.jsonwizard.validators.edittext.MinNumericValidator; +import com.vijay.jsonwizard.validators.edittext.ReferenceFieldValidator; import com.vijay.jsonwizard.validators.edittext.ReferenceValidator; import com.vijay.jsonwizard.validators.edittext.RelativeNumericValidator; import com.vijay.jsonwizard.validators.edittext.RequiredValidator; @@ -179,6 +180,7 @@ public void run() { FormUtils.toggleEditTextVisibility(jsonObject, editText); addRequiredValidator(jsonObject, editText); + addEqualsValidator(formFragment,jsonObject,editText); addLengthValidator(jsonObject, editText); addRegexValidator(jsonObject, editText); addEmailValidator(jsonObject, editText); @@ -216,6 +218,15 @@ private void attachInfoIcon(String stepName, JSONObject jsonObject, RelativeLayo } + private void addEqualsValidator(JsonFormFragment formFragment,JSONObject jsonObject, MaterialEditText editText) throws JSONException { + JSONObject requiredObject = jsonObject.optJSONObject(JsonFormConstants.V_EQUALS); + if (requiredObject != null) { + String referencedValue = requiredObject.optString(JsonFormConstants.VALUE,""); + MaterialEditText referencedEditText = (MaterialEditText) formFragment.getJsonApi().getFormDataView(referencedValue); + editText.addValidator(new ReferenceFieldValidator(requiredObject.getString(JsonFormConstants.ERR),referencedEditText)); + FormUtils.setRequiredOnHint(editText); + } + } private void addRequiredValidator(JSONObject jsonObject, MaterialEditText editText) throws JSONException { JSONObject requiredObject = jsonObject.optJSONObject(JsonFormConstants.V_REQUIRED); if (requiredObject != null) { From 63cd5790198c861dd93e4c2d084e1620d18afbd0 Mon Sep 17 00:00:00 2001 From: vend Date: Wed, 2 Aug 2023 13:12:06 +0500 Subject: [PATCH 4/9] added the data decompression feature for optibp data --- .../com/vijay/jsonwizard/utils/Utils.java | 27 +++++++++++++++++++ .../widgets/OptiBPWidgetFactory.java | 2 +- gradle.properties | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/utils/Utils.java b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/utils/Utils.java index 57c56f552..1f5d749f0 100644 --- a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/utils/Utils.java +++ b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/utils/Utils.java @@ -56,10 +56,13 @@ import org.json.JSONObject; import org.yaml.snakeyaml.Yaml; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.net.URLDecoder; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -75,6 +78,7 @@ import java.util.Scanner; import java.util.Set; import java.util.concurrent.TimeUnit; +import java.util.zip.GZIPInputStream; import timber.log.Timber; @@ -1041,6 +1045,29 @@ public static String extractValueFromJson(String value) return value; } + public static String decompress(String str, String outEncoding) { + if (str == null || str.length() == 0) { + return str; + } + + try { + String decode = URLDecoder.decode(str, "UTF-8"); + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + ByteArrayInputStream in = new ByteArrayInputStream(decode.getBytes("ISO-8859-1")); + GZIPInputStream gunzip = new GZIPInputStream(in); + byte[] buffer = new byte[256]; + int n; + while ((n = gunzip.read(buffer)) >= 0) { + out.write(buffer, 0, n); + } + return out.toString(outEncoding); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + } diff --git a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/OptiBPWidgetFactory.java b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/OptiBPWidgetFactory.java index 619e85e09..a4ed99291 100644 --- a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/OptiBPWidgetFactory.java +++ b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/OptiBPWidgetFactory.java @@ -333,7 +333,7 @@ protected String getInputJsonString(Context context, JSONObject jsonObject, Widg * Adding new calibration data here */ appendHealthData(optiBPData, widgetArgs); - optiBPData.put(OptibpConstants.CALIBRATION, getCalibrationData(optiBPData.optString(OptibpConstants.CALIBRATION))); + optiBPData.put(OptibpConstants.CALIBRATION, getCalibrationData(Utils.decompress(optiBPData.optString(OptibpConstants.CALIBRATION),"UTF-8"))); return optiBPData.toString(); } diff --git a/gradle.properties b/gradle.properties index 2c363ec8b..d08b7813d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=3.1.3-SNAPSHOT +VERSION_NAME=3.1.4-SNAPSHOT VERSION_CODE=1 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Native Form Json Wizard From a5c5151bd7cbff9a483fa32571f549051d162c66 Mon Sep 17 00:00:00 2001 From: Hamza Ahmed Khan Date: Fri, 4 Aug 2023 13:46:01 +0500 Subject: [PATCH 5/9] Removing unnecessary multi-threading to avoid relevance issues --- .../activities/JsonFormActivity.java | 84 +++++++++---------- 1 file changed, 39 insertions(+), 45 deletions(-) diff --git a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/activities/JsonFormActivity.java b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/activities/JsonFormActivity.java index 42287b5d2..2be60f2fa 100644 --- a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/activities/JsonFormActivity.java +++ b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/activities/JsonFormActivity.java @@ -372,41 +372,37 @@ public Pair getCalculationAddressAndValue(View view) throw @Override public void refreshCalculationLogic(String parentKey, String childKey, boolean popup, String stepName, boolean isForNextStep) { - appExecutors.diskIO().execute(() ->{ - Set viewsIds = calculationDependencyMap.get(stepName + "_" + parentKey); - if (parentKey == null || viewsIds == null) - viewsIds = calculationLogicViews.keySet(); - for (String viewId : viewsIds) { - try { - View curView = calculationLogicViews.get(viewId); - if (curView == null) { - Timber.w("calculationLogicViews Missing %s", viewId); - continue; + Set viewsIds = calculationDependencyMap.get(stepName + "_" + parentKey); + if (parentKey == null || viewsIds == null) + viewsIds = calculationLogicViews.keySet(); + for (String viewId : viewsIds) { + try { + View curView = calculationLogicViews.get(viewId); + if (curView == null) { + Timber.w("calculationLogicViews Missing %s", viewId); + continue; + } + Pair addressAndValue = getCalculationAddressAndValue(curView); + if (addressAndValue != null && addressAndValue.first != null) { + String[] address = addressAndValue.first; + JSONObject valueSource = addressAndValue.second; + Facts curValueMap; + if (valueSource.length() > 0) { + curValueMap = getValueFromAddress(address, popup, valueSource); + } else { + curValueMap = getValueFromAddress(address, popup); } - Pair addressAndValue = getCalculationAddressAndValue(curView); - if (addressAndValue != null && addressAndValue.first != null) { - String[] address = addressAndValue.first; - JSONObject valueSource = addressAndValue.second; - Facts curValueMap; - if (valueSource.length() > 0) { - curValueMap = getValueFromAddress(address, popup, valueSource); - } else { - curValueMap = getValueFromAddress(address, popup); - } - //update ui - appExecutors.mainThread().execute(() -> { - updateCalculation(curValueMap, curView, address, isForNextStep); - }); + //update ui + updateCalculation(curValueMap, curView, address, isForNextStep); - } + } - } catch (Exception e) { - Timber.e(e, "%s refreshCalculationLogic()", this.getClass().getCanonicalName()); + } catch (Exception e) { + Timber.e(e, "%s refreshCalculationLogic()", this.getClass().getCanonicalName()); - } } + } - }); } @@ -629,26 +625,24 @@ public JSONObject getObjectUsingAddress(String[] address, boolean popup, JSONObj */ @Override public void refreshConstraints(String parentKey, String childKey, boolean popup) { - appExecutors.diskIO().execute(()->{ - initComparisons(); + initComparisons(); - // Priorities constraints on the view that has just been changed - String changedViewKey = parentKey; - if (changedViewKey != null && childKey != null) { - changedViewKey = changedViewKey + ":" + childKey; - } + // Priorities constraints on the view that has just been changed + String changedViewKey = parentKey; + if (changedViewKey != null && childKey != null) { + changedViewKey = changedViewKey + ":" + childKey; + } - if (changedViewKey != null && (constrainedViews != null && constrainedViews.containsKey(changedViewKey))) { - checkViewConstraints(constrainedViews.get(changedViewKey), popup); - } + if (changedViewKey != null && (constrainedViews != null && constrainedViews.containsKey(changedViewKey))) { + checkViewConstraints(constrainedViews.get(changedViewKey), popup); + } - for (View curView : constrainedViews.values()) { - String viewKey = getViewKey(curView); - if (changedViewKey == null || (!TextUtils.isEmpty(viewKey) && !viewKey.equals(changedViewKey))) { - checkViewConstraints(curView, popup); - } + for (View curView : constrainedViews.values()) { + String viewKey = getViewKey(curView); + if (changedViewKey == null || (!TextUtils.isEmpty(viewKey) && !viewKey.equals(changedViewKey))) { + checkViewConstraints(curView, popup); } - }); + } } From c799ee13eec511a4b14010f486c3176c0fe0a728 Mon Sep 17 00:00:00 2001 From: Hamza Ahmed Khan Date: Mon, 7 Aug 2023 12:19:51 +0500 Subject: [PATCH 6/9] Increase code coverage --- .../vijay/jsonwizard/activities/JsonFormActivityTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android-json-form-wizard/src/test/java/com/vijay/jsonwizard/activities/JsonFormActivityTest.java b/android-json-form-wizard/src/test/java/com/vijay/jsonwizard/activities/JsonFormActivityTest.java index 43bebf226..5ee03b393 100644 --- a/android-json-form-wizard/src/test/java/com/vijay/jsonwizard/activities/JsonFormActivityTest.java +++ b/android-json-form-wizard/src/test/java/com/vijay/jsonwizard/activities/JsonFormActivityTest.java @@ -618,4 +618,9 @@ public void testGetViewKey() throws Exception { assertEquals(key + ":" + childKey, returnKey); } -} + + @Test + public void testGetCOuntSHouldReturnTheCorrectCount() { + assertEquals("1", activity.getCount()); + } +} \ No newline at end of file From d854552c0957d5793fd587c8183574d693376372 Mon Sep 17 00:00:00 2001 From: vend Date: Fri, 11 Aug 2023 20:17:26 +0500 Subject: [PATCH 7/9] added the data decompression feature for optibp data --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index d08b7813d..40958f5b4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=3.1.4-SNAPSHOT +VERSION_NAME=3.1.4-DEV-SNAPSHOT VERSION_CODE=1 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Native Form Json Wizard From cdd80be147071d96f3912b891a2f11153ec5d1d1 Mon Sep 17 00:00:00 2001 From: hilpitome Date: Thu, 21 Dec 2023 10:44:25 +0300 Subject: [PATCH 8/9] update processing of weight and height --- .../com/vijay/jsonwizard/widgets/OptiBPWidgetFactory.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/OptiBPWidgetFactory.java b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/OptiBPWidgetFactory.java index a4ed99291..e19e9dd40 100644 --- a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/OptiBPWidgetFactory.java +++ b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/OptiBPWidgetFactory.java @@ -333,7 +333,7 @@ protected String getInputJsonString(Context context, JSONObject jsonObject, Widg * Adding new calibration data here */ appendHealthData(optiBPData, widgetArgs); - optiBPData.put(OptibpConstants.CALIBRATION, getCalibrationData(Utils.decompress(optiBPData.optString(OptibpConstants.CALIBRATION),"UTF-8"))); + optiBPData.put(OptibpConstants.CALIBRATION, getCalibrationData(optiBPData.optString(OptibpConstants.CALIBRATION))); return optiBPData.toString(); } @@ -355,8 +355,8 @@ private void appendHealthData(JSONObject returnObject, WidgetArgs widgetArgs) { JSONObject currentHeight = getSingleStepJsonObject(widgetArgs, STEP1, OptibpConstants.HEIGHT); JSONObject currentWeight = getSingleStepJsonObject(widgetArgs, STEP1, OptibpConstants.CURRENTWEIGHT); if (currentHeight != null && currentWeight != null) { - returnObject.put(OptibpConstants.HEIGHT, Integer.parseInt(currentHeight.optString(VALUE))); - returnObject.put(OptibpConstants.WEIGHT, Integer.parseInt(currentWeight.optString(VALUE))); + returnObject.put(OptibpConstants.HEIGHT, (int) Double.parseDouble(currentHeight.optString(VALUE))); + returnObject.put(OptibpConstants.WEIGHT, (int) Double.parseDouble(currentWeight.optString(VALUE))); } } catch (JSONException e) { Timber.e(e); From f3ea44e34b4df6b4d738af34603942a9f9cf3bca Mon Sep 17 00:00:00 2001 From: Hilary Baraka Egesa Date: Thu, 21 Dec 2023 10:55:52 +0300 Subject: [PATCH 9/9] Update version name --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index d08b7813d..b2c5ecd76 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=3.1.4-SNAPSHOT +VERSION_NAME=3.1.5-SNAPSHOT VERSION_CODE=1 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Native Form Json Wizard