diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayForm.java b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayForm.java index 8ceee50..08cad4f 100644 --- a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayForm.java +++ b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayForm.java @@ -14,7 +14,18 @@ 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 WaterWayForm extends AppCompatActivity { //HQ form @@ -48,34 +59,77 @@ public class WaterWayForm extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_sample_fordm); recyclerView = findViewById(R.id.recyclerView2); - setupHQForm(); - + setupForm(); } - private void setupHQForm() { + private void setupForm() { formBuilder = new FormBuilder(this, recyclerView); - FormElementTextNumber subSize = FormElementTextNumber.createInstance().setTitle("Substrate Size").setValue("0"); - FormElementTextNumber smothering = FormElementTextNumber.createInstance().setTitle("Smothering").setValue("0"); - FormElementTextNumber silting = FormElementTextNumber.createInstance().setTitle("Silting").setValue("0"); - FormElementTextNumber rootwads = FormElementTextNumber.createInstance().setTitle("Rootwads").setValue("0"); - FormElementTextNumber overhangingVeg = FormElementTextNumber.createInstance().setTitle("Overhanging Veg.").setValue("0"); - FormElementTextNumber oxbows = FormElementTextNumber.createInstance().setTitle("Oxbows/Black Waters").setValue("0"); - FormElementTextNumber downed = FormElementTextNumber.createInstance().setTitle("Downed Trees/Logs").setValue("0"); - FormElementTextNumber shallows = FormElementTextNumber.createInstance().setTitle("Shallows (slow water)").setValue("0"); - FormElementTextNumber waterPlants = FormElementTextNumber.createInstance().setTitle("Water Plants").setValue("0"); - FormElementTextNumber deepPools = FormElementTextNumber.createInstance().setTitle("Deep Pools").setValue("0"); - FormElementTextNumber logs = FormElementTextNumber.createInstance().setTitle("Logs/Woody Debris").setValue("0"); - FormElementTextNumber boulders = FormElementTextNumber.createInstance().setTitle("Boulders").setValue("0"); - FormElementTextNumber undercutBanks = FormElementTextNumber.createInstance().setTitle("Undercut Banks").setValue("0"); - FormElementTextNumber sinuosity = FormElementTextNumber.createInstance().setTitle("Sinuosity").setValue("0"); - FormElementTextNumber natural = FormElementTextNumber.createInstance().setTitle("Natural").setValue("0"); - FormElementTextNumber riparianWidth = FormElementTextNumber.createInstance().setTitle("Riparian Width").setValue("0"); - FormElementTextNumber landUse = FormElementTextNumber.createInstance().setTitle("Land Use").setValue("0"); - FormElementTextNumber bankErosion = FormElementTextNumber.createInstance().setTitle("Bank Erosion").setValue("0"); + List array_subSize = new ArrayList<>(); + array_subSize.add("14: Large(4\" or larger)"); + array_subSize.add("10: Medium(1\" to 4\")"); + array_subSize.add("6: Small(.25\" to 1\")"); + array_subSize.add("0: Fine(granular)"); + + FormElementPickerSingle subSize = FormElementPickerSingle.createInstance().setTitle("Substrate Size").setOptions(array_subSize).setPickerTitle("Pick one option"); + List array_yesNo5 = new ArrayList<>(); + array_yesNo5.add("0: Yes"); + array_yesNo5.add("5: No"); + + List array_yesNo2 = new ArrayList<>(); + array_yesNo2.add("2: Yes"); + array_yesNo2.add("0: No"); + + List array_sinuosity = new ArrayList<>(); + array_sinuosity.add("8: Two or more bends"); + array_sinuosity.add("3: Less than two bends"); + + List array_natural = new ArrayList<>(); + array_natural.add("12: Mostly Natural"); + array_natural.add("9: Minor Man-made impacts"); + array_natural.add("6: Many Man-made changes"); + array_natural.add("0: Completely Manipulated"); + + List array_riparian = new ArrayList<>(); + array_riparian.add("8: Wide (20' or more)"); + array_riparian.add("5: Narrow (Less than 20')"); + array_riparian.add("0: None"); + + List array_landUse = new ArrayList<>(); + array_landUse.add("5: Forest/Wetland"); + array_landUse.add("4: Shrub"); + array_landUse.add("3: Overgrown Fields"); + array_landUse.add("2: Fenced Pasture"); + array_landUse.add("2: Parkland/Grass"); + array_landUse.add("2: Conservation Tillage"); + array_landUse.add("1: Row Crop"); + array_landUse.add("0: Open Pasture"); + array_landUse.add("0: Urban/Industrial"); + + List array_bankErosion = new ArrayList<>(); + array_bankErosion.add("4: None/Little"); + array_bankErosion.add("2: Moderate"); + array_bankErosion.add("0: Heavy/Severe"); + + FormElementPickerSingle smothering = FormElementPickerSingle.createInstance().setTitle("Smothering").setOptions(array_yesNo5).setPickerTitle("Pick one option"); + FormElementPickerSingle silting = FormElementPickerSingle.createInstance().setTitle("Silting").setOptions(array_yesNo5).setPickerTitle("Pick one option"); + FormElementPickerSingle rootwads = FormElementPickerSingle.createInstance().setTitle("Rootwads").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle overhangingVeg = FormElementPickerSingle.createInstance().setTitle("Overhanging Veg.").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle oxbows = FormElementPickerSingle.createInstance().setTitle("Oxbows/Black Waters").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle downed = FormElementPickerSingle.createInstance().setTitle("Downed Trees/Logs").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle shallows = FormElementPickerSingle.createInstance().setTitle("Shallows (slow water)").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle waterPlants = FormElementPickerSingle.createInstance().setTitle("Water Plants").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle deepPools = FormElementPickerSingle.createInstance().setTitle("Deep Pools").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle logs = FormElementPickerSingle.createInstance().setTitle("Logs/Woody Debris").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle boulders = FormElementPickerSingle.createInstance().setTitle("Boulders").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle undercutBanks = FormElementPickerSingle.createInstance().setTitle("Undercut Banks").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle sinuosity = FormElementPickerSingle.createInstance().setTitle("Sinuosity").setOptions(array_sinuosity).setPickerTitle("Pick one option"); + FormElementPickerSingle natural = FormElementPickerSingle.createInstance().setTitle("Natural").setOptions(array_natural).setPickerTitle("Pick one option"); + FormElementPickerSingle riparianWidth = FormElementPickerSingle.createInstance().setTitle("Riparian Width").setOptions(array_riparian).setPickerTitle("Pick one option"); + FormElementPickerSingle landUse = FormElementPickerSingle.createInstance().setTitle("Land Use").setOptions(array_landUse).setPickerTitle("Pick one option"); + FormElementPickerSingle bankErosion = FormElementPickerSingle.createInstance().setTitle("Bank Erosion").setOptions(array_bankErosion).setPickerTitle("Pick one option"); List formItems = new ArrayList<>(); @@ -99,28 +153,40 @@ private void setupHQForm() { formItems.add(bankErosion); formBuilder.addFormElements(formItems); + subVal = pickerValue(subSize); + + smothVal = pickerValue(smothering); + siltVal = pickerValue(silting); + rootVal = pickerValue(rootwads); + overVegVal = pickerValue(overhangingVeg); + oxVal = pickerValue(oxbows); + downVal = pickerValue(downed); + shallowVal = pickerValue(shallows); + watVal = pickerValue(waterPlants); + deepVal = pickerValue(deepPools); + logVal = pickerValue(logs); + bouldVal = pickerValue(boulders); + underVal = pickerValue(undercutBanks); + sinVal = pickerValue(sinuosity); + natVal = pickerValue(natural); + ripVal = pickerValue(riparianWidth); + landVal = pickerValue(landUse); + bankVal = pickerValue(bankErosion); - subVal = Double.parseDouble(subSize.getValue()); - smothVal = Double.parseDouble(smothering.getValue()); - siltVal = Double.parseDouble(silting.getValue()); - rootVal = Double.parseDouble(rootwads.getValue()); - overVegVal = Double.parseDouble(overhangingVeg.getValue()); - oxVal = Double.parseDouble(oxbows.getValue()); - downVal = Double.parseDouble(downed.getValue()); - shallowVal = Double.parseDouble(shallows.getValue()); - watVal = Double.parseDouble(waterPlants.getValue()); - deepVal = Double.parseDouble(deepPools.getValue()); - logVal = Double.parseDouble(logs.getValue()); - bouldVal = Double.parseDouble(boulders.getValue()); - underVal = Double.parseDouble(undercutBanks.getValue()); - sinVal = Double.parseDouble(sinuosity.getValue()); - natVal = Double.parseDouble(natural.getValue()); - ripVal = Double.parseDouble(riparianWidth.getValue()); - landVal = Double.parseDouble(landUse.getValue()); - bankVal = Double.parseDouble(bankErosion.getValue()); - - + } + private double pickerValue(FormElementPickerSingle var){ + int index = var.getValue().indexOf(":"); + double pickerOption; + if (index > 0) + { + pickerOption = Double.parseDouble(var.getValue().substring(0,index)); + } + else + { + pickerOption = 0; + } + return(pickerOption); } private void setupTolerantForm(){ formBuilder = new FormBuilder(this, recyclerView); 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 19564e1..69bd48c 100644 --- a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayFormFragment.java +++ b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayFormFragment.java @@ -18,12 +18,15 @@ import com.sf.stormwaterutilityandroid.SampleFordm; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; 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.FormElementSwitch; import me.riddhimanadib.formmaster.model.FormElementTextNumber; import me.riddhimanadib.formmaster.model.FormElementTextSingleLine; @@ -31,6 +34,99 @@ public class WaterWayFormFragment extends Fragment { + //Gen Form Variable Initialization + String nameOfInspector = ""; + String nameOfSite = ""; + String dateRow = ""; + + String outfall = ""; + String longitude = ""; + String latitude = ""; + String invertElevation = ""; + + String type = ""; + String pipeSize = ""; + String channelBottomWidth = ""; + String receivingWater = ""; + + //DWS Form Variable Initialization + 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; + //CT Form Variable Initialization + double tempVal = 0; + double turbidityVal = 0; + double phVal = 0; + double nitrateVal = 0; + double phosphateVal = 0; + double oxygenVal = 0; + double coliVal = 0; + String other1Val = ""; + String other2Val = ""; + + //HQ Form Variable Initialization + String sub = ""; + String smoth = ""; + String silt = ""; + String rootString = ""; + String overVeg = ""; + String ox = ""; + String down = ""; + String shallow = ""; + String wat = ""; + String deep = ""; + String log = ""; + String bould = ""; + String under = ""; + String sin = ""; + String nat = ""; + String rip = ""; + String land = ""; + String bank = ""; + String stream = ""; + String deepest = ""; + String velocity = ""; + String riffleDepthVar = ""; + String riffleSubstrateVar = ""; + boolean screenOK = false; + double subVal = 0.0; + double smothVal = 0.0; + double siltVal = 0.0; + double rootVal = 0.0; + double overVegVal = 0.0; + double oxVal = 0.0; + double downVal = 0.0; + double shallowVal = 0.0; + double watVal = 0.0; + double deepVal = 0.0; + double logVal = 0.0; + double bouldVal = 0.0; + double underVal = 0.0; + double sinVal = 0.0; + double natVal = 0.0; + double ripVal = 0.0; + double landVal = 0.0; + double bankVal = 0.0; + double streamVal = 0.0; + double deepestVal = 0.0; + double velocityVal = 0.0; + double riffleDepthVal = 0.0; + double riffleSubstrateVal = 0.0; + //Tolerant Form + double intolerantVal = 0.0; + double modTolerantVal = 0.0; + double fairTolerantVal = 0.0; + double veryTolerantVal = 0.0; RecyclerView rvGen, rvDWS, rvHQ, rvBM,rvCT; FormBuilder fbGEn,fbDWS,fbBM,fbHQ,fbCT; SegmentedButton gen,dws,ct,bm,hq; @@ -84,8 +180,82 @@ public void onClick(View v) { submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - + Map WaterWayDoubleFields = new HashMap(); + Map WaterWayBoolFields = new HashMap(); + Map WaterWayStringFields = new HashMap(); + + //Water Quality Index Data + WaterWayDoubleFields.put("CT_temperature_change",tempVal ); + WaterWayDoubleFields.put("CT_turbidity", turbidityVal); + WaterWayDoubleFields.put("CT_pH", phVal); + WaterWayDoubleFields.put("CT_nitrate", nitrateVal); + WaterWayDoubleFields.put("CT_total_phosphate", phosphateVal); + WaterWayDoubleFields.put("CT_dissolved_oxygen", oxygenVal); + //PTI Data + WaterWayDoubleFields.put("BM_intolerant", intolerantVal); + WaterWayDoubleFields.put("BM_moderately_tolerant", modTolerantVal); + WaterWayDoubleFields.put("BM_fairly_tolerant", fairTolerantVal); + WaterWayDoubleFields.put("BM_very_tolerant", veryTolerantVal); + + WaterWayDoubleFields.put("WQI", calculateWQI()); + WaterWayDoubleFields.put("HEI", calculate_HEI()); + WaterWayDoubleFields.put("PTI", calculatePTI()); + + //Boolean Fields + WaterWayBoolFields.put("DWS_needs_maintenance", needMaintenance); + WaterWayBoolFields.put("DWS_obstruction", obstructionPres); + WaterWayBoolFields.put("DWS_polutants", polutantsPres); + WaterWayBoolFields.put("DWS_presence_of_flow", flowPres); + WaterWayBoolFields.put("DWS_screened_OK", screenOK); + WaterWayBoolFields.put("DWS_unusual_color", colorPres); + WaterWayBoolFields.put("DWS_unusual_odor", odorPres); + WaterWayBoolFields.put("FC_complaint_investigation", new Boolean(false)); + WaterWayBoolFields.put("FC_further_action_needed", new Boolean(false)); + WaterWayBoolFields.put("FC_illicit_discharge_detected", new Boolean(false)); + WaterWayBoolFields.put("FC_no_illicit_discharge_detected", new Boolean(false)); + WaterWayBoolFields.put("FC_routine_evaluation", new Boolean(false)); + + //String Fields +//HEI Data + WaterWayStringFields.put("QHEI_substrate_size", sub ); + WaterWayStringFields.put("QHEI_smothering", smoth); + WaterWayStringFields.put("QHEI_silting", silt); + WaterWayStringFields.put("QHEI_rootwads", rootString); + WaterWayStringFields.put("QHEI_overhanging_veg", overVeg); + WaterWayStringFields.put("QHEI_oxbowsblack_waters", ox ); + WaterWayStringFields.put("QHEI_downed_treeslogs",down); + WaterWayStringFields.put("QHEI_shallows", shallow); + WaterWayStringFields.put("QHEI_water_plants", wat); + WaterWayStringFields.put("QHEI_deep_pools", deep); + WaterWayStringFields.put("QHEI_logswoody_debris", log); + WaterWayStringFields.put("QHEI_boulders", bould); + WaterWayStringFields.put("QHEI_undercut_banks", under); + WaterWayStringFields.put("QHEI_sinuosity", sin); + WaterWayStringFields.put("QHEI_riparian_width", rip); + WaterWayStringFields.put("QHEI_land_use", land); + WaterWayStringFields.put("QHEI_bank_erosion", bank); + WaterWayStringFields.put("QHEI_stream_shading", stream); + WaterWayStringFields.put("QHEI_deepest_pool", deepest); + WaterWayStringFields.put("QHEI_velocity", velocity); + WaterWayStringFields.put("QHEI_rifflerun_depth", riffleDepthVar); + WaterWayStringFields.put("QHEI_rifflerun_substrate", riffleSubstrateVar); + + WaterWayStringFields.put("GOD_channel_bottom_width", channelBottomWidth); + WaterWayStringFields.put("GOD_invert_elevation", invertElevation); + WaterWayStringFields.put("GOD_latitude", latitude); + WaterWayStringFields.put("GOD_longitude", longitude); + WaterWayStringFields.put("GOD_outfall", outfall); + WaterWayStringFields.put("GOD_pipe_size", pipeSize); + WaterWayStringFields.put("GOD_receiving_water", receivingWater); + WaterWayStringFields.put("GOD_type", type); + + //Comments + WaterWayStringFields.put("CS_comments", ""); + WaterWayStringFields.put("CT_other_1", ""); + WaterWayStringFields.put("CT_other_2", ""); } + + }); dws.setOnClickListener(new View.OnClickListener() { @Override @@ -143,21 +313,24 @@ public void onClick(View v) { return root; } + private double calculate_HEI() + { + return subVal + smothVal + siltVal + rootVal + overVegVal + + oxVal + downVal + shallowVal + watVal + deepVal + + logVal + bouldVal + underVal + 2 * (sinVal + natVal) + + ripVal + landVal + bankVal + streamVal + deepestVal + + velocityVal + riffleDepthVal + riffleSubstrateVal; + } + private double calculatePTI() { + return 4.0 * intolerantVal + 3.0 * modTolerantVal + 2.0 * fairTolerantVal + 1.0 * veryTolerantVal; + } + private double calculateWQI() { + double WQIScore = tempVal * 0.11 + turbidityVal * 0.09 + phVal * 0.12 + nitrateVal * 0.1 + + phosphateVal * 0.11 + oxygenVal * 0.18; + return WQIScore; + } 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); @@ -179,19 +352,19 @@ private void setupFormGen() { formItemsGen.add(date); FormElementTextSingleLine outfallValue = FormElementTextSingleLine.createInstance().setTitle("Outfall").setValue("0"); - outfall = Double.parseDouble(outfallValue.getValue()); + outfall = String.valueOf(outfallValue.getValue()); formItemsGen.add(outfallValue); FormElementTextSingleLine longitudeValue = FormElementTextSingleLine.createInstance().setTitle("Longitude").setValue("0"); - longitude = Double.parseDouble(longitudeValue.getValue()); + longitude = String.valueOf(longitudeValue.getValue()); formItemsGen.add(longitudeValue); FormElementTextSingleLine latitudeValue = FormElementTextSingleLine.createInstance().setTitle("Latitude").setValue("0"); - latitude = Double.parseDouble(latitudeValue.getValue()); + latitude = String.valueOf(latitudeValue.getValue()); formItemsGen.add(latitudeValue); FormElementTextSingleLine invertElevationValue = FormElementTextSingleLine.createInstance().setTitle("Invert Elevation").setValue("0"); - invertElevation = Double.parseDouble(invertElevationValue.getValue()); + invertElevation = String.valueOf(invertElevationValue.getValue()); formItemsGen.add(invertElevationValue); List pipeTypeOptions = new ArrayList(); @@ -253,64 +426,194 @@ private void setupFormGen() { private void setupFormHQ() { boolhq = true; fbHQ = new FormBuilder(getContext(),rvHQ); - FormElementTextNumber element2 = FormElementTextNumber.createInstance().setTitle("Substrate Size").setValue("0"); - FormElementTextNumber element3 = FormElementTextNumber.createInstance().setTitle("Smothering").setValue("0"); - FormElementTextNumber element4 = FormElementTextNumber.createInstance().setTitle("Silting").setValue("0"); - FormElementTextNumber element5 = FormElementTextNumber.createInstance().setTitle("Rootwads").setValue("0"); - FormElementTextNumber element6 = FormElementTextNumber.createInstance().setTitle("Overhanging Veg.").setValue("0"); - FormElementTextNumber element7 = FormElementTextNumber.createInstance().setTitle("Oxbows/Black Waters").setValue("0"); - FormElementTextNumber element8 = FormElementTextNumber.createInstance().setTitle("Downed Trees/Logs").setValue("0"); - FormElementTextNumber element9 = FormElementTextNumber.createInstance().setTitle("Shallows (slow water)").setValue("0"); - FormElementTextNumber element10 = FormElementTextNumber.createInstance().setTitle("Water Plants").setValue("0"); - FormElementTextNumber element11 = FormElementTextNumber.createInstance().setTitle("Deep Pools").setValue("0"); - FormElementTextNumber element12 = FormElementTextNumber.createInstance().setTitle("Logs/Woody Debris").setValue("0"); - FormElementTextNumber element13 = FormElementTextNumber.createInstance().setTitle("Boulders").setValue("0"); - FormElementTextNumber element14 = FormElementTextNumber.createInstance().setTitle("Undercut Banks").setValue("0"); - FormElementTextNumber element15 = FormElementTextNumber.createInstance().setTitle("Sinuosity").setValue("0"); - FormElementTextNumber element16 = FormElementTextNumber.createInstance().setTitle("Natural").setValue("0"); - FormElementTextNumber element17 = FormElementTextNumber.createInstance().setTitle("Riparian Width").setValue("0"); - FormElementTextNumber element18 = FormElementTextNumber.createInstance().setTitle("Land Use").setValue("0"); - FormElementTextNumber element19 = FormElementTextNumber.createInstance().setTitle("Bank Erosion").setValue("0"); - - formItemsHQ = new ArrayList<>(); - - formItemsHQ.add(element2); - formItemsHQ.add(element3); - formItemsHQ.add(element4); - formItemsHQ.add(element5); - formItemsHQ.add(element6); - formItemsHQ.add(element7); - formItemsHQ.add(element8); - formItemsHQ.add(element9); - formItemsHQ.add(element10); - formItemsHQ.add(element11); - formItemsHQ.add(element12); - formItemsHQ.add(element13); - formItemsHQ.add(element14); - formItemsHQ.add(element15); - formItemsHQ.add(element16); - formItemsHQ.add(element17); - formItemsHQ.add(element18); - formItemsHQ.add(element19); - fbHQ.addFormElements(formItemsHQ); + List array_subSize = new ArrayList<>(); + array_subSize.add("14: Large(4\" or larger)"); + array_subSize.add("10: Medium(1\" to 4\")"); + array_subSize.add("6: Small(.25\" to 1\")"); + array_subSize.add("0: Fine(granular)"); + + FormElementPickerSingle subSize = FormElementPickerSingle.createInstance().setTitle("Substrate Size").setOptions(array_subSize).setPickerTitle("Pick one option"); + List array_yesNo5 = new ArrayList<>(); + array_yesNo5.add("0: Yes"); + array_yesNo5.add("5: No"); + + List array_yesNo2 = new ArrayList<>(); + array_yesNo2.add("2: Yes"); + array_yesNo2.add("0: No"); + + List array_sinuosity = new ArrayList<>(); + array_sinuosity.add("8: Two or more bends"); + array_sinuosity.add("3: Less than two bends"); + + List array_natural = new ArrayList<>(); + array_natural.add("12: Mostly Natural"); + array_natural.add("9: Minor Man-made impacts"); + array_natural.add("6: Many Man-made changes"); + array_natural.add("0: Completely Manipulated"); + + List array_riparian = new ArrayList<>(); + array_riparian.add("8: Wide (20' or more)"); + array_riparian.add("5: Narrow (Less than 20')"); + array_riparian.add("0: None"); + + List array_landUse = new ArrayList<>(); + array_landUse.add("5: Forest/Wetland"); + array_landUse.add("4: Shrub"); + array_landUse.add("3: Overgrown Fields"); + array_landUse.add("2: Fenced Pasture"); + array_landUse.add("2: Parkland/Grass"); + array_landUse.add("2: Conservation Tillage"); + array_landUse.add("1: Row Crop"); + array_landUse.add("0: Open Pasture"); + array_landUse.add("0: Urban/Industrial"); + + List array_bankErosion = new ArrayList<>(); + array_bankErosion.add("4: None/Little"); + array_bankErosion.add("2: Moderate"); + array_bankErosion.add("0: Heavy/Severe"); + + List array_streamShading = new ArrayList<>(); + array_streamShading.add("3: Mostly"); + array_streamShading.add("2: Moderate"); + array_streamShading.add("0: Heavy/Severe"); + + List array_deepestPool = new ArrayList<>(); + array_deepestPool.add("8: Chest Deep"); + array_deepestPool.add("6: Waist Deep"); + array_deepestPool.add("4: Knee Deep"); + array_deepestPool.add("0: None"); + + List array_velocity = new ArrayList<>(); + array_velocity.add("2: Very Fast"); + array_velocity.add("3: Fast"); + array_velocity.add("1: Moderate"); + array_velocity.add("1: Slow"); + array_velocity.add("0: None"); + + List array_riffleDepth = new ArrayList<>(); + array_riffleDepth.add("8: At Least Knee Deep and Fast"); + array_riffleDepth.add("6: Ankle-Calf Deep and Fast"); + array_riffleDepth.add("4: Ankle-Calf Deep and Slow"); + array_riffleDepth.add("0: Do Not Exist"); + + List array_riffleSub = new ArrayList<>(); + array_riffleSub.add("7: 4\" or larger"); + array_riffleSub.add("4: 1\"-4\""); + array_riffleSub.add("0: Less than 1\" or None"); + + FormElementPickerSingle smothering = FormElementPickerSingle.createInstance().setTitle("Smothering").setOptions(array_yesNo5).setPickerTitle("Pick one option"); + FormElementPickerSingle silting = FormElementPickerSingle.createInstance().setTitle("Silting").setOptions(array_yesNo5).setPickerTitle("Pick one option"); + FormElementPickerSingle rootwads = FormElementPickerSingle.createInstance().setTitle("Rootwads").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle overhangingVeg = FormElementPickerSingle.createInstance().setTitle("Overhanging Veg.").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle oxbows = FormElementPickerSingle.createInstance().setTitle("Oxbows/Black Waters").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle downed = FormElementPickerSingle.createInstance().setTitle("Downed Trees/Logs").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle shallows = FormElementPickerSingle.createInstance().setTitle("Shallows (slow water)").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle waterPlants = FormElementPickerSingle.createInstance().setTitle("Water Plants").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle deepPools = FormElementPickerSingle.createInstance().setTitle("Deep Pools").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle logs = FormElementPickerSingle.createInstance().setTitle("Logs/Woody Debris").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle boulders = FormElementPickerSingle.createInstance().setTitle("Boulders").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle undercutBanks = FormElementPickerSingle.createInstance().setTitle("Undercut Banks").setOptions(array_yesNo2).setPickerTitle("Pick one option"); + FormElementPickerSingle sinuosity = FormElementPickerSingle.createInstance().setTitle("Sinuosity").setOptions(array_sinuosity).setPickerTitle("Pick one option"); + FormElementPickerSingle natural = FormElementPickerSingle.createInstance().setTitle("Natural").setOptions(array_natural).setPickerTitle("Pick one option"); + FormElementPickerSingle riparianWidth = FormElementPickerSingle.createInstance().setTitle("Riparian Width").setOptions(array_riparian).setPickerTitle("Pick one option"); + FormElementPickerSingle landUse = FormElementPickerSingle.createInstance().setTitle("Land Use").setOptions(array_landUse).setPickerTitle("Pick one option"); + FormElementPickerSingle bankErosion = FormElementPickerSingle.createInstance().setTitle("Bank Erosion").setOptions(array_bankErosion).setPickerTitle("Pick one option"); + FormElementPickerSingle streamShading = FormElementPickerSingle.createInstance().setTitle("Stream Shading").setOptions(array_streamShading).setPickerTitle("Pick one option"); + FormElementPickerSingle deepestPool = FormElementPickerSingle.createInstance().setTitle("Deepest Pool").setOptions(array_deepestPool).setPickerTitle("Pick one option"); + FormElementPickerSingle velocityForm = FormElementPickerSingle.createInstance().setTitle("Velocity").setOptions(array_velocity).setPickerTitle("Pick one option"); + FormElementPickerSingle riffleDepth = FormElementPickerSingle.createInstance().setTitle("Riffle/Run Depth").setOptions(array_riffleDepth).setPickerTitle("Pick one option"); + FormElementPickerSingle riffleSub = FormElementPickerSingle.createInstance().setTitle("Riffle/Run Substrate").setOptions(array_riffleSub).setPickerTitle("Pick one option"); + List formItems = new ArrayList<>(); + formItems.add(subSize); + formItems.add(smothering); + formItems.add(silting); + formItems.add(rootwads); + formItems.add(overhangingVeg); + formItems.add(oxbows); + formItems.add(downed); + formItems.add(shallows); + formItems.add(waterPlants); + formItems.add(deepPools); + formItems.add(logs); + formItems.add(boulders); + formItems.add(undercutBanks); + formItems.add(sinuosity); + formItems.add(natural); + formItems.add(riparianWidth); + formItems.add(landUse); + formItems.add(bankErosion); + formItems.add(streamShading); + formItems.add(deepestPool); + formItems.add(velocityForm); + formItems.add(riffleDepth); + formItems.add(riffleSub); + fbHQ.addFormElements(formItems); + subVal = pickerValue(subSize); + sub = subSize.getValue(); + smothVal = pickerValue(smothering); + smoth = smothering.getValue(); + siltVal = pickerValue(silting); + silt = silting.getValue(); + rootVal = pickerValue(rootwads); + rootString = rootwads.getValue(); + overVegVal = pickerValue(overhangingVeg); + overVeg = overhangingVeg.getValue(); + oxVal = pickerValue(oxbows); + streamVal = pickerValue(streamShading); + deepestVal = pickerValue(deepestPool); + velocityVal = pickerValue(velocityForm); + riffleDepthVal = pickerValue(riffleDepth); + riffleSubstrateVal = pickerValue(riffleSub); + + ox = oxbows.getValue(); + downVal = pickerValue(downed); + down = downed.getValue(); + shallowVal = pickerValue(shallows); + shallow = shallows.getValue(); + watVal = pickerValue(waterPlants); + wat = waterPlants.getValue(); + deepVal = pickerValue(deepPools); + deep = deepPools.getValue(); + logVal = pickerValue(logs); + log = logs.getValue(); + bouldVal = pickerValue(boulders); + bould = boulders.getValue(); + underVal = pickerValue(undercutBanks); + under = undercutBanks.getValue(); + sinVal = pickerValue(sinuosity); + sin = sinuosity.getValue(); + natVal = pickerValue(natural); + nat = natural.getValue(); + ripVal = pickerValue(riparianWidth); + rip = riparianWidth.getValue(); + landVal = pickerValue(landUse); + land = landUse.getValue(); + bankVal = pickerValue(bankErosion); + bank = bankErosion.getValue(); + stream = streamShading.getValue(); + deepest = deepestPool.getValue(); + velocity = velocityForm.getValue(); + riffleDepthVar = riffleDepth.getValue(); + riffleSubstrateVar = riffleSub.getValue(); + + + } + + private double pickerValue(FormElementPickerSingle var){ + int index = var.getValue().indexOf(":"); + double pickerOption; + if (index > 0) + { + pickerOption = Double.parseDouble(var.getValue().substring(0,index)); + } + else + { + pickerOption = 0; + } + return(pickerOption); } 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); @@ -357,20 +660,10 @@ private void setupFormDWS() { fbDWS.addFormElements(formItemsDWS); } - private void setupFormCT() { boolct = true; fbCT = new FormBuilder(getContext(), rvCT); - double tempVal = 0; - double turbidityVal = 0; - double phVal = 0; - double nitrateVal = 0; - double phosphateVal = 0; - double oxygenVal = 0; - double coliVal = 0; - String other1Val = ""; - String other2Val = ""; FormHeader title = (FormHeader) new FormHeader().setTitle("Chemical Testing"); @@ -418,6 +711,25 @@ private void setupFormCT() { } private void setupFormBM() { boolbm = true; + fbBM = new FormBuilder(getContext(), rvBM); + + FormElementTextNumber intolerant = FormElementTextNumber.createInstance().setTitle("Intolerant").setValue("0"); + FormElementTextNumber moderatelyTolerant = FormElementTextNumber.createInstance().setTitle("Moderately Tolerant").setValue("0"); + FormElementTextNumber fairlyTolerant = FormElementTextNumber.createInstance().setTitle("Fairly Tolerant").setValue("0"); + FormElementTextNumber veryTolerant = FormElementTextNumber.createInstance().setTitle("Very Tolerant").setValue("0"); + + List formItemsBM = new ArrayList<>(); + formItemsBM.add(intolerant); + formItemsBM.add(moderatelyTolerant); + formItemsBM.add(fairlyTolerant); + formItemsBM.add(veryTolerant); + + intolerantVal = Double.parseDouble(intolerant.getValue()); + modTolerantVal = Double.parseDouble(moderatelyTolerant.getValue()); + fairTolerantVal = Double.parseDouble(fairlyTolerant.getValue()); + veryTolerantVal = Double.parseDouble(veryTolerant.getValue()); + + fbBM.addFormElements(formItemsBM); } public boolean convertToBoolean(String s) {