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 20eb77978..c1891119a 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 @@ -43,7 +43,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 ALIAS = "alias"; + public static final String KEYS = "keys"; public static final String SECOND_VALUE = "second_value"; public static final String OPENMRS_ENTITY_PARENT = "openmrs_entity_parent"; public static final String OPENMRS_ENTITY = "openmrs_entity"; diff --git a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/presenters/JsonFormFragmentPresenter.java b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/presenters/JsonFormFragmentPresenter.java index 046a3f35e..4a0c1b50d 100644 --- a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/presenters/JsonFormFragmentPresenter.java +++ b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/presenters/JsonFormFragmentPresenter.java @@ -189,7 +189,7 @@ public void addFormElements() { } - @SuppressLint ("ResourceAsColor") + @SuppressLint("ResourceAsColor") public void setUpToolBar() { getView().setActionBarTitle(mStepDetails.optString(JsonFormConstants.STEP_TITLE)); getView().setToolbarTitleColor(R.color.white); @@ -257,7 +257,7 @@ protected void launchErrorDialog() { errorFragment = new JsonFormErrorFragment(); } FragmentManager fm = ((JsonFormFragment) getView()).getChildFragmentManager(); - @SuppressLint ("CommitTransaction") FragmentTransaction ft = fm.beginTransaction(); + @SuppressLint("CommitTransaction") FragmentTransaction ft = fm.beginTransaction(); errorFragment.show(ft, JsonFormErrorFragment.TAG); } @@ -520,7 +520,7 @@ private void resetWidgetReadOnly(View view) { } } - @SuppressWarnings ({"unchecked"}) + @SuppressWarnings({"unchecked"}) private void setCheckboxesEditable(View editButton) { List checkboxLayouts = (ArrayList) editButton.getTag(R.id.editable_view); resetWidgetReadOnly(editButton); @@ -691,7 +691,7 @@ public void onItemSelected(AdapterView parent, View view, int position, long String openMrsEntityParent = (String) parent.getTag(R.id.openmrs_entity_parent); String openMrsEntity = (String) parent.getTag(R.id.openmrs_entity); String openMrsEntityId = (String) parent.getTag(R.id.openmrs_entity_id); - JSONArray jsonArray = (JSONArray) parent.getTag(R.id.alias); + JSONArray jsonArray = (JSONArray) parent.getTag(R.id.keys); CustomTextView customTextView = (CustomTextView) parent.getTag(R.id.number_selector_textview); Boolean popup = (Boolean) parent.getTag(R.id.extraPopup); if (popup == null) { @@ -699,7 +699,7 @@ public void onItemSelected(AdapterView parent, View view, int position, long } String value = parent.getItemAtPosition(position).toString(); - if(jsonArray != null && position >0 && jsonArray.length() > 0){ + if (jsonArray != null && position > -1 && jsonArray.length() > 0) { try { value = jsonArray.getString(position); } catch (JSONException e) { diff --git a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/SpinnerFactory.java b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/SpinnerFactory.java index 0548a98dc..c4eeb7808 100644 --- a/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/SpinnerFactory.java +++ b/android-json-form-wizard/src/main/java/com/vijay/jsonwizard/widgets/SpinnerFactory.java @@ -103,10 +103,10 @@ private void addSpinner(JSONObject jsonObject, RelativeLayout spinnerRelativeLay spinner.setFloatingLabelText(jsonObject.getString(JsonFormConstants.HINT)); } - JSONArray aliasJson = null; - if (jsonObject.has(JsonFormConstants.ALIAS)) { - aliasJson = jsonObject.getJSONArray(JsonFormConstants.ALIAS); - spinner.setTag(R.id.alias, aliasJson); + JSONArray keysJson = null; + if (jsonObject.has(JsonFormConstants.KEYS)) { + keysJson = jsonObject.getJSONArray(JsonFormConstants.KEYS); + spinner.setTag(R.id.keys, keysJson); } setViewTags(jsonObject, canvasIds, stepName, popup, openMrsEntityParent, openMrsEntity, openMrsEntityId, spinner); @@ -137,9 +137,9 @@ private void addSpinner(JSONObject jsonObject, RelativeLayout spinnerRelativeLay values = new String[valuesJson.length()]; for (int i = 0; i < valuesJson.length(); i++) { values[i] = valuesJson.optString(i); - if (aliasJson == null && valueToSelect.equals(values[i])) { + if (keysJson == null && valueToSelect.equals(values[i])) { indexToSelect = i; - } else if (aliasJson != null && valueToSelect.equals(aliasJson.optString(i))) { + } else if (keysJson != null && valueToSelect.equals(keysJson.optString(i))) { indexToSelect = i; } } diff --git a/android-json-form-wizard/src/main/res/values/ids.xml b/android-json-form-wizard/src/main/res/values/ids.xml index 7bf103d85..38f047882 100644 --- a/android-json-form-wizard/src/main/res/values/ids.xml +++ b/android-json-form-wizard/src/main/res/values/ids.xml @@ -19,7 +19,7 @@ - + diff --git a/sample/src/main/assets/json.form/single_form.json b/sample/src/main/assets/json.form/single_form.json index 9f4fa275b..f0097d60d 100644 --- a/sample/src/main/assets/json.form/single_form.json +++ b/sample/src/main/assets/json.form/single_form.json @@ -251,7 +251,7 @@ "Ame OA", "Haja OA" ], - "alias": [ + "keys": [ "Married", "Single" ],