Skip to content

Commit

Permalink
Merge pull request #98 from trufla-technology/TMOM-573-mcconville-omn…
Browse files Browse the repository at this point in the history
…i-495873022-cannot-submit-coverage-change

Handle multi lines in edit text value to submit change request
  • Loading branch information
marina-waged authored May 4, 2020
2 parents e375a15 + 5cc2b81 commit 678c2bf
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,18 @@
* create an instance of this fragment.
*/

public class TruFormFragment extends Fragment implements FormContract, CollectDataAsync.AsyncResponse {
public class TruFormFragment extends Fragment implements FormContract, CollectDataAsync.AsyncResponse
{
private static final int PICK_IMAGE_CODE = 1;
private static final int CAPTURE_IMAGE_CODE = 2;
private static final int PERMISSION_REQUEST_CODE = 1;

private OnFormActionsListener mListener;
private static final String SCHEMA_KEY = "SCHEMA_KEY";
private static final String JSON_KEY = "JSON_VALUE";
private static final String SCHEMA_TYPE = "schema_type";

private TruFormView truFormView;
private OnFormActionsListener mListener;
TruConsumer<ImageModel> mPickedImageListener;
TruConsumer<ArrayList<Pair<Object, String>>> mDataFetchListener;
ProgressDialog progressDialog;
Expand All @@ -82,7 +84,6 @@ public class TruFormFragment extends Fragment implements FormContract, CollectDa
private ImageCompressTask imageCompressTask;

public TruFormFragment() {

}

public static TruFormFragment newInstance(int schemaType, String schemaString) {
Expand Down Expand Up @@ -356,11 +357,10 @@ public void processFinish(String output) {
}
}

public interface OnFormActionsListener {
public interface OnFormActionsListener
{
void showDialog();

void onFormSubmitted(String jsonReperesentation);

void onFormFailed();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.Context;
import android.text.Editable;
import android.text.Html;
import android.text.InputType;
import android.text.TextUtils;
import android.text.TextWatcher;
Expand Down Expand Up @@ -53,12 +54,10 @@ protected void buildSubview() {
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {

}

@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {

}

@Override
Expand Down Expand Up @@ -114,9 +113,14 @@ public String getInputtedData() {
}

@NonNull
protected String extractData() {
return Objects.requireNonNull((textInputLayout)
protected String extractData()
{
String editTextValue = Objects.requireNonNull((textInputLayout)
.getEditText()).getText().toString().trim();
return editTextValue.replaceAll("\n","&lt;br&gt;");

// return Objects.requireNonNull((textInputLayout)
// .getEditText()).getText().toString().trim();
}


Expand Down Expand Up @@ -204,7 +208,7 @@ protected void removeErrorMsg() {
protected void setNonEditableValues(Object constItem) {
if (constItem instanceof String) {
Objects.requireNonNull(((TextInputLayout) mView.findViewById(R.id.input_view_container))
.getEditText()).setText(constItem.toString());
.getEditText()).setText(Html.fromHtml(Html.fromHtml(constItem.toString()).toString()));
}
if (textInputLayout != null)
textInputLayout.setEnabled(false);
Expand Down
64 changes: 13 additions & 51 deletions app/src/main/res/raw/claims.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,20 @@
{
"title": "Other Claim",
"title": "Manage My Coverage - Home",
"description": "Manage My Coverage",
"type": "object",
"properties": {
"claim_information": {
"type": "object",
"properties": {
"claim_description": {
"type": "string"
},
"date_of_loss": {
"type": "string",
"format": "date"
},
"your_damage_photos": {
"type": "array",
"items": {
"type": "object",
"properties": {
"photo": {
"type": "string",
"format": "photo"
}
}
}
}
},
"required": [
"claim_description",
"date_of_loss"
]
"effective_date": {
"type": "string",
"format": "date"
},
"witness_information": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string",
"format": "email"
},
"home_phone_number": {
"type": "string",
"format": "tel"
},
"cell_phone_number": {
"type": "string",
"format": "tel"
}
}
}
"coverage_request": {
"title": "Please tell us what changes you require to your coverage",
"type": "string",
"format": "textarea"
}
},
"required": []
"required": [
"effective_date",
"coverage_request"
]
}
64 changes: 13 additions & 51 deletions app/src/main/res/raw/claims_edited.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,20 @@
{
"title": "Other Claim",
"title": "Manage My Coverage - Home",
"description": "Manage My Coverage",
"type": "object",
"properties": {
"claim_information": {
"type": "object",
"properties": {
"claim_description": {
"type": "string"
},
"date_of_loss": {
"type": "string",
"format": "date"
},
"your_damage_photos": {
"type": "array",
"items": {
"type": "object",
"properties": {
"photo": {
"type": "string",
"format": "photo"
}
}
}
}
},
"required": [
"claim_description",
"date_of_loss"
]
"effective_date": {
"type": "string",
"format": "date"
},
"witness_information": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string",
"format": "email"
},
"home_phone_number": {
"type": "string",
"format": "tel"
},
"cell_phone_number": {
"type": "string",
"format": "tel"
}
}
}
"coverage_request": {
"title": "Please tell us what changes you require to your coverage",
"type": "string",
"format": "textarea"
}
},
"required": []
"required": [
"effective_date",
"coverage_request"
]
}

0 comments on commit 678c2bf

Please sign in to comment.