Commit f3c9603d by Kunj Gupta

Changes are made in Report Incident:

1. Added successful dialog, when incident is submitted successfully.
2. capitalization in edit text.
3. String related changes in Impact drop down.
parent a465a9a0
......@@ -47,20 +47,11 @@ public enum Impact {
}
public static Impact from(int id) {
for(int i = 0; i< Impact.values().length; i++) {
for(int i = 0; i < Impact.values().length; i++) {
Impact impact = Impact.values()[i];
if(impact.id == id)
return Impact.values()[i];
}
return UNKNOWN;
}
public static Impact from(String string) {
for(int i = 0; i< Impact.values().length; i++) {
Impact impact = Impact.values()[i];
if(impact.displayString.equals(string))
return Impact.values()[i];
}
return UNKNOWN;
}
}
......@@ -74,14 +74,17 @@ public class ReportIncidentScreen extends AppCompatActivity {
// Send initial screen view hit.
Util.sendScreenName(tracker, actionBar.getTitle().toString());
String[] impactArrayValues = getResources().getStringArray(R.array.incident_impact_array);
// Creating adapter for spinner
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.incident_impact_array));
ArrayAdapter<String> dataAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, impactArrayValues);
// Drop down layout style - list view with radio button
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// attaching data adapter to spinner
mImpactSpinner.setAdapter(dataAdapter);
/*For default select item is Medium*/
mImpactSpinner.setSelection(2);
}
@OnClick(R.id.incident_submit_text_view)
......@@ -136,7 +139,7 @@ public class ReportIncidentScreen extends AppCompatActivity {
progressDialog.dismiss();
}
if(syncStatus == SyncStatus.SUCCESS) {
finish();
showSuccessDialog();
} else {
showErrorDialog(R.string.failed_to_submit_form_string);
}
......@@ -174,7 +177,7 @@ public class ReportIncidentScreen extends AppCompatActivity {
private void getAllFromValues() {
/*Form values*/
mImpact = Impact.from((String) mImpactSpinner.getSelectedItem());
mImpact = Impact.from(mImpactSpinner.getSelectedItemPosition());
mShortDescription = mShortDesEditText.getText().toString();
}
......@@ -190,4 +193,17 @@ public class ReportIncidentScreen extends AppCompatActivity {
AlertDialog alert = builder.create();
alert.show();
}
private void showSuccessDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.incident_form_incident_successful_submission_string)
.setCancelable(false)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
......@@ -86,6 +86,7 @@
android:background="@drawable/list_view_item_bg_with_border"
android:gravity="start"
android:padding="@dimen/small_margin"
android:inputType="textCapSentences|textMultiLine"
android:lines="4" />
<TextView
......
......@@ -14,8 +14,8 @@
</array>
<string-array name="incident_impact_array">
<item>-None-</item>
<item>High</item>
<item>Medium</item>
<item>Low</item>
<item>1 - High</item>
<item>2 - Medium</item>
<item>3 - Low</item>
</string-array>
</resources>
\ No newline at end of file
......@@ -57,6 +57,7 @@
<string name="incident_form_report_incident_text_string">Report Incident</string>
<string name="incident_form_top_text_string">Create an Incident record to report and request assistance with an issue you are having\n\nRequest assistance with an issue you are having. An incident record will be created and managed through to successful resolution. You will also be notified of progress.</string>
<string name="incident_form_impact_text_string">Impact</string>
<string name="incident_form_incident_successful_submission_string">Your Incident has been reported successfully</string>
<string name="incident_form_describe_your_issue_text_string">Please Describe Your Issue below</string>
<!--My Incidents-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment