Skip to content

Commit

Permalink
Merge pull request #18 from EPICSGroup/John
Browse files Browse the repository at this point in the history
Completed Form
  • Loading branch information
seford authored Apr 14, 2021
2 parents 544a2f0 + ae2345a commit 4c593ae
Show file tree
Hide file tree
Showing 2 changed files with 503 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<String> 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<String> array_yesNo5 = new ArrayList<>();
array_yesNo5.add("0: Yes");
array_yesNo5.add("5: No");

List<String> array_yesNo2 = new ArrayList<>();
array_yesNo2.add("2: Yes");
array_yesNo2.add("0: No");

List<String> array_sinuosity = new ArrayList<>();
array_sinuosity.add("8: Two or more bends");
array_sinuosity.add("3: Less than two bends");

List<String> 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<String> 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<String> 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<String> 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<BaseFormElement> formItems = new ArrayList<>();
Expand All @@ -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);
Expand Down
Loading

0 comments on commit 4c593ae

Please sign in to comment.