Skip to content

Commit

Permalink
Bug fixes/updates
Browse files Browse the repository at this point in the history
 - Fix app crashes if context null in JsonFormFragment during App Properties loading
 - Fix off by one on Numeric Date Picker updateDate function
 - Fix numeric date picker documentation formatting on README
  • Loading branch information
ndegwamartin committed Feb 10, 2020
1 parent 3584fa4 commit d824bd3
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -2058,14 +2058,14 @@ Create a class implementing [MultiSelectListRepository]([https://github.com/Open
> `"repositoryClass": "<fqn of sorting repository class>"`


![Sample Form Screenshot] (https://user-images.githubusercontent.com/2793306/68639670-7c959100-052f-11ea-8cc9-e5ddf2c288ff.png)
[Sample Form Screenshot](https://user-images.githubusercontent.com/2793306/68639670-7c959100-052f-11ea-8cc9-e5ddf2c288ff.png)

## Configurability

By placing a file named `app.properties` in your implementation assets folder (See sample app) , one can configure certain aspects of the app

### Configurable Settings

| Configuration | Type | Default | Description |
| --------------------------------------| ------- | ------- | --------------------------------------------------------| |
| `widget.datepicker.is.numeric` | Boolean | false | Use numeric date picker instead of Android default |
| Configuration | Type | Default | Description |
| --------------------------------------| ------- | --------- | ---------------------------------------------------------------|
| `widget.datepicker.is.numeric` | Boolean | false | Use numeric date picker instead of Android default |
Expand Up @@ -114,7 +114,7 @@ public void init(String json) {
public synchronized void initializeFormFragment() {
isFormFragmentInitialized = true;
getSupportFragmentManager().beginTransaction()
.add(R.id.container, JsonFormFragment.getFormFragment(JsonFormConstants.FIRST_STEP_NAME, this)).commitAllowingStateLoss();
.add(R.id.container, JsonFormFragment.getFormFragment(JsonFormConstants.FIRST_STEP_NAME)).commitAllowingStateLoss();
}

public void onFormStart() {
Expand Down
Expand Up @@ -106,7 +106,7 @@ public void onShow(DialogInterface dialog) {

}

if (datePicker.getMaxDate() == 0 && datePicker.getMaxDate() == 0) {
if (datePicker.getMinDate() == 0 && datePicker.getMaxDate() == 0) {

calendar.setTime(date);
}
Expand Down
Expand Up @@ -309,11 +309,11 @@ public void setOnDateChangedListener(DatePicker.OnDateChangedListener onDateChan
@Override
public void updateDate(int year, int month, int dayOfMonth) {

if (isMaxConstraintViolated(year, month, dayOfMonth)) {
if (isMaxConstraintViolated(year, month + 1, dayOfMonth)) {
throw new IllegalStateException("You have set a date later than the Maximum allowed date settings");
}

if (isMinConstraintViolated(year, month, dayOfMonth)) {
if (isMinConstraintViolated(year, month + 1, dayOfMonth)) {
throw new IllegalStateException("You have set a date later than the Minimum allowed date settings");
}

Expand Down
Expand Up @@ -74,25 +74,20 @@ public class JsonFormFragment extends MvpFragment<JsonFormFragmentPresenter, Jso
private static NativeFormsProperties nativeFormProperties;

public static JsonFormFragment getFormFragment(String stepName) {
return getFormFragment(stepName, null);
}

public static JsonFormFragment getFormFragment(String stepName, Context context) {
JsonFormFragment jsonFormFragment = new JsonFormFragment();
Bundle bundle = new Bundle();
bundle.putString(JsonFormConstants.JSON_FORM_KEY.STEPNAME, stepName);
jsonFormFragment.setArguments(bundle);

if (context != null) {
nativeFormProperties = Utils.getProperties(context);
}
return jsonFormFragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
setHasOptionsMenu(true);
super.onCreate(savedInstanceState);

nativeFormProperties = Utils.getProperties(getContext());
}

@Override
Expand Down
Expand Up @@ -254,6 +254,11 @@ public void updateVisibilityOfNextAndSave(boolean next, boolean save) {
previousButton.setVisibility(View.GONE);
}
}

//hide wizard nav bar if stepcount is zero
if (Integer.valueOf(getCount()) < 2) {
navigationToolbar.setVisibility(View.GONE);
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
@@ -1,4 +1,4 @@
VERSION_NAME=1.7.17-SNAPSHOT
VERSION_NAME=1.7.18-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client Native Form Json Wizard
Expand Down

0 comments on commit d824bd3

Please sign in to comment.