Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuelford24 authored and Samuelford24 committed Apr 14, 2021
2 parents ff4457c + 4c593ae commit 03b8a54
Show file tree
Hide file tree
Showing 5 changed files with 932 additions and 226 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import me.riddhimanadib.formmaster.model.FormElementTextSingleLine;
import me.riddhimanadib.formmaster.model.FormHeader;


public class DryWeatherScreening extends AppCompatActivity{

private FormBuilder formBuilder;
Expand All @@ -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<BaseFormElement> 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);
}
}

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;
}
}
}

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
Loading

0 comments on commit 03b8a54

Please sign in to comment.