diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/DryWeatherScreening.java b/app/src/main/java/com/sf/stormwaterutilityandroid/DryWeatherScreening.java index 20828fa..68bf5dc 100644 --- a/app/src/main/java/com/sf/stormwaterutilityandroid/DryWeatherScreening.java +++ b/app/src/main/java/com/sf/stormwaterutilityandroid/DryWeatherScreening.java @@ -23,7 +23,6 @@ import me.riddhimanadib.formmaster.model.FormElementTextSingleLine; import me.riddhimanadib.formmaster.model.FormHeader; - public class DryWeatherScreening extends AppCompatActivity{ private FormBuilder formBuilder; @@ -37,64 +36,101 @@ public class DryWeatherScreening extends AppCompatActivity{ String maintenanceVal = ""; String screenVal = ""; - FormElementTextEmail element11; - //I assume onCreate is important so I will leave it unchanged + boolean flowPres = false; + boolean odorPres = false; + boolean colorPres = false; + boolean polutantsPres = false; + boolean obstructionPres = false; + boolean needMaintenance = false; + boolean screenOK = false; + 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("Dry Weather Screening"); - - //Outfall --> Question: How do you do a subheading? - FormElementTextSingleLine flow = new FormElementTextSingleLine().setTitle("Presence of Flow"); - FormElementTextNumber flowData = FormElementTextNumber.createInstance(); //what data type is this? - flowVal = flowData.getValue(); - - FormElementTextSingleLine odor = new FormElementTextSingleLine().setTitle("Unusual Odor"); - FormElementTextNumber odorData = FormElementTextNumber.createInstance(); - odorVal = odorData.getValue(); - - FormElementTextSingleLine color = new FormElementTextSingleLine().setTitle("Unusual Color"); - FormElementTextNumber colorData = FormElementTextNumber.createInstance(); - colorVal = colorData.getValue(); - - FormElementTextSingleLine polutants = new FormElementTextSingleLine().setTitle("Polutants Nearby"); - FormElementTextNumber polutantsData = FormElementTextNumber.createInstance(); - polutantsVal = polutantsData.getValue(); - - FormElementTextSingleLine obstruction = new FormElementTextSingleLine().setTitle("Obstruction"); - FormElementTextNumber obstructionData = FormElementTextNumber.createInstance(); - obstructionVal = obstructionData.getValue(); - - FormElementTextSingleLine maintenance = new FormElementTextSingleLine().setTitle("Needs Maintenance"); - FormElementTextNumber maintenanceData = FormElementTextNumber.createInstance(); - maintenanceVal = maintenanceData.getValue(); - - FormElementTextSingleLine screen = new FormElementTextSingleLine().setTitle("Screen OK"); - FormElementTextNumber screenData = FormElementTextNumber.createInstance(); - screenVal = screenData.getValue(); - List formItems = new ArrayList<>(); + FormHeader title = (FormHeader) new FormHeader().setTitle("Dry Weather Screening"); + formItems.add(title); + + FormElementSwitch flow = FormElementSwitch.createInstance().setTitle("Presence of Flow").setSwitchTexts("Yes", "No"); + flowPres = convertToBoolean(flow.getValue()); formItems.add(flow); - formItems.add(flowData); + + FormElementSwitch odor = FormElementSwitch.createInstance().setTitle("Unusual Odor").setSwitchTexts("Yes", "No"); + odorVal = odor.getValue(); + odorPres = convertToBoolean(odorVal); formItems.add(odor); - formItems.add(odorData); + + FormElementSwitch color = FormElementSwitch.createInstance().setTitle("Unusual Color").setSwitchTexts("Yes", "No"); + colorVal = color.getValue(); + colorPres = convertToBoolean(colorVal); formItems.add(color); - formItems.add(colorData); + + FormElementSwitch polutants = FormElementSwitch.createInstance().setTitle("Polutants Nearby").setSwitchTexts("Yes", "No"); + polutantsVal = polutants.getValue(); + polutantsPres = convertToBoolean(polutantsVal); formItems.add(polutants); - formItems.add(polutantsData); + + FormElementSwitch obstruction = FormElementSwitch.createInstance().setTitle("Obstruction").setSwitchTexts("Yes", "No"); + obstructionVal = obstruction.getValue(); + obstructionPres = convertToBoolean(obstructionVal); formItems.add(obstruction); - formItems.add(obstructionData); + + FormElementSwitch maintenance = FormElementSwitch.createInstance().setTitle("Needs Maintenance").setSwitchTexts("Yes", "No"); + maintenanceVal = maintenance.getValue(); + needMaintenance = convertToBoolean(maintenanceVal); formItems.add(maintenance); - formItems.add(maintenanceData); + + FormElementSwitch screen = FormElementSwitch.createInstance().setTitle("Screen OK").setSwitchTexts("Yes", "No"); + screenVal = screen.getValue(); + screenOK = convertToBoolean(screenVal); formItems.add(screen); - formItems.add(screenData); + formBuilder.addFormElements(formItems); } -} \ No newline at end of file + + public boolean getFlow() { + return flowPres; + } + + public boolean getOdor() { + return odorPres; + } + + public boolean getColor() { + return colorPres; + } + + public boolean getPolutants() { + return polutantsPres; + } + + public boolean getObstruction() { + return obstructionPres; + } + + public boolean getMaintenance() { + return needMaintenance; + } + + public boolean getScreen() { + return screenOK; + } + + public boolean convertToBoolean(String s) { + if (s.compareTo("Yes") == 0) { + return true; + } else { + return false; + } + } +} + diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/ChemicalTesting.java b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/ChemicalTesting.java index 7befa77..adb5e8f 100644 --- a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/ChemicalTesting.java +++ b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/ChemicalTesting.java @@ -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; @@ -37,17 +39,14 @@ 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); @@ -55,64 +54,45 @@ private void setupForm() { //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 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); } diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/General.java b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/General.java new file mode 100644 index 0000000..f12516f --- /dev/null +++ b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/General.java @@ -0,0 +1,188 @@ +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; + +import me.riddhimanadib.formmaster.FormBuilder; +import me.riddhimanadib.formmaster.model.BaseFormElement; +import me.riddhimanadib.formmaster.model.FormElementPickerDate; +import me.riddhimanadib.formmaster.model.FormElementPickerMulti; +import me.riddhimanadib.formmaster.model.FormElementPickerSingle; +import me.riddhimanadib.formmaster.model.FormElementPickerTime; +import me.riddhimanadib.formmaster.model.FormElementSwitch; +import me.riddhimanadib.formmaster.model.FormElementTextEmail; +import me.riddhimanadib.formmaster.model.FormElementTextMultiLine; +import me.riddhimanadib.formmaster.model.FormElementTextNumber; +import me.riddhimanadib.formmaster.model.FormElementTextPassword; +import me.riddhimanadib.formmaster.model.FormElementTextPhone; +import me.riddhimanadib.formmaster.model.FormElementTextSingleLine; +import me.riddhimanadib.formmaster.model.FormHeader; + +public class General extends AppCompatActivity{ + //HQ form + private FormBuilder formBuilder; + private RecyclerView recyclerView; + + String nameOfInspector = ""; + String nameOfSite = ""; + String dateRow = ""; + + double outfall = 0.0; + double longitude = 0.0; + double latitude = 0.0; + double invertElevation = 0.0; + + String type = ""; + String pipeSize = ""; + String channelBottomWidth = ""; + String receivingWater = ""; + + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.activity_sample_fordm); + recyclerView = findViewById(R.id.recyclerView2); + setupForm(); + } + + private void setupForm() { + List 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); + + List pipeTypeOptions = new ArrayList(); + pipeTypeOptions.add("Enclosed Pipe"); + pipeTypeOptions.add("Open Channel"); + FormElementPickerMulti typeValue = FormElementPickerMulti.createInstance().setTitle("Type").setOptions(pipeTypeOptions); + type = typeValue.getValue(); + formItems.add(typeValue); + + List pipeSizeOptions = new ArrayList(); + 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(); + formItems.add(pipeSizeValue); + + List channelWidthOptions = new ArrayList(); + 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(); + formItems.add(channelBottomWidthValue); + + List receivingWaterOptions = new ArrayList(); + 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(); + formItems.add(receiving); + } + + public String getName() { + return nameOfInspector; + } + + public String getSite() { + return nameOfSite; + } + + public String getDate() { + return dateRow; + } + + public double getOutfall() { + return outfall; + } + + public double getLongitude() { + return longitude; + } + + public double getLatitude() { + return latitude; + } + + public double getInvertElevation() { + return invertElevation; + } + + public String getType() { + return type; + } + + public String getPipeSize() { + return pipeSize; + } + + public String getChannelBottomWidth() { + return channelBottomWidth; + } + + public String getReceivingWater() { + return receivingWater; + } + +} diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayFormFragment.java b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayFormFragment.java index a31a832..68aa3fe 100644 --- a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayFormFragment.java +++ b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayFormFragment.java @@ -22,6 +22,9 @@ import me.riddhimanadib.formmaster.FormBuilder; import me.riddhimanadib.formmaster.model.BaseFormElement; +import me.riddhimanadib.formmaster.model.FormElementPickerDate; +import me.riddhimanadib.formmaster.model.FormElementPickerMulti; +import me.riddhimanadib.formmaster.model.FormElementSwitch; import me.riddhimanadib.formmaster.model.FormElementTextNumber; import me.riddhimanadib.formmaster.model.FormElementTextSingleLine; import me.riddhimanadib.formmaster.model.FormHeader; @@ -142,9 +145,109 @@ public void onClick(View v) { } private void setupFormGen() { + String nameOfInspector = ""; + String nameOfSite = ""; + String dateRow = ""; + + double outfall = 0.0; + double longitude = 0.0; + double latitude = 0.0; + double invertElevation = 0.0; + + String type = ""; + String pipeSize = ""; + String channelBottomWidth = ""; + String receivingWater = ""; + boolgen = true; - - + fbGEn = new FormBuilder(getContext(), rvGen); + + List 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); + + List pipeTypeOptions = new ArrayList(); + pipeTypeOptions.add("Enclosed Pipe"); + pipeTypeOptions.add("Open Channel"); + FormElementPickerMulti typeValue = FormElementPickerMulti.createInstance().setTitle("Type").setOptions(pipeTypeOptions); + type = typeValue.getValue(); + formItems.add(typeValue); + + List pipeSizeOptions = new ArrayList(); + 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(); + formItems.add(pipeSizeValue); + + List channelWidthOptions = new ArrayList(); + 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(); + formItems.add(channelBottomWidthValue); + + List receivingWaterOptions = new ArrayList(); + 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(); + formItems.add(receiving); } private void setupFormHQ() { boolhq = true; @@ -168,7 +271,7 @@ private void setupFormHQ() { FormElementTextNumber element18 = FormElementTextNumber.createInstance().setTitle("Land Use").setValue("0"); FormElementTextNumber element19 = FormElementTextNumber.createInstance().setTitle("Bank Erosion").setValue("0"); - formItemsHQ = new ArrayList<>(); + formItemsHQ = new ArrayList<>(); formItemsHQ.add(element2); formItemsHQ.add(element3); @@ -192,49 +295,63 @@ private void setupFormHQ() { } private void setupFormDWS() { + String flowVal = ""; + String odorVal = ""; + String colorVal = ""; + String polutantsVal = ""; + String obstructionVal = ""; + String maintenanceVal = ""; + String screenVal = ""; + + boolean flowPres = false; + boolean odorPres = false; + boolean colorPres = false; + boolean polutantsPres = false; + boolean obstructionPres = false; + boolean needMaintenance = false; + boolean screenOK = false; + booldws = true; fbDWS = new FormBuilder(getContext(), rvDWS); + FormHeader title = (FormHeader) new FormHeader().setTitle("Dry Weather Screening"); - //Outfall --> Question: How do you do a subheading? - FormElementTextSingleLine flow = new FormElementTextSingleLine().setTitle("Presence of Flow"); - FormElementTextNumber flowData = FormElementTextNumber.createInstance(); //what data type is this? + FormElementSwitch flow = FormElementSwitch.createInstance().setTitle("Presence of Flow").setSwitchTexts("Yes", "No"); + flowPres = convertToBoolean(flow.getValue()); - FormElementTextSingleLine odor = new FormElementTextSingleLine().setTitle("Unusual Odor"); - FormElementTextNumber odorData = FormElementTextNumber.createInstance(); + FormElementSwitch odor = FormElementSwitch.createInstance().setTitle("Unusual Odor").setSwitchTexts("Yes", "No"); + odorVal = odor.getValue(); + odorPres = convertToBoolean(odorVal); - FormElementTextSingleLine color = new FormElementTextSingleLine().setTitle("Unusual Color"); - FormElementTextNumber colorData = FormElementTextNumber.createInstance(); + FormElementSwitch color = FormElementSwitch.createInstance().setTitle("Unusual Color").setSwitchTexts("Yes", "No"); + colorVal = color.getValue(); + colorPres = convertToBoolean(colorVal); - FormElementTextSingleLine polutants = new FormElementTextSingleLine().setTitle("Polutants Nearby"); - FormElementTextNumber polutantsData = FormElementTextNumber.createInstance(); - polutantsData.setTitle("Polutants Data"); + FormElementSwitch polutants = FormElementSwitch.createInstance().setTitle("Polutants Nearby").setSwitchTexts("Yes", "No"); + polutantsVal = polutants.getValue(); + polutantsPres = convertToBoolean(polutantsVal); - FormElementTextSingleLine obstruction = new FormElementTextSingleLine().setTitle("Obstruction"); - FormElementTextNumber obstructionData = FormElementTextNumber.createInstance(); + FormElementSwitch obstruction = FormElementSwitch.createInstance().setTitle("Obstruction").setSwitchTexts("Yes", "No"); + obstructionVal = obstruction.getValue(); + obstructionPres = convertToBoolean(obstructionVal); - FormElementTextSingleLine maintenance = new FormElementTextSingleLine().setTitle("Needs Maintenance"); - FormElementTextNumber maintenanceData = FormElementTextNumber.createInstance(); + FormElementSwitch maintenance = FormElementSwitch.createInstance().setTitle("Needs Maintenance").setSwitchTexts("Yes", "No"); + maintenanceVal = maintenance.getValue(); + needMaintenance = convertToBoolean(maintenanceVal); - FormElementTextSingleLine screen = new FormElementTextSingleLine().setTitle("Screen OK"); - FormElementTextNumber screenData = FormElementTextNumber.createInstance(); + FormElementSwitch screen = FormElementSwitch.createInstance().setTitle("Screen OK").setSwitchTexts("Yes", "No"); + screenVal = screen.getValue(); + screenOK = convertToBoolean(screenVal); formItemsDWS = new ArrayList<>(); formItemsDWS.add(flow); - formItemsDWS.add(flowData); formItemsDWS.add(odor); - formItemsDWS.add(odorData); formItemsDWS.add(color); - formItemsDWS.add(colorData); formItemsDWS.add(polutants); - formItemsDWS.add(polutantsData); formItemsDWS.add(obstruction); - formItemsDWS.add(obstructionData); formItemsDWS.add(maintenance); - formItemsDWS.add(maintenanceData); formItemsDWS.add(screen); - formItemsDWS.add(screenData); fbDWS.addFormElements(formItemsDWS); } @@ -242,59 +359,56 @@ private void setupFormCT() { boolct = true; fbCT = new FormBuilder(getContext(), rvCT); - FormHeader title = (FormHeader) new FormHeader().setTitle("Chemical Testing"); + double tempVal = 0.0; + double turbidityVal = 0.0; + double phVal = 0.0; + double nitrateVal = 0.0; + double phosphateVal = 0.0; + double oxygenVal = 0.0; + double coliVal = 0.0; + double other1Val = 0.0; + double other2Val = 0.0; - //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? + FormHeader title = (FormHeader) new FormHeader().setTitle("Chemical Testing"); - FormElementTextSingleLine tubidity = new FormElementTextSingleLine().setTitle("Tubidity (NTU)"); - FormElementTextNumber tubidityData = FormElementTextNumber.createInstance(); + FormElementTextSingleLine temperature = new FormElementTextSingleLine().setTitle("Temperature (C) Change").setValue("0"); + tempVal = Double.parseDouble(temperature.getValue()); - FormElementTextSingleLine pH = new FormElementTextSingleLine().setTitle("pH"); - FormElementTextNumber pHData = FormElementTextNumber.createInstance(); + FormElementTextSingleLine tubidity = new FormElementTextSingleLine().setTitle("Tubidity (NTU)").setValue("0"); + turbidityVal = Double.parseDouble(tubidity.getValue()); - FormElementTextSingleLine nitrate = new FormElementTextSingleLine().setTitle("Nitrate (mg/L)"); - FormElementTextNumber nitrateData = FormElementTextNumber.createInstance(); + FormElementTextSingleLine pH = new FormElementTextSingleLine().setTitle("pH").setValue("0"); + phVal = Double.parseDouble(pH.getValue()); - FormElementTextSingleLine phosphate = new FormElementTextSingleLine().setTitle("Total Phosphate (mg/L)"); - FormElementTextNumber phosphateData = FormElementTextNumber.createInstance(); + FormElementTextSingleLine nitrate = new FormElementTextSingleLine().setTitle("Nitrate (mg/L)").setValue("0"); + nitrateVal = Double.parseDouble(nitrate.getValue()); - FormElementTextSingleLine oxygen = new FormElementTextSingleLine().setTitle("Dissolved Oxygen (mg/L)"); - FormElementTextNumber oxygenData = FormElementTextNumber.createInstance(); + FormElementTextSingleLine phosphate = new FormElementTextSingleLine().setTitle("Total Phosphate (mg/L)").setValue("0"); + phosphateVal = Double.parseDouble(phosphate.getValue()); - FormElementTextSingleLine coli = new FormElementTextSingleLine().setTitle("E Coli (col/100mL)"); - FormElementTextNumber coliData = FormElementTextNumber.createInstance(); + FormElementTextSingleLine oxygen = new FormElementTextSingleLine().setTitle("Dissolved Oxygen (mg/L)").setValue("0"); + oxygenVal = Double.parseDouble(oxygen.getValue()); - FormElementTextSingleLine other1 = new FormElementTextSingleLine().setTitle("Other 1"); - FormElementTextNumber other1Data = FormElementTextNumber.createInstance(); + FormElementTextSingleLine coli = new FormElementTextSingleLine().setTitle("E Coli (col/100mL)").setValue("0"); + coliVal = Double.parseDouble(coli.getValue()); - FormElementTextSingleLine other2 = new FormElementTextSingleLine().setTitle("Other 2"); - FormElementTextNumber other2Data = FormElementTextNumber.createInstance(); + FormElementTextSingleLine other1 = new FormElementTextSingleLine().setTitle("Other 1").setValue(""); + other1Val = Double.parseDouble(other1.getValue()); - formItemsCT = new ArrayList<>(); + FormElementTextSingleLine other2 = new FormElementTextSingleLine().setTitle("Other 2").setValue(""); + other2Val = Double.parseDouble(other2.getValue()); + formItemsCT = new ArrayList<>(); formItemsCT.add(title); formItemsCT.add(temperature); - formItemsCT.add(tempData); formItemsCT.add(tubidity); - formItemsCT.add(tubidityData); formItemsCT.add(pH); - formItemsCT.add(pHData); formItemsCT.add(nitrate); - formItemsCT.add(nitrateData); formItemsCT.add(phosphate); - formItemsCT.add(phosphateData); formItemsCT.add(oxygen); - formItemsCT.add(oxygenData); formItemsCT.add(coli); - formItemsCT.add(coliData); formItemsCT.add(other1); - formItemsCT.add(other1Data); formItemsCT.add(other2); - formItemsCT.add(other2Data); fbCT.addFormElements(formItemsCT); @@ -303,4 +417,12 @@ private void setupFormBM() { boolbm = true; } + + public boolean convertToBoolean(String s) { + if (s.compareTo("Yes") == 0) { + return true; + } else { + return false; + } + } } \ No newline at end of file