Skip to content

Commit

Permalink
Merge pull request #613 from opensrp/feature/612
Browse files Browse the repository at this point in the history
🐛 Fix the next button on native forms
  • Loading branch information
SebaMutuku authored Jan 7, 2022
2 parents 64defd0 + d9b94c0 commit 8829729
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
Expand Down Expand Up @@ -76,7 +77,7 @@ public class JsonFormFragment extends MvpFragment<JsonFormFragmentPresenter, Jso
protected ScrollView mScrollView;
private Menu mMenu;
private JsonApi mJsonApi;
private Map<String, List<View>> lookUpMap = new HashMap<>();
private final Map<String, List<View>> lookUpMap = new HashMap<>();
private Button previousButton;
private Button nextButton;
private String stepName;
Expand All @@ -86,7 +87,7 @@ public class JsonFormFragment extends MvpFragment<JsonFormFragmentPresenter, Jso

private static NativeFormsProperties nativeFormProperties;

private final Handler handler = new Handler(this);
private final Handler handler = new Handler(Looper.getMainLooper(), this);

public static JsonFormFragment getFormFragment(String stepName) {
JsonFormFragment jsonFormFragment = new JsonFormFragment();
Expand All @@ -100,7 +101,7 @@ public static JsonFormFragment getFormFragment(String stepName) {
@Override
public boolean handleMessage(@NonNull @NotNull Message msg) {
//noinspection SwitchStatementWithTooFewBranches
switch (msg.what){
switch (msg.what) {
case GRAY_OUT_ACTIVE_WHAT:
requireActivity().invalidateOptionsMenu();
return true;
Expand Down Expand Up @@ -285,7 +286,7 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_toolbar, menu);
presenter.setUpToolBar();

if (getForm() != null && getForm().isGreyOutSaveWhenFormInvalid()){
if (getForm() != null && getForm().isGreyOutSaveWhenFormInvalid()) {
boolean isFormFilled = presenter.areFormViewsFilled();
if (isFormFilled) {
menu.findItem(R.id.action_next).setTitle(R.string.next);
Expand Down Expand Up @@ -678,7 +679,7 @@ public void unCheck(String parentKey, String exclusiveKey, CompoundButton compou
break;
}
} else if (isCheckbox(view)) {
CheckBox checkBox = ((LinearLayout) view).findViewWithTag(JsonFormConstants.CHECK_BOX);
CheckBox checkBox = view.findViewWithTag(JsonFormConstants.CHECK_BOX);
String parentKeyAtIndex = (String) checkBox.getTag(R.id.key);
String childKeyAtIndex = (String) checkBox.getTag(R.id.childKey);
if (checkBox.isChecked() && parentKeyAtIndex.equals(parentKey) && childKeyAtIndex.equals(exclusiveKey)) {
Expand Down Expand Up @@ -736,7 +737,7 @@ public void run() {

Form form = getForm();
if (!(view instanceof MaterialEditText)
|| (form != null && !form.isGreyOutSaveWhenFormInvalid())){
|| (form != null && !form.isGreyOutSaveWhenFormInvalid())) {
view.requestFocus();
}
}
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=2.1.13-SNAPSHOT
VERSION_NAME=2.1.14-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client Native Form Json Wizard
Expand Down

0 comments on commit 8829729

Please sign in to comment.