Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix the next button on native forms #613

Merged
merged 2 commits into from
Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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