Skip to content

Commit

Permalink
Merge e70e1c1 into c87b5cc
Browse files Browse the repository at this point in the history
  • Loading branch information
qaziabubakar-vd committed Oct 15, 2020
2 parents c87b5cc + e70e1c1 commit 9bdf4f7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
@Override
public void afterTextChanged(Editable s) {
doneButton.setImageResource(R.drawable.ic_done_grey);
addOnDoneAction(referenceEditText, doneButton, widgetArgs);
ValidationStatus validationStatus = JsonFormFragmentPresenter
.validate(widgetArgs.getFormFragment(), referenceEditText, false);
if (validationStatus.isValid()) {
Expand Down Expand Up @@ -392,13 +393,22 @@ protected void addOnDoneAction(final TextView textView, final ImageButton doneBu
InputMethodManager inputMethodManager = (InputMethodManager) widgetArgs.getFormFragment().getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(textView.getWindowToken(), 0);
textView.clearFocus();
int numberOfGroups = parseIntWithDefault(textView.getText().toString());
attachRepeatingGroup(textView.getParent().getParent(),
Integer.parseInt(textView.getText().toString()), doneButton, widgetArgs);
numberOfGroups, doneButton, widgetArgs);
} catch (Exception e) {
Timber.e(e);
}
}

public static int parseIntWithDefault(String s) {
try {
return Integer.parseInt(s);
} catch(NumberFormatException e) {
return 0;
}
}

private void attachRepeatingGroup(final ViewParent parent, final int numRepeatingGroups,
final ImageButton doneButton, final WidgetArgs widgetArgs) {
if (numRepeatingGroups > MAX_NUM_REPEATING_GROUPS) {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=1.14.5.2-SNAPSHOT
VERSION_NAME=1.14.5.3-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client Native Form Json Wizard
Expand Down

0 comments on commit 9bdf4f7

Please sign in to comment.