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 @@ -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,7 +36,15 @@ public class DryWeatherScreening extends AppCompatActivity{
String maintenanceVal = "";
String screenVal = "";

FormElementTextEmail element11;
boolean flowPres = false;
boolean odorPres = false;
boolean colorPres = false;
boolean polutantsPres = false;
boolean obstructionPres = false;
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);
Expand All @@ -49,52 +56,81 @@ 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 flow = FormElementTextSingleLine.createInstance().setTitle("Presence of Flow").setValue("No");
flowVal = flow.getValue();
flowPres = convertToBoolean(flowVal);

FormElementTextSingleLine odor = new FormElementTextSingleLine().setTitle("Unusual Odor");
FormElementTextNumber odorData = FormElementTextNumber.createInstance();
odorVal = odorData.getValue();
FormElementTextSingleLine odor = FormElementTextSingleLine.createInstance().setTitle("Unusual Odor").setValue("No");
odorVal = odor.getValue();
odorPres = convertToBoolean(odorVal);

FormElementTextSingleLine color = new FormElementTextSingleLine().setTitle("Unusual Color");
FormElementTextNumber colorData = FormElementTextNumber.createInstance();
colorVal = colorData.getValue();
FormElementTextSingleLine color = FormElementTextSingleLine.createInstance().setTitle("Unusual Color").setValue("No");
colorVal = color.getValue();
colorPres = convertToBoolean(colorVal);

FormElementTextSingleLine polutants = new FormElementTextSingleLine().setTitle("Polutants Nearby");
FormElementTextNumber polutantsData = FormElementTextNumber.createInstance();
polutantsVal = polutantsData.getValue();
FormElementTextSingleLine polutants = FormElementTextSingleLine.createInstance().setTitle("Polutants Nearby").setValue("No");
polutantsVal = polutants.getValue();
polutantsPres = convertToBoolean(polutantsVal)

FormElementTextSingleLine obstruction = new FormElementTextSingleLine().setTitle("Obstruction");
FormElementTextNumber obstructionData = FormElementTextNumber.createInstance();
obstructionVal = obstructionData.getValue();
FormElementTextSingleLine obstruction = FormElementTextSingleLine.createInstance().setTitle("Obstruction").setValue("No");
obstructionVal = obstruction.getValue();
obstructionPres = convertToBoolean(obstructionVal);

FormElementTextSingleLine maintenance = new FormElementTextSingleLine().setTitle("Needs Maintenance");
FormElementTextNumber maintenanceData = FormElementTextNumber.createInstance();
maintenanceVal = maintenanceData.getValue();
FormElementTextSingleLine maintenance = FormElementTextSingleLine.createInstance().setTitle("Needs Maintenance").setValue("No");
maintenanceVal = maintenance.getValue();
needMaintenance = convertToBoolean(maintenanceVal);

FormElementTextSingleLine screen = new FormElementTextSingleLine().setTitle("Screen OK");
FormElementTextNumber screenData = FormElementTextNumber.createInstance();
screenVal = screenData.getValue();
FormElementTextSingleLine screen = FormElementTextSingleLine.createInstance().setTitle("Screen OK").setValue("No");
screenVal = screen.getValue();
screenOK = convertToBoolean(screenVal);

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

formItems.add(flow);
formItems.add(flowData);
formItems.add(odor);
formItems.add(odorData);
formItems.add(color);
formItems.add(colorData);
formItems.add(polutants);
formItems.add(polutantsData);
formItems.add(obstruction);
formItems.add(obstructionData);
formItems.add(maintenance);
formItems.add(maintenanceData);
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
@@ -0,0 +1,162 @@
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 {
//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 = "";
String routineEvaluation = "";
String complaintInvestigation = "";

String comments = "";

/*protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample_fordm);
recyclerView = findViewById(R.id.recyclerView2);
setupForm();
}*/

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

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

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

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

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

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

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

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

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

FormElementTextSingleLine typeValue = FormElementTextSingleLine.createInstance().setTitle("Type").setValue("");
type = typeValue.getValue();

FormElementTextSingleLine pipeSizeValue = FormElementTextSingleLine.createInstance().setTitle("Pipe Size").setValue("");
pipeSize = pipeSizeValue.getValue();

FormElementTextSingleLine channelBottomWidthValue = FormElementTextSingleLine.createInstance().setTitle("Channel Bottom Width")
.setValue("");
channelBottomWidth = channelBottomWidthValue.getValue();

FormElementTextSingleLine receiving = FormElementTextSingleLine.createInstance().setTitle("Receiving Water").setValue("");
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();
}

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

public String getRoutineEvaluation() {
return routineEvaluation;
}

public String getComplaintInvestigation() {
return complaintInvestigation;
}

public String getComments() {
return comments;
}
}