Skip to content

Evan #14

Merged
merged 11 commits into from
Apr 1, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -44,56 +44,56 @@ public class DryWeatherScreening extends AppCompatActivity{
boolean needMaintenance = false;
boolean screenOK = false;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of these classes should be separate. The form parts should go in the setup methods in the Waterway form frgment. Please read through the code and run it, so you can understand what it is doing. It is very trivial to understand it once you run it and look at the code.


//I assume onCreate is important so I will leave it unchanged
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.activity_sample_fordm);
recyclerView = findViewById(R.id.recyclerView2);
recyclerView = findViewById(R.id.recyclerView2);
setupForm();
}

private void setupForm() {
formBuilder = new FormBuilder(this, recyclerView);
List<BaseFormElement> formItems = new ArrayList<>();

FormHeader title = (FormHeader) new FormHeader().setTitle("Dry Weather Screening");
formItems.add(title);

FormElementTextSingleLine flow = FormElementTextSingleLine.createInstance().setTitle("Presence of Flow").setValue("No");
flowVal = flow.getValue();
flowPres = convertToBoolean(flowVal);
FormElementSwitch flow = FormElementSwitch.createInstance().setTitle("Presence of Flow").setSwitchTexts("Yes", "No");
flowPres = convertToBoolean(flow.getValue());
formItems.add(flow);

FormElementTextSingleLine odor = FormElementTextSingleLine.createInstance().setTitle("Unusual Odor").setValue("No");
FormElementSwitch odor = FormElementSwitch.createInstance().setTitle("Unusual Odor").setSwitchTexts("Yes", "No");
odorVal = odor.getValue();
odorPres = convertToBoolean(odorVal);
formItems.add(odor);

FormElementTextSingleLine color = FormElementTextSingleLine.createInstance().setTitle("Unusual Color").setValue("No");
FormElementSwitch color = FormElementSwitch.createInstance().setTitle("Unusual Color").setSwitchTexts("Yes", "No");
colorVal = color.getValue();
colorPres = convertToBoolean(colorVal);
formItems.add(color);

FormElementTextSingleLine polutants = FormElementTextSingleLine.createInstance().setTitle("Polutants Nearby").setValue("No");
FormElementSwitch polutants = FormElementSwitch.createInstance().setTitle("Polutants Nearby").setSwitchTexts("Yes", "No");
polutantsVal = polutants.getValue();
polutantsPres = convertToBoolean(polutantsVal)
polutantsPres = convertToBoolean(polutantsVal);
formItems.add(polutants);

FormElementTextSingleLine obstruction = FormElementTextSingleLine.createInstance().setTitle("Obstruction").setValue("No");
FormElementSwitch obstruction = FormElementSwitch.createInstance().setTitle("Obstruction").setSwitchTexts("Yes", "No");
obstructionVal = obstruction.getValue();
obstructionPres = convertToBoolean(obstructionVal);
formItems.add(obstruction);

FormElementTextSingleLine maintenance = FormElementTextSingleLine.createInstance().setTitle("Needs Maintenance").setValue("No");
FormElementSwitch maintenance = FormElementSwitch.createInstance().setTitle("Needs Maintenance").setSwitchTexts("Yes", "No");
maintenanceVal = maintenance.getValue();
needMaintenance = convertToBoolean(maintenanceVal);
formItems.add(maintenance);

FormElementTextSingleLine screen = FormElementTextSingleLine.createInstance().setTitle("Screen OK").setValue("No");
FormElementSwitch screen = FormElementSwitch.createInstance().setTitle("Screen OK").setSwitchTexts("Yes", "No");
screenVal = screen.getValue();
screenOK = convertToBoolean(screenVal);

List<BaseFormElement> formItems = new ArrayList<>();

formItems.add(flow);
formItems.add(odor);
formItems.add(color);
formItems.add(polutants);
formItems.add(obstruction);
formItems.add(maintenance);
formItems.add(screen);


formBuilder.addFormElements(formItems);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.sf.stormwaterutilityandroid;
package com.sf.stormwaterutilityandroid.WaterWay;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;

import com.sf.stormwaterutilityandroid.R;

import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -37,82 +39,60 @@ public class ChemicalTesting extends AppCompatActivity{
double other1Val = 0.0;
double other2Val = 0.0;

FormElementTextEmail element11;
@Override
//I assume onCreate is important so I will leave it unchanged


protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.activity_sample_fordm);
recyclerView = findViewById(R.id.recyclerView2);
recyclerView = findViewById(R.id.recyclerView2);
setupForm();
}

private void setupForm() {
formBuilder = new FormBuilder(this, recyclerView);

FormHeader title = (FormHeader) new FormHeader().setTitle("Chemical Testing");

//Outfall --> Question: How do you do a subheading?

FormElementTextSingleLine temperature = new FormElementTextSingleLine().setTitle("Temperature (C) Change");
//FormHeader temp = FormHeader.createInstance("Temperature (C) Change");
FormElementTextNumber tempData = FormElementTextNumber.createInstance(); //what data type is this?
tempVal = Double.parseDouble(tempData.getValue());
FormElementTextSingleLine temperature = new FormElementTextSingleLine().setTitle("Temperature (C) Change").setValue("0");
tempVal = Double.parseDouble(temperature.getValue());

FormElementTextSingleLine tubidity = new FormElementTextSingleLine().setTitle("Tubidity (NTU)");
FormElementTextNumber tubidityData = FormElementTextNumber.createInstance();
turbidityVal = Double.parseDouble(tubidityData.getValue());
FormElementTextSingleLine tubidity = new FormElementTextSingleLine().setTitle("Tubidity (NTU)").setValue("0");
turbidityVal = Double.parseDouble(tubidity.getValue());

FormElementTextSingleLine pH = new FormElementTextSingleLine().setTitle("pH");
FormElementTextNumber pHData = FormElementTextNumber.createInstance();
phVal = Double.parseDouble(pHData.getValue());
FormElementTextSingleLine pH = new FormElementTextSingleLine().setTitle("pH").setValue("0");
phVal = Double.parseDouble(pH.getValue());

FormElementTextSingleLine nitrate = new FormElementTextSingleLine().setTitle("Nitrate (mg/L)");
FormElementTextNumber nitrateData = FormElementTextNumber.createInstance();
nitrateVal = Double.parseDouble(nitrateData.getValue());
FormElementTextSingleLine nitrate = new FormElementTextSingleLine().setTitle("Nitrate (mg/L)").setValue("0");
nitrateVal = Double.parseDouble(nitrate.getValue());

FormElementTextSingleLine phosphate = new FormElementTextSingleLine().setTitle("Total Phosphate (mg/L)");
FormElementTextNumber phosphateData = FormElementTextNumber.createInstance();
phosphateVal = Double.parseDouble(nitrateData.getValue());
FormElementTextSingleLine phosphate = new FormElementTextSingleLine().setTitle("Total Phosphate (mg/L)").setValue("0");
phosphateVal = Double.parseDouble(phosphate.getValue());

FormElementTextSingleLine oxygen = new FormElementTextSingleLine().setTitle("Dissolved Oxygen (mg/L)");
FormElementTextNumber oxygenData = FormElementTextNumber.createInstance();
oxygenVal = Double.parseDouble(oxygenData.getValue());
FormElementTextSingleLine oxygen = new FormElementTextSingleLine().setTitle("Dissolved Oxygen (mg/L)").setValue("0");
oxygenVal = Double.parseDouble(oxygen.getValue());

FormElementTextSingleLine coli = new FormElementTextSingleLine().setTitle("E Coli (col/100mL)");
FormElementTextNumber coliData = FormElementTextNumber.createInstance();
coliVal = Double.parseDouble(coliData.getValue());
FormElementTextSingleLine coli = new FormElementTextSingleLine().setTitle("E Coli (col/100mL)").setValue("0");
coliVal = Double.parseDouble(coli.getValue());

FormElementTextSingleLine other1 = new FormElementTextSingleLine().setTitle("Other 1");
FormElementTextNumber other1Data = FormElementTextNumber.createInstance();
other1Val = Double.parseDouble(other1Data.getValue());
FormElementTextSingleLine other1 = new FormElementTextSingleLine().setTitle("Other 1").setValue("");
other1Val = Double.parseDouble(other1.getValue());

FormElementTextSingleLine other2 = new FormElementTextSingleLine().setTitle("Other 2");
FormElementTextNumber other2Data = FormElementTextNumber.createInstance();
FormElementTextSingleLine other2 = new FormElementTextSingleLine().setTitle("Other 2").setValue("");
other2Val = Double.parseDouble(other2.getValue());

List<BaseFormElement> formItems = new ArrayList<>();

formItems.add(title);
formItems.add(temperature);
formItems.add(tempData);
formItems.add(tubidity);
formItems.add(tubidityData);
formItems.add(pH);
formItems.add(pHData);
formItems.add(nitrate);
formItems.add(nitrateData);
formItems.add(phosphate);
formItems.add(phosphateData);
formItems.add(oxygen);
formItems.add(oxygenData);
formItems.add(coli);
formItems.add(coliData);
formItems.add(other1);
formItems.add(other1Data);
formItems.add(other2);
formItems.add(other2Data);

formBuilder.addFormElements(formItems);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import me.riddhimanadib.formmaster.model.FormElementTextSingleLine;
import me.riddhimanadib.formmaster.model.FormHeader;

public class General {
public class General extends AppCompatActivity{
//HQ form
private FormBuilder formBuilder;
private RecyclerView recyclerView;
Expand All @@ -43,65 +43,102 @@ public class General {
String pipeSize = "";
String channelBottomWidth = "";
String receivingWater = "";
String routineEvaluation = "";
String complaintInvestigation = "";

String comments = "";

/*protected void onCreate(Bundle savedInstanceState) {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.activity_sample_fordm);
recyclerView = findViewById(R.id.recyclerView2);
recyclerView = findViewById(R.id.recyclerView2);
setupForm();
}*/
}

private void setupForm() {
formBuilder = new FormBuilder(this, recyclerView);
List<BaseFormElement> formItems = new ArrayList<>();

FormHeader title = (FormHeader) new FormHeader().setTitle("Report");
formItems.add(title);

FormElementTextSingleLine name = FormElementTextSingleLine.createInstance().setTitle("Name of Inspector").setValue("");
nameOfInspector = name.getValue();
formItems.add(name);

FormElementTextSingleLine site = FormElementTextSingleLine.createInstance().setTitle("Name of site").setValue("");
nameOfSite = site.getValue();
formItems.add(site);

FormElementPickerDate date = FormElementPickerDate.createInstance().setTitle("Date Row").setDateFormat("XX-XX-XXXX").setValue("");
dateRow = date.getValue();
formItems.add(date);

FormElementTextSingleLine outfallValue = FormElementTextSingleLine.createInstance().setTitle("Outfall").setValue("0");
outfall = Double.parseDouble(outfallValue.getValue());
formItems.add(outfallValue);

FormElementTextSingleLine longitudeValue = FormElementTextSingleLine.createInstance().setTitle("Longitude").setValue("0");
longitude = Double.parseDouble(longitudeValue.getValue());
formItems.add(longitudeValue);

FormElementTextSingleLine latitudeValue = FormElementTextSingleLine.createInstance().setTitle("Latitude").setValue("0");
latitude = Double.parseDouble(latitudeValue.getValue());
formItems.add(latitudeValue);

FormElementTextSingleLine invertElevationValue = FormElementTextSingleLine.createInstance().setTitle("Invert Elevation").setValue("0");
invertElevation = Double.parseDouble(invertElevationValue.getValue());
formItems.add(invertElevationValue);

FormElementTextSingleLine typeValue = FormElementTextSingleLine.createInstance().setTitle("Type").setValue("");
List<String> pipeTypeOptions = new ArrayList<String>();
pipeTypeOptions.add("Enclosed Pipe");
pipeTypeOptions.add("Open Channel");
FormElementPickerMulti typeValue = FormElementPickerMulti.createInstance().setTitle("Type").setOptions(pipeTypeOptions);
type = typeValue.getValue();

FormElementTextSingleLine pipeSizeValue = FormElementTextSingleLine.createInstance().setTitle("Pipe Size").setValue("");
formItems.add(typeValue);

List<String> pipeSizeOptions = new ArrayList<String>();
pipeSizeOptions.add("4\"");
pipeSizeOptions.add("6\"");
pipeSizeOptions.add("8\"");
pipeSizeOptions.add("10\"");
pipeSizeOptions.add("12\"");
pipeSizeOptions.add("14\"");
pipeSizeOptions.add("16\"");
pipeSizeOptions.add("18\"");
pipeSizeOptions.add("20\"");
pipeSizeOptions.add("24\"");
pipeSizeOptions.add("36\"");
FormElementPickerMulti pipeSizeValue = FormElementPickerMulti.createInstance().setTitle("Pipe Size").setOptions(pipeSizeOptions);
pipeSize = pipeSizeValue.getValue();

FormElementTextSingleLine channelBottomWidthValue = FormElementTextSingleLine.createInstance().setTitle("Channel Bottom Width")
.setValue("");
formItems.add(pipeSizeValue);

List<String> channelWidthOptions = new ArrayList<String>();
channelWidthOptions.add("2\"");
channelWidthOptions.add("4\"");
channelWidthOptions.add("6\"");
channelWidthOptions.add("8\"");
channelWidthOptions.add("10\"");
channelWidthOptions.add("12\"");
channelWidthOptions.add("14\"");
channelWidthOptions.add("16\"");
channelWidthOptions.add("18\"");
channelWidthOptions.add("20\"");
FormElementPickerMulti channelBottomWidthValue = FormElementPickerMulti.createInstance().setTitle("Channel Bottom Width")
.setOptions(channelWidthOptions);
channelBottomWidth = channelBottomWidthValue.getValue();

FormElementTextSingleLine receiving = FormElementTextSingleLine.createInstance().setTitle("Receiving Water").setValue("");
formItems.add(channelBottomWidthValue);

List<String> receivingWaterOptions = new ArrayList<String>();
receivingWaterOptions.add("Turkey Creek");
receivingWaterOptions.add("Deep River");
receivingWaterOptions.add("Un-Named Tributary");
receivingWaterOptions.add("Spring Run Ditch");
receivingWaterOptions.add("Hart Ditch");
receivingWaterOptions.add("Coffee Creek");
receivingWaterOptions.add("Niles Ditch");
receivingWaterOptions.add("Beaver Dam Ditch");
receivingWaterOptions.add("Kaiser Ditch");

FormElementPickerMulti receiving = FormElementPickerMulti.createInstance().setTitle("Receiving Water").setOptions(receivingWaterOptions);
receivingWater = receiving.getValue();

FormElementTextSingleLine routine = FormElementTextSingleLine.createInstance().setTitle("Routine Evaluation").setValue("");
routineEvaluation = routine.getValue();

FormElementTextSingleLine complaint = FormElementTextSingleLine.createInstance().setTitle("Complaint Investigation").setValue("");
complaintInvestigation = complaint.getValue();

FormElementTextSingleLine commentsValue = FormElementTextSingleLine.createInstance().setTitle("Comments").setValue("");
comments = commentsValue.getValue();
formItems.add(receiving);
}

public String getName() {
Expand Down Expand Up @@ -148,15 +185,4 @@ public String getReceivingWater() {
return receivingWater;
}

public String getRoutineEvaluation() {
return routineEvaluation;
}

public String getComplaintInvestigation() {
return complaintInvestigation;
}

public String getComments() {
return comments;
}
}