diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..4bec4ea
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ xmlns:android
+
+ ^$
+
+
+
+
+
+
+
+
+ xmlns:.*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*:id
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ .*:name
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ name
+
+ ^$
+
+
+
+
+
+
+
+
+ style
+
+ ^$
+
+
+
+
+
+
+
+
+ .*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*
+
+ http://schemas.android.com/apk/res/android
+
+
+ ANDROID_ATTRIBUTE_ORDER
+
+
+
+
+
+
+ .*
+
+ .*
+
+
+ BY_NAME
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..a55e7a1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index a5f05cd..2370474 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -21,5 +21,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index b11c57e..1f99868 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -30,7 +30,9 @@ android {
}
dependencies {
-
+ //Added this:
+ implementation 'com.github.AnyChart:AnyChart-Android:0.0.3'
+ //Done adding
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
@@ -40,6 +42,7 @@ dependencies {
implementation 'me.riddhimanadib.form-master:form-master:1.1.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.google.firebase:firebase-auth:19.4.0'
+ implementation 'com.github.addisonelliott:SegmentedButton:3.1.9'
implementation 'com.google.firebase:firebase-firestore:21.6.0'
implementation 'com.google.firebase:firebase-storage:19.2.1'
testImplementation 'junit:junit:4.+'
diff --git a/app/google-services.json b/app/google-services.json
new file mode 100644
index 0000000..2545b5d
--- /dev/null
+++ b/app/google-services.json
@@ -0,0 +1,47 @@
+{
+ "project_info": {
+ "project_number": "667793859590",
+ "firebase_url": "https://aquasource-f5e44.firebaseio.com",
+ "project_id": "aquasource-f5e44",
+ "storage_bucket": "aquasource-f5e44.appspot.com"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:667793859590:android:8b4d04aebf855291eb8f87",
+ "android_client_info": {
+ "package_name": "com.sf.stormwaterutilityandroid"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "667793859590-o1vcunhlqe559bvuuetrkj6hels7bisl.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "AIzaSyDbkcA22JD0-r8h4Xu6dcMGMwHpSKyvFc8"
+ }
+ ],
+ "services": {
+ "appinvite_service": {
+ "other_platform_oauth_client": [
+ {
+ "client_id": "667793859590-o1vcunhlqe559bvuuetrkj6hels7bisl.apps.googleusercontent.com",
+ "client_type": 3
+ },
+ {
+ "client_id": "667793859590-kstclkrr6eial9patuhafmclk7p34re2.apps.googleusercontent.com",
+ "client_type": 2,
+ "ios_info": {
+ "bundle_id": "EPICS.StormWaterUtility"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ],
+ "configuration_version": "1"
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f19b33e..7b89ce3 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,8 +2,13 @@
+
-
+
+
+
+
+
+
+ android:theme="@style/Theme.StormWaterUtilityAndroid"
+ android:requestLegacyExternalStorage="true">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/AgencyID.java b/app/src/main/java/com/sf/stormwaterutilityandroid/AgencyID.java
new file mode 100644
index 0000000..c904463
--- /dev/null
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/AgencyID.java
@@ -0,0 +1,13 @@
+package com.sf.stormwaterutilityandroid;
+
+public class AgencyID {
+ private String agencyID;
+
+ public AgencyID(String agencyID) {
+ this.agencyID = agencyID;
+ }
+
+ public String getAgencyID() {
+ return agencyID;
+ }
+}
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/Construction/ConstructionFormFragment.java b/app/src/main/java/com/sf/stormwaterutilityandroid/Construction/ConstructionFormFragment.java
index 95b3678..e981d82 100644
--- a/app/src/main/java/com/sf/stormwaterutilityandroid/Construction/ConstructionFormFragment.java
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/Construction/ConstructionFormFragment.java
@@ -43,7 +43,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
recyclerView = root.findViewById(R.id.recyclerView2);
- recyclerView.addView(submitButton);
+ // recyclerView.addView(submitButton);
return root;
}
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/Construction/ConstructionReportsFragment.java b/app/src/main/java/com/sf/stormwaterutilityandroid/Construction/ConstructionReportsFragment.java
index c24b425..bf2b4c3 100644
--- a/app/src/main/java/com/sf/stormwaterutilityandroid/Construction/ConstructionReportsFragment.java
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/Construction/ConstructionReportsFragment.java
@@ -1,25 +1,185 @@
package com.sf.stormwaterutilityandroid.Construction;
import android.os.Bundle;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
+import androidx.recyclerview.widget.DefaultItemAnimator;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.Task;
+import com.google.firebase.firestore.DocumentSnapshot;
+import com.google.firebase.firestore.EventListener;
+import com.google.firebase.firestore.FirebaseFirestore;
+import com.google.firebase.firestore.FirebaseFirestoreException;
+import com.google.firebase.firestore.Query;
+import com.google.firebase.firestore.QueryDocumentSnapshot;
+import com.google.firebase.firestore.QuerySnapshot;
+
+import com.sf.stormwaterutilityandroid.ConstructionFormData;
+import com.sf.stormwaterutilityandroid.ConstructionReportAdapter;
import com.sf.stormwaterutilityandroid.R;
+import com.sf.stormwaterutilityandroid.ReportAdapter;
+import com.sf.stormwaterutilityandroid.User;
+import com.sf.stormwaterutilityandroid.WaterWay.WaterWayReport;
+
+
+import java.util.ArrayList;
+import java.util.List;
public class ConstructionReportsFragment extends Fragment {
+ private EditText searchBar;
+ private RecyclerView recyclerView;
+ private Button btnSiteName, btnDate, btnInspectorName;
+ //TODO: Need vars for formdata
+
+ //TODO: Need a var for tvReports: UITableView!
+ List reportList = new ArrayList<>();
+ //TODO: LayoutInflator inflater, ViewGroup container,Might not be needed
+ //This was a public void
+
+ ConstructionReportAdapter reportAdapter;
+ //TODO: Need vars for formdata
+
+ //TODO: Need a var for tvReports: UITableView!
+ // List reportList = new ArrayList<>();
+ //TODO: LayoutInflator inflater, ViewGroup container,Might not be needed
+ //This was a public void
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+
+ View view = inflater.inflate(R.layout.activity_reports, container, false);
+ // recyclerView = view.findViewById(R.id.recyclerView);
+ reportList = new ArrayList<>();
+ reportAdapter = new ConstructionReportAdapter(reportList);
+
+
+ btnSiteName = view.findViewById(R.id.btn_site_name);
+ btnDate = view.findViewById(R.id.btn_date);
+ btnInspectorName = view.findViewById(R.id.btn_inspector_name);
+ searchBar = view.findViewById(R.id.searchView);
+ recyclerView = view.findViewById(R.id.recyclerView);
+
+ fetchData();
+ searchBar.addTextChangedListener(new TextWatcher() {
+
+
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+ }
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ if (s.toString().length() == 0) {
+ fetchData();
+ }
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+
+ }
+
+
+ });
+
+ btnSiteName.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ //startActivity(new Intent(Reports.this, Site_name.class));
+ String txt = searchBar.getText().toString().trim();
+ if (txt.isEmpty() || txt ==null) {
+ return;
+ }
+ fetchFilteredDate(txt,"location");
+
+ }
+ });
+
+ btnDate.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String txt = searchBar.getText().toString().trim();
+ if (txt.isEmpty() || txt ==null) {
+ return;
+ }
+ fetchFilteredDate(txt,"date");
+ }
+ });
+
+ btnInspectorName.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String txt = searchBar.getText().toString().trim();
+ if (txt.isEmpty() || txt ==null) {
+ return;
+ }
+ fetchFilteredDate(txt,"inspector");
+ }
+ });
+
+ return view;
+
- public View onCreateView(@NonNull LayoutInflater inflater,
- ViewGroup container, Bundle savedInstanceState) {
- View root = inflater.inflate(R.layout.fragment_dashboard, container, false);
- final TextView textView = root.findViewById(R.id.text_dashboard);
- return root;
}
-}
\ No newline at end of file
+
+ private void fetchFilteredDate(String txt, String searchField) {
+ FirebaseFirestore.getInstance().collection("Forms").document(User.agid).collection("Construction").whereEqualTo(searchField,txt).get().addOnCompleteListener(new OnCompleteListener() {
+ @Override
+ public void onComplete(@NonNull Task task) {
+ reportList.clear();
+ if (task.isSuccessful() && task != null) {
+ for(QueryDocumentSnapshot document:task.getResult()) {
+ reportList.add(document.toObject(ConstructionFormData.class));
+ }
+ reportAdapter.notifyDataSetChanged();
+ }
+ }
+ });
+
+
+ }
+
+ public void fetchData() {
+
+ FirebaseFirestore.getInstance().collection("Forms").document(User.agid).collection("Construction").orderBy("SortTimeStamp", Query.Direction.DESCENDING).addSnapshotListener(new EventListener() {
+ @Override
+ public void onEvent(@javax.annotation.Nullable QuerySnapshot queryDocumentSnapshots, @javax.annotation.Nullable FirebaseFirestoreException e) {
+ if (e != null) {
+ Log.i("Error", "No data");
+ }
+ reportList.clear();
+ System.out.println("108:" +queryDocumentSnapshots.size());
+ for (DocumentSnapshot d:queryDocumentSnapshots){
+ //needs to be changed to waterway data type
+
+ reportList.add( d.toObject(ConstructionFormData.class));
+ }
+ System.out.println(reportList.size());
+
+ reportAdapter.notifyDataSetChanged();
+ }
+ });
+ RecyclerView.LayoutManager layoutmanager = new LinearLayoutManager(getContext());
+ recyclerView.setLayoutManager(layoutmanager);
+ recyclerView.setItemAnimator(new DefaultItemAnimator());
+ recyclerView.setAdapter(reportAdapter);
+ }
+
+}
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/ConstructionFormData.java b/app/src/main/java/com/sf/stormwaterutilityandroid/ConstructionFormData.java
index fbb491f..8c1b45f 100644
--- a/app/src/main/java/com/sf/stormwaterutilityandroid/ConstructionFormData.java
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/ConstructionFormData.java
@@ -1,19 +1,27 @@
package com.sf.stormwaterutilityandroid;
+import com.google.firebase.firestore.GeoPoint;
+import com.google.firebase.firestore.ServerTimestamp;
+
+import java.io.Serializable;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-public class ConstructionFormData {
+public class ConstructionFormData implements Serializable {
private Map data;
- // String contact
- // String date
- // String inspector
- // String location
+ String contact;
+ String date;
+ String inspector;
+ String location;
+ GeoPoint geoPoint;
+@ServerTimestamp Date timeStamp;
// (they are lists because firebase doesn't serialize arrays)
- // List answers
- // List imgLink
+ List answers;
+ List imgLink;
+
public ConstructionFormData(String contact, String date, String inspector,
String location, List answers, List imgLinks) {
@@ -24,6 +32,105 @@ public ConstructionFormData(String contact, String date, String inspector,
data.put("location", location);
data.put("answers", answers);
data.put("imgLinks", imgLinks);
+
+ public ConstructionFormData(String contact, String date, String inspector, Date timestamp, String location,
+ GeoPoint geoPoint, List answers, List imgLinks) {
+ this.contact = contact;
+ this.date = date;
+ this.inspector = inspector;
+ this.timeStamp = timestamp;
+ data = new HashMap<>();
+ this.location = location;
+ this.geoPoint = geoPoint;
+ this.answers = answers;
+ this.imgLink = imgLinks;
+ }
+ public ConstructionFormData(String contact, String date, String inspector, Date timestamp, String location,
+ List answers, List imgLinks) {
+ this.contact = contact;
+ this.date = date;
+ this.inspector = inspector;
+ this.timeStamp = timestamp;
+ data = new HashMap<>();
+ this.location = location;
+ this.answers = answers;
+ this.imgLink = imgLinks;
+ }
+
+ public ConstructionFormData() {
+ }
+
+ public Map getData() {
+ return data;
+ }
+
+ public void setData(Map data) {
+ this.data = data;
+ }
+
+ public String getContact() {
+ return contact;
+ }
+
+ public void setContact(String contact) {
+ this.contact = contact;
+ }
+
+ public String getDate() {
+ return date;
+ }
+
+ public void setDate(String date) {
+ this.date = date;
+ }
+
+ public String getInspector() {
+ return inspector;
+ }
+
+ public void setInspector(String inspector) {
+ this.inspector = inspector;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public GeoPoint getGeoPoint() {
+ return geoPoint;
+ }
+
+ public void setGeoPoint(GeoPoint geoPoint) {
+ this.geoPoint = geoPoint;
+ }
+
+ public Date getTimeStamp() {
+ return timeStamp;
+ }
+
+ public void setTimeStamp(Date timeStamp) {
+ this.timeStamp = timeStamp;
+ }
+
+ public List getAnswers() {
+ return answers;
+ }
+
+ public void setAnswers(List answers) {
+ this.answers = answers;
+ }
+
+ public List getImgLink() {
+ return imgLink;
+ }
+
+ public void setImgLink(List imgLink) {
+ this.imgLink = imgLink;
+
}
public Map getMap() {
@@ -37,4 +144,4 @@ public String toString() {
'}';
}
-}
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/ConstructionReportAdapter.java b/app/src/main/java/com/sf/stormwaterutilityandroid/ConstructionReportAdapter.java
new file mode 100644
index 0000000..11769ce
--- /dev/null
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/ConstructionReportAdapter.java
@@ -0,0 +1,61 @@
+package com.sf.stormwaterutilityandroid;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.recyclerview.widget.RecyclerView;
+
+import java.util.List;
+
+public class ConstructionReportAdapter extends RecyclerView.Adapter{
+ //needs changed to waterway
+ List listdata;
+
+ public ConstructionReportAdapter(List listdata) {
+ this.listdata = listdata;
+ }
+
+ @Override
+ public ConstructionReportAdapter.MyHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.cardview_reports,parent,false);
+
+ ConstructionReportAdapter.MyHolder myHolder = new ConstructionReportAdapter.MyHolder(view);
+ return myHolder;
+ }
+
+
+ public void onBindViewHolder(ConstructionReportAdapter.MyHolder holder, final int position) {
+
+ final ConstructionFormData data = listdata.get(position);
+ holder.inspectorName.setText(data.getInspector());
+ holder.site.setText(data.getLocation());
+ holder.date.setText((data.getDate()));
+
+
+ }
+
+ @Override
+ public int getItemCount() {
+ return listdata.size();
+ }
+
+
+ class MyHolder extends RecyclerView.ViewHolder{
+ TextView inspectorName,site,date;
+
+ public MyHolder(View itemView) {
+ super(itemView);
+ inspectorName = (TextView) itemView.findViewById(R.id.inspectorName);
+ site = (TextView) itemView.findViewById(R.id.siteName);
+ date = (TextView) itemView.findViewById(R.id.date);
+ }
+ }
+
+
+}
+
+
+
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/DryWeatherScreening.java b/app/src/main/java/com/sf/stormwaterutilityandroid/DryWeatherScreening.java
index 8220c5a..68bf5dc 100644
--- a/app/src/main/java/com/sf/stormwaterutilityandroid/DryWeatherScreening.java
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/DryWeatherScreening.java
@@ -27,57 +27,110 @@ public class DryWeatherScreening extends AppCompatActivity{
private FormBuilder formBuilder;
private RecyclerView recyclerView;
- FormElementTextEmail element11;
- //I assume onCreate is important so I will leave it unchanged
+
+ 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;
+
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?
-
- FormElementTextSingleLine odor = new FormElementTextSingleLine().setTitle("Unusual Odor");
- FormElementTextNumber odorData = FormElementTextNumber.createInstance();
-
- FormElementTextSingleLine color = new FormElementTextSingleLine().setTitle("Unusual Color");
- FormElementTextNumber colorData = FormElementTextNumber.createInstance();
-
- FormElementTextSingleLine polutants = new FormElementTextSingleLine().setTitle("Polutants Nearby");
- FormElementTextNumber polutantsData = FormElementTextNumber.createInstance();
-
- FormElementTextSingleLine obstruction = new FormElementTextSingleLine().setTitle("Obstruction");
- FormElementTextNumber obstructionData = FormElementTextNumber.createInstance();
-
- FormElementTextSingleLine maintenance = new FormElementTextSingleLine().setTitle("Needs Maintenance");
- FormElementTextNumber maintenanceData = FormElementTextNumber.createInstance();
-
- FormElementTextSingleLine screen = new FormElementTextSingleLine().setTitle("Screen OK");
- FormElementTextNumber screenData = FormElementTextNumber.createInstance();
-
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);
}
+
+ 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/GraphPicker.java b/app/src/main/java/com/sf/stormwaterutilityandroid/GraphPicker.java
new file mode 100644
index 0000000..5244c9c
--- /dev/null
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/GraphPicker.java
@@ -0,0 +1,196 @@
+package com.sf.stormwaterutilityandroid;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.NumberPicker;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.anychart.anychart.AnyChart;
+import com.anychart.anychart.AnyChartView;
+import com.anychart.anychart.Cartesian;
+import com.anychart.anychart.DataEntry;
+import com.anychart.anychart.StrokeLineCap;
+import com.anychart.anychart.StrokeLineJoin;
+import com.anychart.anychart.ValueDataEntry;
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.Task;
+import com.google.firebase.auth.AuthResult;
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.auth.FirebaseUser;
+import com.google.firebase.firestore.FirebaseFirestore;
+import com.google.firebase.firestore.Query;
+import com.google.firebase.firestore.QueryDocumentSnapshot;
+import com.google.firebase.firestore.QuerySnapshot;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class GraphPicker extends AppCompatActivity {
+ private NumberPicker np1, np2, np3, np4, np5, np6, np7, np8;
+ private Button btnGen;
+ int docCount = 0;
+ String sitePicked = new String();
+ String formPicked = new String();
+ String startMonthPicked = new String();
+ int startDayPicked = 0;
+ int startYearPicked = 2000;
+ String endMonthPicked = new String();
+ int endDayPicked = 0;
+ int endYearPicked = 2000;
+
+ //Added for firebase stuff
+ private FirebaseAuth mAuth;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_pick_graph);
+ btnGen = findViewById(R.id.generate_button);
+ setupPickers();
+ btnGen.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String[] forms1 = np1.getDisplayedValues();
+ String[] sites1 = np2.getDisplayedValues();
+ String[] startM = np3.getDisplayedValues();
+ String[] endM = np6.getDisplayedValues();
+ formPicked = String.valueOf(forms1[np1.getValue()]);
+ sitePicked = String.valueOf(sites1[np2.getValue()]);
+ startMonthPicked = String.valueOf(startM[np3.getValue()]);
+ startDayPicked = np4.getValue();
+ startYearPicked = np5.getValue();
+
+ endMonthPicked = String.valueOf(endM[np6.getValue()]);
+ endDayPicked = np7.getValue();
+ endYearPicked = np8.getValue();
+ Log.d("TEST", "Form Picked = " + formPicked);
+ Log.d("TEST", "Site Picked = " + sitePicked);
+ Log.d("TEST", "start month = " + startMonthPicked);
+ Log.d("TEST", "start day = " + startDayPicked);
+ Log.d("TEST", "start year = " + startYearPicked);
+ Log.d("TEST", "end month = " + endMonthPicked);
+ Log.d("TEST", "end day = " + endDayPicked);
+ Log.d("TEST", "end year = " + endYearPicked);
+
+ Intent intent = new Intent(GraphPicker.this, Grapher.class);
+ Bundle extras = new Bundle();
+ extras.putString("FORM_CHOICE", formPicked);
+ extras.putString("SITE_CHOICE", sitePicked);
+ extras.putString("START_MONTH", startMonthPicked);
+ extras.putString("END_MONTH", endMonthPicked);
+ extras.putInt("START_DAY", startDayPicked);
+ extras.putInt("END_DAY", endDayPicked);
+ extras.putInt("START_YEAR", startYearPicked);
+ extras.putInt("END_YEAR", endYearPicked);
+ Log.d("graph", "ORIGINAL Collection string is " + formPicked);
+ Log.d("graph", "ORIGINAL Site string is " + sitePicked);
+ intent.putExtras(extras);
+ startActivity(intent);
+ }
+ });
+ }
+
+ public void setupPickers() {
+ //TODO: QUERY FIREBASE FOR THIS INFO
+ np1 = findViewById(R.id.pickForm);
+ np2 = findViewById(R.id.pickSite);
+ np3 = findViewById(R.id.pickStartMonth);
+ np4 = findViewById(R.id.pickStartDay);
+ np5 = findViewById(R.id.pickStartYear);
+ np6 = findViewById(R.id.pickEndMonth);
+ np7 = findViewById(R.id.pickEndDay);
+ np8 = findViewById(R.id.pickEndYear);
+
+ //TODO: Accomodate Construction form at some point
+ String[] forms = {"Waterway"};//, "Construction"};
+ np1.setMaxValue(forms.length - 1);
+ np1.setDisplayedValues(forms);
+ np1.setWrapSelectorWheel(false);
+
+ //TODO: limit choices to forms?
+ Query WaterwaySites = FirebaseFirestore.getInstance().collection("Forms").document("purdue.edu").collection("Waterway").orderBy("SortTimeStamp", Query.Direction.ASCENDING);
+ WaterwaySites.get().addOnCompleteListener(this, new OnCompleteListener() {
+ @Override
+ public void onComplete(@NonNull Task task) {
+ Log.d("Grapher", "Got into This thing");
+ if (task.isSuccessful()) {
+ docCount = task.getResult().size();
+ String[] WaterSites = new String[docCount];
+ int i = 0;
+ for (QueryDocumentSnapshot document : task.getResult()) {
+ //Check if the string already exists in the WaterSites
+ if (Arrays.stream(WaterSites).anyMatch(document.getString("H_site_name")::equals)) {
+ //Then don't add it in
+ //Log.d("Graph", "This arrays things was true");
+ }
+ else {
+ //Log.d("Graph", "This arrays thing was false");
+ WaterSites[i] = document.getString("H_site_name");
+ i++;
+ }
+ }
+ String[] actualSites = new String[i];
+ for (int j = 0; j < i; j++) {
+ actualSites[j] = WaterSites[j];
+ Log.d("Graph", "actualSites["+String.valueOf(j)+"] ="+String.valueOf(actualSites[j]));
+ }
+ np2.setMaxValue(actualSites.length - 1);//WaterSites.length - 1);
+ np2.setDisplayedValues(actualSites);//WaterSites);
+ np2.setWrapSelectorWheel(false);
+ } else {
+ Log.d("Graph", "Error getting documents: ", task.getException());
+ }
+ Log.d("Graph", "docCount" + docCount);
+ }
+ });
+
+ String[] months = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
+ String[] days = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
+ "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
+ "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"};
+ String[] years = {"1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999",
+ "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009",
+ "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019",
+ "2020", "2021", "2022", "2023", "2024", "2025", "2026", "2027", "2028", "2029"};
+
+ np3.setMaxValue(months.length - 1);
+ np3.setDisplayedValues(months);
+ np3.setWrapSelectorWheel(false);
+ np6.setMaxValue(months.length - 1);
+ np6.setDisplayedValues(months);
+ np6.setWrapSelectorWheel(false);
+
+ /*np4.setMaxValue(days.length - 1);
+ np4.setDisplayedValues(days);
+ np7.setMaxValue(days.length - 1);
+ np7.setDisplayedValues(days);*/
+ np4.setMinValue(1);
+ np4.setMaxValue(31);
+ np7.setMinValue(1);
+ np7.setMaxValue(31);
+
+ /*np5.setMaxValue(years.length - 1);
+ np5.setDisplayedValues(years);
+ np8.setMaxValue(years.length - 1);
+ np8.setDisplayedValues(years);*/
+ np5.setMinValue(1980);
+ np5.setMaxValue(2030);
+ np5.setWrapSelectorWheel(false);
+ np8.setMinValue(1980);
+ np8.setMaxValue(2030);
+ np8.setWrapSelectorWheel(false);
+ }
+
+ public void pickerValues() {
+
+ }
+}
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/Grapher.java b/app/src/main/java/com/sf/stormwaterutilityandroid/Grapher.java
new file mode 100644
index 0000000..b1ebff9
--- /dev/null
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/Grapher.java
@@ -0,0 +1,218 @@
+package com.sf.stormwaterutilityandroid;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.anychart.anychart.AnyChart;
+import com.anychart.anychart.AnyChartView;
+import com.anychart.anychart.Cartesian;
+import com.anychart.anychart.DataEntry;
+import com.anychart.anychart.LegendItemProvider;
+import com.anychart.anychart.Mapping;
+import com.anychart.anychart.Set;
+import com.anychart.anychart.StrokeLineCap;
+import com.anychart.anychart.StrokeLineJoin;
+import com.anychart.anychart.ValueDataEntry;
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.Task;
+import com.google.android.gms.tasks.TaskCompletionSource;
+import com.google.android.material.bottomnavigation.BottomNavigationView;
+import com.google.firebase.auth.AuthCredential;
+import com.google.firebase.auth.EmailAuthProvider;
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.auth.FirebaseUser;
+import com.google.firebase.firestore.CollectionReference;
+import com.google.firebase.firestore.DocumentSnapshot;
+import com.google.firebase.firestore.FirebaseFirestore;
+import com.google.firebase.firestore.Query;
+import com.google.firebase.firestore.QueryDocumentSnapshot;
+import com.google.firebase.firestore.QuerySnapshot;
+import com.sf.stormwaterutilityandroid.WaterWay.PTI;
+import com.sf.stormwaterutilityandroid.WaterWay.WQI;
+import com.sf.stormwaterutilityandroid.WaterWay.WaterWay;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Grapher extends AppCompatActivity {
+ int docCount = 0;
+ String collection_string = "Waterway";//new String();
+ String site_string = "Purdue";//new String();
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_graph);
+ Intent intentPrev = getIntent();
+ Bundle extrasPrev = intentPrev.getExtras();
+ site_string = extrasPrev.getString("SITE_CHOICE");
+ collection_string = extrasPrev.getString("FORM_CHOICE");
+ //BottomNavigationView navView = findViewById(R.id.nav_view);
+ Log.d("Grapher", "Got to the graphing function");
+ Log.d("graph", "Collection string is " + collection_string);
+ Log.d("graph", "Site string is " + site_string);
+ grapher();
+ }
+
+ public void grapher() {
+ if (collection_string == "Construction") {
+ Toast.makeText(this, "Sorry. That isn't currently supported", Toast.LENGTH_SHORT).show();
+ return;
+ }
+ Log.d("graph", "collection_string = " + String.valueOf(collection_string));
+ Query purdueThings = FirebaseFirestore.getInstance().collection("Forms").document("purdue.edu").collection(String.valueOf(collection_string))//"Waterway")//collection_string)
+ .orderBy("SortTimeStamp", Query.Direction.ASCENDING).whereEqualTo("H_site_name", String.valueOf(site_string));//"SD");
+ Log.d("Grapher", "Firebase first is fine");
+
+ purdueThings.get().addOnCompleteListener(this, new OnCompleteListener() {
+ @Override
+ public void onComplete(@NonNull Task task) {
+ Log.d("Grapher", "Got into This thing");
+ if (task.isSuccessful()) {
+ docCount = task.getResult().size();
+ String[] dates = new String[docCount];
+ Object[] PTIs = new Object[docCount];
+ Object[] WQIs = new Object[docCount];
+ Object[] HEIs = new Object[docCount];
+ int i = 0;
+ for (QueryDocumentSnapshot document : task.getResult()) {//DocumentSnapshot document : task.getResult()) {
+ //docCount++;
+ //Log.d("graph", document.getData());
+ dates[i] = document.getString("H_date");//"SortTimeStamp");//Or H_date
+ Log.d("graph", "Other thing = " + dates[i]);
+ Map obMap = new HashMap<>();
+ HashMap dubMap = new HashMap();
+
+ //document.toObject(WaterWay.class);
+ //Log.d("graph", "WaterWayDoubleFields = " + document.WaterWayDoubleFields)
+ obMap = document.getData(/*"doubleFields"*/);
+ //Log.d("graph", "Intermediate = " + obMap.get("doubleFields"));
+ dubMap = (HashMap) obMap.get("doubleFields");
+ HashMap longMap = new HashMap();
+ longMap = (HashMap) obMap.get("doubleFields");
+ //Log.d("graph", "dubMap = " + dubMap.get("PTI").getClass());
+ Log.d("graph", "test PTI = " + longMap.get("PTI").getClass());//It's a hashmap
+ PTIs[i] = longMap.get("PTI");//(double) dubMap.get("PTI");//.doubleValue();//calc_PTI(dubMap);
+ WQIs[i] = longMap.get("WQI");//(double) dubMap.get("WQI");//calc_WQI(dubMap);
+ HEIs[i] = longMap.get("QHEI");//(double) dubMap.get("QHEI");//calc_HEI(dubMap);
+ //scores[i] = (Double) dubMap.get("BM_fairly_tolerant");//document.get("BM_fairly_tolerant");//Double.parseDouble(document.getString("BM_fairly_tolerant"));//TODO: Change me. This is a filler value
+ i++;
+ Log.d("Grapher", document.getId() + " => " + document.getData());
+ }
+ AnyChartView anyChartView = (AnyChartView) findViewById(R.id.any_chart_view);
+ Cartesian line_chart = AnyChart.line();
+
+ line_chart.setXGrid(true);
+ line_chart.setYGrid(true);
+ line_chart.setYAxis("Y Axis");
+ line_chart.setXAxis("X Axis");//.labels().padding(5d, 5d, 5d, 5d);
+
+ List data = new ArrayList<>();
+ List data2 = new ArrayList<>();
+ List data3 = new ArrayList<>();
+ //List seriesData = new ArrayList<>();
+ Object[][] stuff = new Object[docCount][4];
+ for (int x = 0; x < docCount; x++) {
+ stuff[x][0] = dates[x];
+ stuff[x][1] = PTIs[x];
+ stuff[x][2] = WQIs[x];
+ stuff[x][3] = HEIs[x];
+ Log.d("graph", "Stuff = " + stuff[x][1] + "," + stuff[x][2] + "," + stuff[x][3]);
+ //Log.d("Graph", "stuff=" + scores[x]);
+ ////data.add(new ValueDataEntry(dates[x], PTIs[x], WQIs[x], HEIs[x]));
+ Double a = Double.parseDouble(String.valueOf(PTIs[x]));
+ Double b = Double.parseDouble(String.valueOf(WQIs[x]));
+ Double c = Double.parseDouble(String.valueOf(HEIs[x]));
+ data.add(new ValueDataEntry(dates[x], Double.valueOf(a)));//Double.valueOf(scores[x])));
+ data2.add(new ValueDataEntry(dates[x], Double.valueOf(b)));
+ data3.add(new ValueDataEntry(dates[x], Double.valueOf(c)));
+ //seriesData.add(new CustomDataEntry(dates[x], a, b, c));
+ //data.add(Integer.valueOf(dates[x]), (DataEntry) PTIs[x]);
+ }
+ //Set set = new Set();
+ //set.setData("foo", seriesData);
+ //line_chart.setLegend("test");
+
+
+ line_chart.line(data).setStroke("red", 1.0, "-", StrokeLineJoin.ROUND, StrokeLineCap.ROUND).setName("PTI").setLegendItem("PTI").setId("PTI").setMarkers(true).getLegendItem().setText("PTI").setIconEnabled(true);
+ //line_chart.setLineMarker("Test");
+ line_chart.line(data2).setStroke("green", 1.0, "-", StrokeLineJoin.ROUND, StrokeLineCap.ROUND).setName("WQI").setLegendItem("WQI").setMarkers(true);
+ line_chart.line(data3).setStroke("blue", 1.0, "-", StrokeLineJoin.ROUND, StrokeLineCap.ROUND).setName("QHEI").setLegendItem("QHEI").setMarkers(true);
+ line_chart.setTitle(true);
+ //String title = new String();
+ //title = "Selected Report: Waterway" + System.getProperty("line.separator") + "Selected Site: Purdue";
+ line_chart.setTitle("Selected Report: Waterway");
+
+
+ line_chart.setLegend(true).setLabel("PTI").setLabel("WQI").setLabel("QHEI").setEnabled(true);
+ line_chart.getLegend().setPosition("right");
+ line_chart.getLegend().setItemsLayout("horizontal");
+ line_chart.getLegend().setAlign("top");
+ line_chart.getLegend().setItemsSourceMode("series");//or categories?
+ line_chart.getLegend().setPositionMode("inside");
+
+ //LegendItemProvider[] legendItems = new LegendItemProvider[]{};
+
+ //line_chart.getLegend().setItems([{0, "Chrome", "circle", "#01579B", "#0091EA"}]);
+
+ line_chart.setLegend(true).draw(true);
+
+
+ //line_chart.setTitle("Selected Site: Purdue");
+ //line_chart.setLegend("TEST");
+ //line_chart.getLegend();
+ //String[] labels = new String[3];
+ line_chart.setLabels(true);
+ //line_chart.setLabel
+ //labels = ["PTI", "WQI", "QHEI"];
+ //line_chart.setLabels(labels);
+ /*line_chart.setData(data);//([[data], [data2], [data3]]);
+ //line_chart.legend(true);
+ line_chart.setTitle("PTI");
+ line_chart.setLabels("PTI");
+ line_chart.setLegend(true);
+ line_chart.setSelectMarqueeStroke("red", 10.0, "-", StrokeLineJoin.ROUND, StrokeLineCap.ROUND);
+ //line_chart.name("PTI");
+ //line_chart.stroke();
+
+ line_chart2.setData(data2);
+ line_chart2.setTitle("WQI");
+ line_chart2.setLabels("WQI");
+ line_chart2.setLegend(true);
+ line_chart2.setSelectMarqueeStroke("green", 10.0, "-", StrokeLineJoin.ROUND, StrokeLineCap.ROUND);
+
+ line_chart3.setData(data3);
+ //line_chart.legend(true);
+ line_chart3.setTitle("QHEI");
+ line_chart3.setLabels("QHEI");
+ line_chart3.setLegend(true);
+ line_chart3.setSelectMarqueeStroke("blue", 10.0, "-", StrokeLineJoin.ROUND, StrokeLineCap.ROUND);
+ line_chart.draw(true);
+ line_chart2.draw(true);
+ line_chart3.draw(true);*/
+ anyChartView.setChart(line_chart);
+ } else {
+ Log.d("Grapher", "Error getting documents: ", task.getException());
+ }
+ Log.d("Grapher", "docCount" + docCount);
+ }
+ });
+ }
+
+ public class CustomDataEntry extends ValueDataEntry {
+ CustomDataEntry(String x, Number value, Number value2, Number value3) {
+ super(x, (Double) value);
+ setValue("value2", value2);
+ setValue("value3", value3);
+ }
+ }
+}
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/HEI.java b/app/src/main/java/com/sf/stormwaterutilityandroid/HEI.java
new file mode 100644
index 0000000..85ff781
--- /dev/null
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/HEI.java
@@ -0,0 +1,87 @@
+package com.sf.stormwaterutilityandroid;
+
+public class HEI {
+ //by default, all values are set to be 0
+ private double QHEI_substrate_size = 0;
+ private double QHEI_smothering = 0;
+ private double QHEI_silting = 0;
+ private double QHEI_rootwads = 0;
+ private double QHEI_overhanging_veg = 0;
+ private double QHEI_oxbowsblack_waters = 0;
+ private double QHEI_downed_treeslogs = 0;
+ private double QHEI_shallows = 0;
+ private double QHEI_water_plants = 0;
+ private double QHEI_deep_pools = 0;
+ private double QHEI_logswoody_debris = 0;
+ private double QHEI_boulders = 0;
+ private double QHEI_undercut_banks = 0;
+ private double QHEI_sinuosity = 0;
+ private double QHEI_natural = 0;
+ private double QHEI_riparian_width = 0;
+ private double QHEI_land_use = 0;
+ private double QHEI_bank_erosion = 0;
+ private double QHEI_stream_shading = 0;
+ private double QHEI_deepest_pool = 0;
+ private double QHEI_velocity = 0;
+ private double QHEI_rifflerun_depth = 0;
+ private double QHEI_rifflerun_substrate = 0;
+
+ //constructor
+ HEI(double QHEI_substrate_size, double QHEI_smothering, double QHEI_silting, double QHEI_rootwads, double QHEI_overhanging_veg,
+
+
+ double QHEI_oxbowsblack_waters, double QHEI_downed_treeslogs, double QHEI_shallows, double QHEI_water_plants, double QHEI_logswoody_debris,
+
+ double QHEI_boulders, double QHEI_undercut_banks, double QHEI_sinuosity, double QHEI_natural, double QHEI_riparian_width,
+ double QHEI_land_use, double QHEI_bank_erosion, double QHEI_stream_shading, double QHEI_deepest_pool, double QHEI_velocity,
+ double QHEI_rifflerun_depth, double QHEI_rifflerun_substrate, double QHEI_deep_pools) {
+
+ this.QHEI_substrate_size = QHEI_substrate_size;
+ this.QHEI_smothering = QHEI_smothering;
+ this.QHEI_silting = QHEI_silting;
+ this.QHEI_rootwads = QHEI_rootwads;
+ this.QHEI_overhanging_veg = QHEI_overhanging_veg;
+ this.QHEI_oxbowsblack_waters = QHEI_oxbowsblack_waters;
+ this.QHEI_downed_treeslogs = QHEI_downed_treeslogs;
+ this.QHEI_shallows = QHEI_shallows;
+ this.QHEI_water_plants = QHEI_water_plants;
+ this.QHEI_logswoody_debris = QHEI_logswoody_debris;
+ this.QHEI_boulders = QHEI_boulders;
+ this.QHEI_undercut_banks = QHEI_undercut_banks;
+ this.QHEI_sinuosity = QHEI_sinuosity;
+ this.QHEI_natural = QHEI_natural;
+ this.QHEI_riparian_width = QHEI_riparian_width;
+ this.QHEI_land_use = QHEI_land_use;
+ this.QHEI_bank_erosion = QHEI_bank_erosion;
+ this.QHEI_stream_shading = QHEI_stream_shading;
+ this.QHEI_deepest_pool = QHEI_deepest_pool;
+ this.QHEI_velocity = QHEI_velocity;
+ this.QHEI_rifflerun_depth = QHEI_rifflerun_depth;
+ this.QHEI_rifflerun_substrate = QHEI_rifflerun_substrate;
+ this.QHEI_deep_pools = QHEI_deep_pools;
+ }
+
+ public double calculate_HEI() {
+ return QHEI_substrate_size + QHEI_smothering + QHEI_silting + QHEI_rootwads + QHEI_overhanging_veg +
+ QHEI_oxbowsblack_waters + QHEI_downed_treeslogs + QHEI_shallows + QHEI_water_plants + QHEI_deep_pools +
+ QHEI_logswoody_debris + QHEI_boulders + QHEI_undercut_banks + 2 * (QHEI_sinuosity + QHEI_natural) +
+ QHEI_riparian_width + QHEI_land_use + QHEI_bank_erosion + QHEI_stream_shading + QHEI_deepest_pool +
+ QHEI_velocity + QHEI_rifflerun_depth + QHEI_rifflerun_substrate;
+ }
+
+ public static double get_HEI(double QHEI_substrate_size, double QHEI_smothering, double QHEI_silting, double QHEI_rootwads, double QHEI_overhanging_veg,
+ double QHEI_oxbowsblack_waters, double QHEI_downed_treeslogs, double QHEI_shallows, double QHEI_water_plants, double QHEI_logswoody_debris,
+ double QHEI_boulders, double QHEI_undercut_banks, double QHEI_sinuosity, double QHEI_natural, double QHEI_riparian_width,
+ double QHEI_land_use, double QHEI_bank_erosion, double QHEI_stream_shading, double QHEI_deepest_pool, double QHEI_velocity,
+ double QHEI_rifflerun_depth, double QHEI_rifflerun_substrate, double QHEI_deep_pools)
+ {
+ return QHEI_substrate_size + QHEI_smothering + QHEI_silting + QHEI_rootwads + QHEI_overhanging_veg +
+ QHEI_oxbowsblack_waters + QHEI_downed_treeslogs + QHEI_shallows + QHEI_water_plants + QHEI_deep_pools +
+ QHEI_logswoody_debris + QHEI_boulders + QHEI_undercut_banks + 2 * (QHEI_sinuosity + QHEI_natural) +
+ QHEI_riparian_width + QHEI_land_use + QHEI_bank_erosion + QHEI_stream_shading + QHEI_deepest_pool +
+ QHEI_velocity + QHEI_rifflerun_depth + QHEI_rifflerun_substrate;
+ }
+
+
+}
+
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/InspectionForm.java b/app/src/main/java/com/sf/stormwaterutilityandroid/InspectionForm.java
index 523385a..296a7c5 100644
--- a/app/src/main/java/com/sf/stormwaterutilityandroid/InspectionForm.java
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/InspectionForm.java
@@ -54,9 +54,14 @@ protected void onCreate(Bundle savedInstanceState) {
recyclerView = findViewById(R.id.recyclerView2);
+
this.submitButton = findViewById(R.id.submitButton);
this.uploadImageBtn = findViewById(R.id.uploadImageBtn);
+ // submitButton = findViewById(R.id.submitButton);
+
+
+
this.storage = FirebaseStorage.getInstance();
this.storageReference = storage.getReference();
@@ -198,6 +203,7 @@ private void setupForm() {
String projectManager = projectManagerTextField.getValue();
String siteManager = siteManagerTextField.getValue();
String projectOwner = projectOwnerTextField.getValue();
+
answersList.add(projectManager);
answersList.add(siteManager);
answersList.add(projectOwner);
@@ -244,9 +250,10 @@ private void setupForm() {
System.out.println(imgLinks);
ConstructionFormData constructionFormData = new ConstructionFormData(contact, date, inspector, location, answersList, imgLinks);
+
System.out.println(constructionFormData);
// submit data to firestore
- uploadToFirestore(constructionFormData);
+ // uploadToFirestore(constructionFormData);
});
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/Login.java b/app/src/main/java/com/sf/stormwaterutilityandroid/Login.java
index e2fc838..095ca20 100644
--- a/app/src/main/java/com/sf/stormwaterutilityandroid/Login.java
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/Login.java
@@ -18,8 +18,12 @@
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.firestore.DocumentSnapshot;
+import com.google.firebase.firestore.FirebaseFirestore;
import com.sf.stormwaterutilityandroid.WaterWay.WaterWayNav;
+import java.util.Map;
+
public class Login extends AppCompatActivity {
private EditText inputEmail, inputPassword;
@@ -35,12 +39,18 @@ protected void onCreate(Bundle savedInstanceState) {
//Get Firebase auth instance
auth = FirebaseAuth.getInstance();
+ if (auth.getCurrentUser() != null && auth.getCurrentUser().isEmailVerified()) {
+ fetchAgencyID();
+ startActivity(new Intent(Login.this, MainMenu.class));
+ finish();
+ }
mAuthListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
if (firebaseAuth.getCurrentUser() != null && auth.getCurrentUser().isEmailVerified()) {
- startActivity(new Intent(Login.this, WaterWayNav.class));
+ // fetchAgencyID();
+ startActivity(new Intent(Login.this, MainMenu.class));
finish();
}
if (firebaseAuth.getCurrentUser() == null) {
@@ -52,14 +62,17 @@ public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
};
+
setContentView(R.layout.activity_login);
inputEmail = findViewById(R.id.email);
inputPassword = findViewById(R.id.password);
- progressBar = findViewById(R.id.progressBar);
+ progressBar = findViewById(R.id.progressBar3);
btnSignup = findViewById(R.id.btn_signup);
btnLogin = findViewById(R.id.btn_login);
btnReset = findViewById(R.id.btn_reset_password);
-
+ if (auth.getCurrentUser() != null) {
+ fetchAgencyID();
+ }
//Get Firebase auth instance
auth = FirebaseAuth.getInstance();
@@ -80,6 +93,7 @@ public void onClick(View v) {
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ System.out.println("Execute:85");
String email = inputEmail.getText().toString();
final String password = inputPassword.getText().toString();
@@ -96,10 +110,13 @@ public void onClick(View v) {
progressBar.setVisibility(View.VISIBLE);
//authenticate user
- auth.signInWithEmailAndPassword(email, password)
- .addOnCompleteListener(Login.this, new OnCompleteListener() {
+ System.out.println("Execute:102");
+ auth.signInWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener() {
+
+
@Override
public void onComplete(@NonNull Task task) {
+ System.out.println("Execute:106");
// If sign in fails, display a message to the user. If sign in succeeds
// the auth state listener will be notified and logic to handle the
// signed in user can be handled in the listener.
@@ -113,11 +130,25 @@ public void onComplete(@NonNull Task task) {
}
} else {
if (auth.getCurrentUser().isEmailVerified()) {
- Intent intent = new Intent(Login.this, WaterWayNav.class);
+ System.out.println("Execute:122");
+ FirebaseFirestore.getInstance().collection("Users").document(auth.getUid()).get().addOnCompleteListener(new OnCompleteListener() {
+ @Override
+ public void onComplete(@NonNull Task task) {
+ if (task.isSuccessful()) {
+ if (task.getResult().exists()) {
+ String agencyID = task.getResult().get("agencyID").toString();
+ AgencyID id = new AgencyID(agencyID);
+ }
+ }
+ }
+ });
+ Intent intent = new Intent(Login.this, MainMenu.class);
startActivity(intent);
progressBar.setVisibility(View.INVISIBLE);
finish();
} else {
+ System.out.println("Execute:139");
+ progressBar.setVisibility(View.INVISIBLE);
AlertDialog.Builder builder;
builder = new AlertDialog.Builder(Login.this);
//builder.setIcon(R.drawable.open_browser);
@@ -146,4 +177,16 @@ public void onClick(DialogInterface dialog, int id) {
}
+ private void fetchAgencyID() {
+ System.out.println("Execute 171");
+ FirebaseFirestore.getInstance().collection("Users").document(auth.getUid()).get().addOnCompleteListener(new OnCompleteListener() {
+ @Override
+ public void onComplete(@NonNull Task task) {
+ System.out.println("Execute 174");
+ User.agid = task.getResult().toObject(User.class).getAgencyID();
+ System.out.println(User.agid);
+ }
+ });
+ }
+
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/MainMenu.java b/app/src/main/java/com/sf/stormwaterutilityandroid/MainMenu.java
index 6dd4920..d443a99 100644
--- a/app/src/main/java/com/sf/stormwaterutilityandroid/MainMenu.java
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/MainMenu.java
@@ -1,6 +1,7 @@
package com.sf.stormwaterutilityandroid;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.cardview.widget.CardView;
import android.content.Intent;
import android.os.Bundle;
@@ -12,15 +13,42 @@
public class MainMenu extends AppCompatActivity {
Button launchWWF,launchCF, launchSettings;
+CardView cvWaterWay, cvConstruction, cvSettings;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main_menu);
- launchWWF = findViewById(R.id.wwf);
- launchCF = findViewById(R.id.cf);
- launchSettings = findViewById(R.id.settings);
- launchSettings.setOnClickListener(new View.OnClickListener() {
+ setContentView(R.layout.activity_menu2);
+ cvWaterWay = findViewById(R.id.cvWaterWay);
+ cvConstruction = findViewById(R.id.cvConstructionForm);
+ cvSettings = findViewById(R.id.cvSettings);
+ cvWaterWay.setOnClickListener(new View.OnClickListener() {
@Override
+ public void onClick(View v) {
+ Intent intent = new Intent(MainMenu.this, WaterWayNav.class);
+ startActivity(intent);
+ }
+ });
+ cvConstruction.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(MainMenu.this, ConstructionNav.class);
+ startActivity(intent);
+ }
+ });
+ cvSettings.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ Intent intent = new Intent(MainMenu.this, Settings.class);
+ startActivity(intent);
+
+ }
+ });
+ // launchWWF = findViewById(R.id.wwf);
+ // launchCF = findViewById(R.id.cf);
+ // launchSettings = findViewById(R.id.settings);
+ // launchSettings.setOnClickListener(new View.OnClickListener() {
+ /* @Override
public void onClick(View v) {
Intent intent = new Intent(MainMenu.this, Settings.class);
startActivity(intent);
@@ -44,5 +72,6 @@ public void onClick(View v) {
}
});
+ */
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/PDFCreator.java b/app/src/main/java/com/sf/stormwaterutilityandroid/PDFCreator.java
new file mode 100644
index 0000000..85ba1c1
--- /dev/null
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/PDFCreator.java
@@ -0,0 +1,481 @@
+package com.sf.stormwaterutilityandroid;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.graphics.Typeface;
+import android.graphics.pdf.PdfDocument;
+import android.graphics.pdf.PdfDocument.PageInfo;
+import android.graphics.pdf.PdfDocument.Page;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.util.Log;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.core.app.ActivityCompat;
+import androidx.core.content.ContextCompat;
+
+import com.anychart.anychart.AnyChart;
+import com.anychart.anychart.AnyChartView;
+import com.anychart.anychart.Cartesian;
+import com.anychart.anychart.DataEntry;
+import com.anychart.anychart.ValueDataEntry;
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.Task;
+import com.google.android.gms.tasks.TaskCompletionSource;
+import com.google.android.material.bottomnavigation.BottomNavigationView;
+import com.google.firebase.auth.AuthCredential;
+import com.google.firebase.auth.EmailAuthProvider;
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.auth.FirebaseUser;
+import com.google.firebase.firestore.CollectionReference;
+import com.google.firebase.firestore.DocumentSnapshot;
+import com.google.firebase.firestore.FirebaseFirestore;
+import com.google.firebase.firestore.Query;
+import com.google.firebase.firestore.QueryDocumentSnapshot;
+import com.google.firebase.firestore.QuerySnapshot;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import androidx.core.content.ContextCompat;
+
+import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
+import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
+
+public class PDFCreator extends AppCompatActivity{
+ //private LinearLayout llPdf;
+ //private Bitmap bitmap;
+ private static final int PERMISSION_REQUEST_CODE = 200;
+ //private static PDFCreator mContext;
+ String title;
+ String [] label;
+ String [] body;
+ static Map strMap = new HashMap<>();
+ static Map dubMap = new HashMap<>();
+ static Map boolMap = new HashMap<>();
+ static {
+ dubMap.put("WQI", 16.786);
+ dubMap.put("PTI", 20.0);
+ dubMap.put("QHEI", 24.0);
+
+ strMap.put("H_inspector_name", "JL");
+ strMap.put("H_site_name", "Test1");
+ strMap.put("H_date", "03-30-2021");//TODO: What are inspector, site and date?
+ strMap.put("GOD_outfall", "");
+ strMap.put("GOD_longitude", "");
+ strMap.put("GOD_latitude", "");
+ strMap.put("GOD_invert_elevation", "");
+ strMap.put("GOD_type", "");
+ strMap.put("GOD_pipe_size", "");
+ strMap.put("GOD_channel_bottom_width", "");
+ strMap.put("GOD_receiving_water", "");
+
+ boolMap.put("DWS_presence_of_flow", true);
+ boolMap.put("DWS_unusual_odor", true);
+ boolMap.put("DWS_unusual_color", true);
+ boolMap.put("DWS_polutants", false);
+ boolMap.put("DWS_obstruction", false);
+ boolMap.put("DWS_needs_maintenance", true);
+ boolMap.put("DWS_screened_OK", false);
+
+ boolMap.put("FC_routine_evaluation", false);
+ boolMap.put("FC_complaint_investigation", true);
+ boolMap.put("FC_illicit_discharge_detected", true);
+ boolMap.put("FC_no_illicit_discharge_detected", false);
+ boolMap.put("FC_further_action_needed", false);
+
+ dubMap.put("CT_temperature_change", 2.0);
+ dubMap.put("CT_turbidity", 144.0);
+ dubMap.put("CT_pH", 8.0);
+ dubMap.put("CT_nitrate", 15.0);
+ dubMap.put("CT_total_phosphate", 0.6);
+ dubMap.put("CT_dissolved_oxygen", 6.0);
+ dubMap.put("CT_E_coli", 150.0);
+
+ strMap.put("CT_other1", "");
+ strMap.put("CT_other2", "");
+
+ dubMap.put("BM_intolerant", 1.0);
+ dubMap.put("BM_moderately_tolerant", 4.0);
+ dubMap.put("BM_fairly_tolerant", 1.0);
+ dubMap.put("BM_very_tolerant", 2.0);
+
+ strMap.put("HQ_substrate_size", "");
+ strMap.put("HQ_smothering", "5: No");
+ strMap.put("HQ_silting", "5: No");
+ strMap.put("HQ_rootwads", "");
+ strMap.put("HQ_overhanging_veg", "0: No");
+ strMap.put("HQ_oxbowsblack_waters", "");
+ strMap.put("HQ_downed_treeslogs", "");
+ strMap.put("HQ_shallows", "");
+ strMap.put("HQ_water_plants", "");
+ strMap.put("HQ_deep_pools", "");
+ strMap.put("HQ_logswoody_debris", "");
+ strMap.put("HQ_boulders", "");
+ strMap.put("HQ_undercut_banks", "");
+ strMap.put("HQ_sinuosity", "");
+ strMap.put("HQ_natural", "");
+ strMap.put("HQ_riparian_width", "5: narrow (Less than 20')");
+ strMap.put("HQ_land_use", "");
+ strMap.put("HQ_bank_erosion", "");
+ strMap.put("HQ_stream_shading", "3: Mostly");
+ strMap.put("HQ_deepest_pool", "");
+ strMap.put("HQ_velocity", "");
+ strMap.put("HQ_rifflerun_depth", "6: Ankle-Calf Deep and Fast");
+ strMap.put("HQ_rifflerun_substrate", "");
+
+
+ }
+ String [] labels = new String[] {"Chemical (WQI): ", "Biological (PTI): ", "Habitat (QHEI): ", "Name of Inspector: ", "Name of Site: ", "Date: ", "Outfall #: ", "Longitude: ", "Latitude: ", "Invert Elevation: ", "Type: ", "Pipe Size: ", "Channel Bottom Width: ", "Receiving Water: ", "Presence Of Flow: ", "Unusual Odor: ", "Unusual Color: ", "Polutants (nearby): ", "Obstruction: ", "Needs Mainenance: ", "Screened Ok: ", "Routine Evaluation: ", "Complaint Investigation: ", "Illicit Discharge Detected: ", "No Illicit Discharge Detected: ", "Further Action Needed: ", "Temperature (C) Change: ", "Turbidity (NTU): ", "pH: ", "Nitrate (mg/L): ", "Total Phosphate (mg/L): ", "Dissolved Oxygen (mg/L): ", "E coli (Col/100ml): ", "Other 1: ", "Other 2: ", "Intolerant: ", "Moderately Tolerant: ", "Fairly Tolerant: ", "Very Tolerant: ", "Substrate Size: ", "Smothering: ", "Silting: ", "Rootwads: ", "Overhanging Veg.: ", "Oxbows/Black Water: ", "Downed Trees/Logs: ", "Shallows (in slow water): ", "Water Plants: ", "Deep Pools: ", "Logs/Woody Debris: ", "Boulders: ", "Undercut Banks: ", "Sinuosity: ", "Natural: ", "Riparian Width: ", "Land Use: ", "Bank Erosion: ", "Stream Shading: ", "Deepest Pool: ", "Velocity: ", "Riffle/Run Depth: ", "Riffle/Run Substrate: ", "Comments: "};
+ String [] keys = new String[] {"WQI","PTI","QHEI","H_inspector_name","H_site_name","H_date","GOD_outfall","GOD_longitude","GOD_latitude","GOD_invert_elevation","GOD_type","GOD_pipe_size","GOD_channel_bottom_width","GOD_receiving_water","DWS_presence_of_flow","DWS_unusual_odor","DWS_unusual_color","DWS_polutants","DWS_obstruction","DWS_needs_maintenance","DWS_screened_OK","FC_routine_evaluation","FC_complaint_investigation","FC_illicit_discharge_detected","FC_no_illicit_discharge_detected","FC_further_action_needed","CT_temperature_change","CT_turbidity","CT_pH","CT_nitrate","CT_total_phosphate","CT_dissolved_oxygen","CT_E_coli","CT_other1","CT_other2","BM_intolerant","BM_moderately_tolerant","BM_fairly_tolerant","BM_very_tolerant","HQ_substrate_size","HQ_smothering","HQ_silting","HQ_rootwads","HQ_overhanging_veg","HQ_oxbowsblack_waters","HQ_downed_treeslogs","HQ_shallows","HQ_water_plants","HQ_deep_pools","HQ_logswoody_debris","HQ_boulders","HQ_undercut_banks","HQ_sinuosity","HQ_natural","HQ_riparian_width","HQ_land_use","HQ_bank_erosion","HQ_stream_shading","HQ_deepest_pool","HQ_velocity","HQ_rifflerun_depth","HQ_rifflerun_substrate", "CS_comments"};
+ //TODO: Image
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_pdf);
+
+ // below code is used for
+ // checking our permissions.
+ if (checkPermission()) {
+ Toast.makeText(this, "Permission Granted", Toast.LENGTH_SHORT).show();
+ } else {
+ requestPermission();
+ }
+
+ createPDF();
+ Log.d("Finish", "IT IS FINISHED");
+ }
+
+ /*//Constructor
+ PDFCreator(String title, String [] label, String [] body) {
+ this.title = title;
+ this.label = label;
+ this.body = body;
+ //mContext = this;
+ }*/
+ //Default constructor
+ /*PDFCreator () {
+ }*/
+
+ public void createPDF() {
+ //llPdf = llPdf.findViewById(R.id.rvWWR);//TODO: IS THIS FINE?
+ //Create new doc
+ PdfDocument document = new PdfDocument();
+
+ //Paint paint = new Paint();//for shapes
+ Paint title = new Paint();//for text
+
+ //Create page description
+ PageInfo pageInfo = new PageInfo.Builder((int) (8.5 * 72),11 * 72,1).create();
+
+ //Start page
+ Page page = document.startPage(pageInfo);
+
+ /*//Draw something on the page
+ View content = getContentView();*/
+ Canvas canvas = page.getCanvas();
+ //TODO: DRAW IMAGE?
+
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));//Bold text
+ title.setTextSize(18);//John used size 18
+ //title.setColor(ContextCompat.getColor(this, R.color.purple_200));
+ //String header = "Water Quality Test";
+ Log.d("test", Float.toString(title.measureText("Water Quality Test")));
+ canvas.drawText("Water Quality Test", (float) (((8.5*72)-title.measureText("Water Quality Test"))/2), 36, title);
+
+
+ //TODO: GET RID OF THIS AFTER TESTING
+ //canvas.drawText("This is a test.", 20, 20, title);
+ title.setTextSize(12);//15);//TODO: SHOULD I CHANGE THIS?
+
+ writeToCanvas(canvas, title);
+ //Write the document content
+ document.finishPage(page);
+
+
+
+ File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Test", "Test.pdf");
+ /*try {
+ // Save file address
+ // Get the parent directory: / aaa / bbb / ccc /
+ String path = file.getParent();
+ File check = new File(path);
+ // Create a folder through the parent directory, not through outFile
+ if (!check.exists()) {
+ // Create a file when the file does not exist
+ if (check.mkdirs() && !file.exists()) {
+ //Create a file
+ if (!file.createNewFile()) Log.e("pdf", "File to create failure!");
+ }
+ }
+ } catch (IOException e ) {
+ e.printStackTrace();
+ }*/
+ //File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "Test.pdf");
+ if (!file.exists()) {
+ Log.d("pdf", "DOESN'T EXIST");
+ file.getParentFile().mkdirs();
+ }
+ if (file.exists()) {
+ Log.d("pdf", "EXISTS NOW");
+ }
+
+
+ try {
+ //write pdf ot file location
+ document.writeTo(new FileOutputStream(file));
+ Toast.makeText(PDFCreator.this, "PDF file generated succesfully.", Toast.LENGTH_SHORT).show();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+
+ /*if (this.title == "Waterway Inspections") {
+ addWWText();
+ }
+ else {
+
+ }*/
+
+ /*//Finish page
+ content.draw(page.getCanvas());*/
+
+ //Close document
+ document.close();
+ }
+
+ public void addWWText () {
+
+ }
+
+ private boolean checkPermission() {
+ // checking of permissions.
+ /*int permission1 = ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
+ int permission2 = ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.READ_EXTERNAL_STORAGE);
+ //int permission1 = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);
+ //int permission2 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);
+ return permission1 == PackageManager.PERMISSION_GRANTED && permission2 == PackageManager.PERMISSION_GRANTED;*/
+ if (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
+ if (checkSelfPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
+ Log.v("pdf","Permission is granted");
+ //File write logic here
+ return true;
+ }
+ }
+ return false;//if it doesn't return true, it'll return false
+ }
+
+ private void requestPermission() {
+ // requesting permissions if not provided.
+ ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE,android.Manifest.permission.READ_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
+ //android.Manifest.permission.WRITE_EXTERNAL_STORAGE,android.Manifest.permission.READ_EXTERNAL_STORAGE
+ //ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
+ }
+
+ @Override
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ if (requestCode == PERMISSION_REQUEST_CODE) {
+ if (grantResults.length > 0) {
+
+ // after requesting permissions we are showing
+ // users a toast message of permission granted.
+ boolean writeStorage = grantResults[0] == PackageManager.PERMISSION_GRANTED;
+ boolean readStorage = grantResults[1] == PackageManager.PERMISSION_GRANTED;
+
+ if (writeStorage && readStorage) {
+ Toast.makeText(this, "Permission Granted..", Toast.LENGTH_SHORT).show();
+ } else {
+ Toast.makeText(this, "Permission Denined.", Toast.LENGTH_SHORT).show();
+ finish();
+ }
+ }
+ }
+ }
+
+ public void writeToCanvas(Canvas canvas, Paint title) {
+ //canvas.drawText("TESTING TESTING.", 20, 20, title);
+ //The title was at 36
+ //(float) (((8.5*72)-title.measureText("Water Quality Test"))/2)
+ /*Rect bounds = new Rect();
+ title.getTextBounds("Water Quality Test", 0, "Water Quality Test".length(), bounds);
+ Log.d("test", String.valueOf(bounds.height()));*/
+ int currHi = 36 + 20;//getHeight(title, "Water Quality Test");
+ Log.d("finish", String.valueOf(getHeight(title, "Water Quality Test")));
+ int currWi = 20;
+ int holdHi = 0;
+ for (int i = 0; i <= 2; i++) {
+ //Log.d("test", labels[i]);
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ canvas.drawText(labels[i], currWi, currHi, title);
+ //title.measureText
+ currWi += title.measureText(labels[i]);
+ //Log.d("test", String.valueOf(dubMap.get(keys[i])));
+ title.setColor(ContextCompat.getColor(this, R.color.red));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ canvas.drawText(String.valueOf(dubMap.get(keys[i])), currWi, currHi, title);
+ currWi += (int) title.measureText(String.valueOf(dubMap.get(keys[i]))) + 20;
+ }
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ currHi += 16;//getHeight(title, labels[0]);//TODO: IS this ok?
+ for (int i=3; i<=5; i++) {
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ canvas.drawText(labels[i], 20, currHi, title);
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ canvas.drawText(String.valueOf(strMap.get(keys[i])), 20 + title.measureText(labels[i]), currHi, title);
+ currHi += 16;//getHeight(title, labels[i]);
+ }
+ canvas.drawText("--------------------------------------------------------------------------------------------------------------------------------------------", 20, currHi, title);
+ currHi += 14;//getHeight(title, "---");//TODO: MAYBE CHANGE
+ holdHi = currHi;
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setTextSize(14);
+ canvas.drawText("General Outfall Data", 20, currHi,title);
+ currHi += 16;//getHeight(title, "General Outfall Data");
+ title.setTextSize(12);
+ for (int i=6; i<=13; i++) {
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ canvas.drawText(labels[i], 20, currHi, title);
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ canvas.drawText(String.valueOf(strMap.get(keys[i])), 20 + title.measureText(labels[i]), currHi, title);
+ currHi += 16;//getHeight(title, labels[i]);
+ }
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setTextSize(14);
+ canvas.drawText("Dry Weather Screening", 20, currHi,title);
+ currHi += 16;//getHeight(title, "Dry Weather Screening");
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ title.setTextSize(12);
+ for (int i=14; i<=20; i++) {
+ if (boolMap.get(keys[i]) == true) {
+ canvas.drawText("\u2611", 20, currHi, title);//checkbox
+ canvas.drawText(labels[i], 20 + title.measureText("\u2611"), currHi, title);
+ }
+ else {
+ canvas.drawText("\u25A2", 20, currHi, title);//Unchecked box
+ canvas.drawText(labels[i], 20 + title.measureText("\u25A2"), currHi, title);
+ }
+ currHi += 16;//getHeight(title, String.valueOf(boolMap.get(keys[i])));
+ }
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setTextSize(14);
+ canvas.drawText("Final Conclusion", 20, currHi,title);
+ currHi += 16;//getHeight(title, "Final Conclusion");
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ title.setTextSize(12);
+ for (int i=21; i<=25; i++) {
+ if (boolMap.get(keys[i]) == true) {
+ canvas.drawText("\u2611", 20, currHi, title);//checkbox
+ canvas.drawText(labels[i], 20 + title.measureText("\u2611"), currHi, title);
+ }
+ else {
+ canvas.drawText("\u25A2", 20, currHi, title);//Unchecked box
+ canvas.drawText(labels[i], 20 + title.measureText("\u25A2"), currHi, title);
+ }
+ currHi += 16;//getHeight(title, String.valueOf(boolMap.get(keys[i])));
+ }
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setTextSize(14);
+ canvas.drawText("Chemical Testing (Q-Values)", 20, currHi,title);
+ currHi += 16;//getHeight(title, "Chemical Testing (Q-Values)");
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTextSize(12);
+ for (int i=26; i<=32; i++) {
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ canvas.drawText(labels[i], 20, currHi, title);
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ canvas.drawText(String.valueOf(dubMap.get(keys[i])), 20 + title.measureText(labels[i]), currHi, title);
+ currHi += 16;//getHeight(title, labels[i]);
+ }
+ for (int i=33; i<=34; i++) {
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ canvas.drawText(labels[i], 20, currHi, title);
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ canvas.drawText(String.valueOf(strMap.get(keys[i])), 20 + title.measureText(labels[i]), currHi, title);
+ currHi += 16;//getHeight(title, labels[i]);
+ }
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setTextSize(14);
+ currWi = (int)(8.5 * 72) / 2;
+ currHi = holdHi;
+ canvas.drawText("Biological Monitoring (# of Taxa)", currWi, currHi,title);
+ currHi += 16;
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTextSize(12);
+ for (int i=35; i<=38; i++) {
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ canvas.drawText(labels[i], currWi, currHi, title);
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ canvas.drawText(String.valueOf(dubMap.get(keys[i])), currWi + title.measureText(labels[i]), currHi, title);
+ currHi += 16;
+ }
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setTextSize(14);
+ canvas.drawText("Habitat Quality", currWi, currHi, title);
+ currHi += 16;
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTextSize(12);
+ for (int i=39; i<=61; i++) {
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ canvas.drawText(labels[i], currWi, currHi, title);
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ canvas.drawText(String.valueOf(strMap.get(keys[i])), currWi + title.measureText(labels[i]), currHi, title);
+ currHi += 16;
+ }
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setTextSize(14);
+ canvas.drawText("Comments", currWi, currHi, title);
+ }
+
+ public int getWidth(Paint title, String text) {
+ return (int) title.measureText(text);
+ }
+ public int getHeight(Paint title, String text) {
+ Rect bounds = new Rect();
+ title.getTextBounds("Water Quality Test", 0, "Water Quality Test".length(), bounds);
+ Log.d("test", String.valueOf(bounds.height()));
+ return bounds.height();
+ }
+
+}
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/ReportAdapter.java b/app/src/main/java/com/sf/stormwaterutilityandroid/ReportAdapter.java
new file mode 100644
index 0000000..775a581
--- /dev/null
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/ReportAdapter.java
@@ -0,0 +1,82 @@
+package com.sf.stormwaterutilityandroid;
+
+import android.content.Intent;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.sf.stormwaterutilityandroid.WaterWay.WaterWay;
+import com.sf.stormwaterutilityandroid.WaterWay.WaterWayReport;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class ReportAdapter extends RecyclerView.Adapter{
+
+ List listdata;
+ public ReportAdapter(List listdata) {
+ this.listdata = listdata;
+ }
+
+ @Override
+ public ReportAdapter.MyHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.cardview_reports,parent,false);
+
+ ReportAdapter.MyHolder myHolder = new ReportAdapter.MyHolder(view);
+ return myHolder;
+ }
+
+ //I ADDED CODE HERE. TODO: IS THAT OK?
+
+ //END CODE
+
+
+ public void onBindViewHolder(ReportAdapter.MyHolder holder, final int position) {
+
+ final WaterWayReport data = listdata.get(position);
+ holder.inspectorName.setText(data.getH_inspector_name());
+ holder.site.setText(data.getH_site_name());
+ holder.date.setText(data.getH_date());
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(v.getContext(), WaterwayReportDetail.class);
+ intent.putExtra("report",new WaterWayReport(data.getH_date(),data.getH_inspector_name(),data.getH_site_name(),data.getTimeStamp(),data.getBoolFields(),data.getDoubleFields(),data.getStringFields()));
+ v.getContext().startActivity(intent);
+ }
+ });
+
+
+ }
+
+ @Override
+ public int getItemCount() {
+ if (listdata == null) {
+ return 0;
+ }
+ return listdata.size();
+ }
+
+ // @Override
+ // public int getItemCount() {
+ // return listdata.size();
+ //}
+
+
+ class MyHolder extends RecyclerView.ViewHolder{
+ TextView inspectorName,site,date;
+
+ public MyHolder(View itemView) {
+ super(itemView);
+ inspectorName = (TextView) itemView.findViewById(R.id.inspectorName);
+ site = (TextView) itemView.findViewById(R.id.siteName);
+ date = (TextView) itemView.findViewById(R.id.date);
+ }
+ }
+
+
+}
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/Settings.java b/app/src/main/java/com/sf/stormwaterutilityandroid/Settings.java
index 8eca92d..e9cac67 100644
--- a/app/src/main/java/com/sf/stormwaterutilityandroid/Settings.java
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/Settings.java
@@ -1,14 +1,94 @@
package com.sf.stormwaterutilityandroid;
+import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
+import android.content.Intent;
+import android.net.Uri;
import android.os.Bundle;
+import android.os.Environment;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.Toast;
+
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.Task;
+import com.google.firebase.auth.AuthCredential;
+import com.google.firebase.auth.EmailAuthProvider;
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.auth.FirebaseUser;
+import com.google.firebase.firestore.FirebaseFirestore;
+import com.google.firebase.firestore.Query;
+import com.google.firebase.firestore.QueryDocumentSnapshot;
+import com.google.firebase.firestore.QuerySnapshot;
+import com.sf.stormwaterutilityandroid.Grapher;
public class Settings extends AppCompatActivity {
+ private Button btnSupport, btnPrivacyPolicy, btnSignOut, btnDeleteAccount, btnGraph, btnPDF, btnReport;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
+
+ btnSupport = findViewById(R.id.support_button);
+ btnPrivacyPolicy = findViewById(R.id.policy_button);
+ btnSignOut = findViewById(R.id.signout_button);
+ btnDeleteAccount = findViewById(R.id.delete_account_button);
+
+ btnSupport.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ //startActivity(new Intent(Reports.this, Site_name.class));
+ Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://forms.gle/LgzUmpDwgPkbNoTs6"));
+ startActivity(browserIntent);
+ }
+ });
+
+ btnPrivacyPolicy.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ //startActivity(new Intent(Reports.this, Date.class));
+ Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://forms.gle/AkGaMazbPKpoDsdZA"));
+ startActivity(browserIntent);
+ }
+ });
+
+ btnSignOut.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ //startActivity(new Intent(Reports.this, Inspector_name.class));
+ FirebaseAuth.getInstance().signOut();
+ }
+ });
+
+ btnDeleteAccount.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ //startActivity(new Intent(Reports.this, Inspector_name.class));
+ final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
+
+ // Get auth credentials from the user for re-authentication. The example below shows
+ // email and password credentials but there are multiple possible providers,
+ // such as GoogleAuthProvider or FacebookAuthProvider.
+ AuthCredential credential = EmailAuthProvider.getCredential("user@example.com", "password1234");
+
+ // Prompt the user to re-provide their sign-in credentials
+ user.reauthenticate(credential).addOnCompleteListener(new OnCompleteListener() {
+ public void onComplete(@NonNull Task task) {
+ user.delete().addOnCompleteListener(new OnCompleteListener() {
+ @Override
+ public void onComplete(@NonNull Task task) {
+ if (task.isSuccessful()) {
+ Log.d("UserDelete", "User account deleted.");
+ }
+ }
+ });
+ }
+ });
+ }
+ });
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/SignUp.java b/app/src/main/java/com/sf/stormwaterutilityandroid/SignUp.java
index e0eaa03..48b04ae 100644
--- a/app/src/main/java/com/sf/stormwaterutilityandroid/SignUp.java
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/SignUp.java
@@ -1,5 +1,7 @@
package com.sf.stormwaterutilityandroid;
+import android.content.DialogInterface;
+import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
@@ -9,6 +11,7 @@
import android.widget.Toast;
import androidx.annotation.NonNull;
+import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.gms.tasks.OnCompleteListener;
@@ -34,16 +37,14 @@ protected void onCreate(Bundle savedInstanceState) {
//Get Firebase auth instance
auth = FirebaseAuth.getInstance();
- btnSignIn = findViewById(R.id.sign_in_button);
- btnSignUp = findViewById(R.id.sign_up_button);
+ btnSignUp = findViewById(R.id.signUp);
+
inputEmail = findViewById(R.id.email);
inputPassword = findViewById(R.id.password);
progressBar = findViewById(R.id.progressBar);
btnResetPassword = findViewById(R.id.btn_reset_password);
- inputGrade = findViewById(R.id.grade);
inputName = findViewById(R.id.name);
- inputID = findViewById(R.id.studentID);
- inputHR = findViewById(R.id.homeroom);
+ progressBar = findViewById(R.id.progressBar2);
/* btnResetPassword.setOnClickListener(new View.OnClickListener() {
@Override
@@ -52,12 +53,6 @@ public void onClick(View v) {
}
});
*/
- btnSignIn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- finish();
- }
- });
btnSignUp.setOnClickListener(new View.OnClickListener() {
@Override
@@ -66,14 +61,13 @@ public void onClick(View v) {
final String email = inputEmail.getText().toString().trim();
final String password = inputPassword.getText().toString().trim();
final String name = inputName.getText().toString().trim();
- final String grade = inputGrade.getText().toString().trim();
- final String studentID = inputID.getText().toString().trim();
- final String homeroom = inputHR.getText().toString().trim();
+
if (TextUtils.isEmpty(email)) {
Toast.makeText(getApplicationContext(), "Enter a email address!", Toast.LENGTH_SHORT).show();
return;
}
-
+ int index = email.indexOf("@");
+ String agencyID = email.substring(index + 1);
if (TextUtils.isEmpty(password)) {
Toast.makeText(getApplicationContext(), "Enter a password!", Toast.LENGTH_SHORT).show();
return;
@@ -83,12 +77,21 @@ public void onClick(View v) {
Toast.makeText(getApplicationContext(), "Password too short, enter minimum 6 characters!", Toast.LENGTH_SHORT).show();
return;
}
- if (TextUtils.isEmpty(homeroom)) {
- Toast.makeText(getApplicationContext(), "Enter a homeroom!", Toast.LENGTH_SHORT).show();
- return;
- }
- if (TextUtils.isEmpty(studentID)) {
- Toast.makeText(getApplicationContext(), "Enter a StudentID!", Toast.LENGTH_SHORT).show();
+
+ if (!email.contains("in.gov") && !email.contains("purdue.edu")) {
+ //invalid email
+ AlertDialog.Builder builder;
+ builder = new AlertDialog.Builder(SignUp.this);
+ builder.setTitle("Incorrect Email");
+ builder.setMessage("You are not allowed to create an email with your current domain");
+ builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int id) {
+ dialog.dismiss();
+ }
+ });
+
+ builder.setCancelable(true);
+ builder.show();
return;
}
@@ -109,8 +112,10 @@ public void onComplete(@NonNull Task task) {
} else {
final String create_uid = FirebaseAuth.getInstance().getUid();
final FirebaseUser user2 = auth.getCurrentUser();
- user2.sendEmailVerification();
- User user = new User(name,email,create_uid);
+ // user2.sendEmailVerification();
+
+ System.out.println(agencyID);
+ User user = new User(name, email, create_uid, agencyID);
FirebaseFirestore.getInstance().collection("Users")
.document(create_uid)
@@ -122,10 +127,23 @@ public void onSuccess(Void aVoid) {
user2.sendEmailVerification();
-
// progressBar.setVisibility(View.GONE);
// Toast.makeText(SignupActivity.this, getString(R.string.registration_success), Toast.LENGTH_LONG).show();
- // startActivity(new Intent(SignupActivity.this, LoginActivity.class));
+ AlertDialog.Builder builder;
+ builder = new AlertDialog.Builder(SignUp.this);
+ builder.setTitle("Account created");
+ builder.setMessage("Your account has successfully been created. An email has been sent, so you can verify your email. You must verify your email before logging in.");
+ builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int id) {
+ startActivity(new Intent(SignUp.this, Login.class));
+ dialog.dismiss();
+ }
+ });
+
+ builder.setCancelable(true);
+ builder.show();
+
+
// finish();
}
@@ -149,7 +167,6 @@ public void onFailure(@NonNull Exception e) {
}
-
@Override
protected void onResume() {
super.onResume();
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/User.java b/app/src/main/java/com/sf/stormwaterutilityandroid/User.java
index 5671a58..d7b420e 100644
--- a/app/src/main/java/com/sf/stormwaterutilityandroid/User.java
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/User.java
@@ -1,12 +1,17 @@
package com.sf.stormwaterutilityandroid;
-class User {
- String name, email, uid;
+public class User {
+ String name, email, uid,agencyID;
+ public static String agid;
- public User(String name, String email, String uid) {
+ public User() {
+ }
+
+ public User(String name, String email, String uid, String agencyID) {
this.name = name;
this.email = email;
this.uid = uid;
+ this.agencyID = agencyID;
}
public String getName() {
@@ -32,4 +37,12 @@ public String getUid() {
public void setUid(String uid) {
this.uid = uid;
}
+
+ public String getAgencyID() {
+ return agencyID;
+ }
+
+ public void setAgencyID(String agencyID) {
+ this.agencyID = agencyID;
+ }
}
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 19e621c..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;
@@ -26,15 +28,25 @@
public class ChemicalTesting extends AppCompatActivity{
private FormBuilder formBuilder;
private RecyclerView recyclerView;
- FormElementTextEmail element11;
- @Override
- //I assume onCreate is important so I will leave it unchanged
+
+ 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;
+
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);
@@ -42,57 +54,46 @@ 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?
+ 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();
+ FormElementTextSingleLine tubidity = new FormElementTextSingleLine().setTitle("Tubidity (NTU)").setValue("0");
+ turbidityVal = Double.parseDouble(tubidity.getValue());
- FormElementTextSingleLine pH = new FormElementTextSingleLine().setTitle("pH");
- FormElementTextNumber pHData = FormElementTextNumber.createInstance();
+ 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();
+ 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();
+ 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();
+ 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();
+ 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();
+ 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/PTI.java b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/PTI.java
new file mode 100644
index 0000000..3b5dc89
--- /dev/null
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/PTI.java
@@ -0,0 +1,40 @@
+package com.sf.stormwaterutilityandroid.WaterWay;
+
+public class PTI {
+ private double BM_intolerant = 0;
+ private double BM_moderately_tolerant = 0;
+ private double BM_fairly_tolerant = 0;
+ private double BM_very_tolerant = 0;
+
+ PTI(double BM_intolerant, double BM_moderately_tolerant, double BM_fairly_tolerant, double BM_very_tolerant) {
+ this.BM_intolerant = BM_intolerant;
+ this.BM_moderately_tolerant = BM_moderately_tolerant;
+ this.BM_fairly_tolerant = BM_fairly_tolerant;
+ this.BM_very_tolerant = BM_very_tolerant;
+ }
+
+ public void setBM_intolerant(double value) {
+ BM_intolerant = value;
+ }
+
+ public void setBM_moderately_tolerant(double value) {
+ BM_moderately_tolerant = value;
+ }
+
+ public void setBM_fairly_tolerant(double value) {
+ BM_fairly_tolerant = value;
+ }
+
+ public void setBM_very_tolerant(double value) {
+ BM_very_tolerant = value;
+ }
+
+ public double calculatePTI() {
+ return 4.0 * BM_intolerant + 3.0 * BM_moderately_tolerant + 2.0 * BM_fairly_tolerant + 1.0 * BM_very_tolerant;
+ }
+
+ public static double getPTI(double intolerant, double moderate, double fairly, double very) {
+ return 4.0 * intolerant + 3.0 * moderate + 2.0 * fairly + 1.0 * very;
+ }
+
+}
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WQI.java b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WQI.java
new file mode 100644
index 0000000..30c36f5
--- /dev/null
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WQI.java
@@ -0,0 +1,35 @@
+package com.sf.stormwaterutilityandroid.WaterWay;
+
+public class WQI {
+ private double CT_temperature_change = 0;
+ private double CT_turbidity = 0;
+ private double CT_pH = 0;
+ private double CT_nitrate = 0;
+ private double CT_total_phosphate = 0;
+ private double CT_dissolved_oxygen = 0;
+
+ WQI(double CT_temperature_change, double CT_turbidity, double CT_pH, double CT_nitrate, double CT_total_phosphate,
+ double CT_dissolved_oxygen) {
+ this.CT_temperature_change = CT_temperature_change;
+ this.CT_turbidity = CT_turbidity;
+ this.CT_pH = CT_pH;
+ this.CT_nitrate = CT_nitrate;
+ this.CT_total_phosphate = CT_total_phosphate;
+ this.CT_dissolved_oxygen = CT_dissolved_oxygen;
+ }
+
+ public double calculateWQI() {
+ double WQIScore = CT_temperature_change * 0.11 + CT_turbidity * 0.09 + CT_pH * 0.12 + CT_nitrate * 0.1 +
+ CT_total_phosphate * 0.11 + CT_dissolved_oxygen * 0.18;
+
+ return WQIScore;
+ }
+
+ public static double getWQI(double tempChange, double turbidity, double pH, double nitrate, double phosphate, double oxygen) {
+ return tempChange * 0.11 + turbidity * 0.09 + pH * 0.12 + nitrate * 0.1 + phosphate * 0.11 + oxygen * 0.18;
+ }
+
+}
+
+
+
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWay.java b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWay.java
new file mode 100644
index 0000000..b7449aa
--- /dev/null
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWay.java
@@ -0,0 +1,83 @@
+package com.sf.stormwaterutilityandroid.WaterWay;
+
+import java.util.Map;
+import java.util.HashMap;
+
+public class WaterWay {
+
+ private Map WaterWayDoubleFields = new HashMap();
+ private Map WaterWayBoolFields = new HashMap();
+ private Map WaterWayStringFields = new HashMap();
+
+ public WaterWay() {
+ //Water Quality Index Data
+ WaterWayDoubleFields.put("CT_temperature_change", new Double(0.0));
+ WaterWayDoubleFields.put("CT_turbidity", new Double(0.0));
+ WaterWayDoubleFields.put("CT_pH", new Double(0.0));
+ WaterWayDoubleFields.put("CT_nitrate", new Double(0.0));
+ WaterWayDoubleFields.put("CT_total_phosphate", new Double(0.0));
+ WaterWayDoubleFields.put("CT_dissolved_oxygen", new Double(0.0));
+ //PTI Data
+ WaterWayDoubleFields.put("BM_intolerant", new Double(0.0));
+ WaterWayDoubleFields.put("BM_moderately_tolerant", new Double(0.0));
+ WaterWayDoubleFields.put("BM_fairly_tolerant", new Double(0.0));
+ WaterWayDoubleFields.put("BM_very_tolerant", new Double(0.0));
+
+ WaterWayDoubleFields.put("WQI", new Double(0.0));
+ WaterWayDoubleFields.put("HEI", new Double(0.0));
+ WaterWayDoubleFields.put("PTI", new Double(0.0));
+
+ //Boolean Fields
+ WaterWayBoolFields.put("DWS_needs_maintenance", new Boolean(false));
+ WaterWayBoolFields.put("DWS_obstruction", new Boolean(false));
+ WaterWayBoolFields.put("DWS_polutants", new Boolean(false));
+ WaterWayBoolFields.put("DWS_presence_of_flow", new Boolean(false));
+ WaterWayBoolFields.put("DWS_screened_OK", new Boolean(false));
+ WaterWayBoolFields.put("DWS_unusual_color", new Boolean(false));
+ WaterWayBoolFields.put("DWS_unusual_odor", new Boolean(false));
+ 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", "");
+ WaterWayStringFields.put("QHEI_smothering", "");
+ WaterWayStringFields.put("QHEI_silting", "");
+ WaterWayStringFields.put("QHEI_rootwads", "");
+ WaterWayStringFields.put("QHEI_overhanging_veg", "");
+ WaterWayStringFields.put("QHEI_oxbowsblack_waters", "");
+ WaterWayStringFields.put("QHEI_downed_treeslogs","");
+ WaterWayStringFields.put("QHEI_shallows", "");
+ WaterWayStringFields.put("QHEI_water_plants", "");
+ WaterWayStringFields.put("QHEI_deep_pools", "");
+ WaterWayStringFields.put("QHEI_logswoody_debris", "");
+ WaterWayStringFields.put("QHEI_boulders", "");
+ WaterWayStringFields.put("QHEI_undercut_banks", "");
+ WaterWayStringFields.put("QHEI_sinuosity", "");
+ WaterWayStringFields.put("QHEI_riparian_width", "");
+ WaterWayStringFields.put("QHEI_land_use", "");
+ WaterWayStringFields.put("QHEI_bank_erosion", "");
+ WaterWayStringFields.put("QHEI_stream_shading", "");
+ WaterWayStringFields.put("QHEI_deepest_pool", "");
+ WaterWayStringFields.put("QHEI_velocity", "");
+ WaterWayStringFields.put("QHEI_rifflerun_depth", "");
+ WaterWayStringFields.put("QHEI_rifflerun_substrate", "");
+
+ WaterWayStringFields.put("GOD_channel_bottom_width", "");
+ WaterWayStringFields.put("GOD_invert_elevation", "");
+ WaterWayStringFields.put("GOD_latitude", "");
+ WaterWayStringFields.put("GOD_longitude", "");
+ WaterWayStringFields.put("GOD_outfall", "");
+ WaterWayStringFields.put("GOD_pipe_size", "");
+ WaterWayStringFields.put("GOD_receiving_water", "");
+ WaterWayStringFields.put("GOD_type", "");
+
+ //Comments
+ WaterWayStringFields.put("CS_comments", "");
+ WaterWayStringFields.put("CT_other_1", "");
+ WaterWayStringFields.put("CT_other_2", "");
+ }
+}
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 a797f99..08cad4f 100644
--- a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayForm.java
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayForm.java
@@ -8,16 +8,53 @@
import com.sf.stormwaterutilityandroid.R;
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.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
private FormBuilder formBuilder;
private RecyclerView recyclerView;
+ 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;
+
+ //Tolerant Form
+ double intolerantVal = 0.0;
+ double modTolerantVal = 0.0;
+ double fairTolerantVal = 0.0;
+ double veryTolerantVal = 0.0;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -29,48 +66,147 @@ protected void onCreate(Bundle savedInstanceState) {
private void setupForm() {
-
formBuilder = new FormBuilder(this, recyclerView);
- 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");
+ 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<>();
- formItems.add(element2);
- formItems.add(element3);
- formItems.add(element4);
- formItems.add(element5);
- formItems.add(element6);
- formItems.add(element7);
- formItems.add(element8);
- formItems.add(element9);
- formItems.add(element10);
- formItems.add(element11);
- formItems.add(element12);
- formItems.add(element13);
- formItems.add(element14);
- formItems.add(element15);
- formItems.add(element16);
- formItems.add(element17);
- formItems.add(element18);
- formItems.add(element19);
+ 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);
+
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);
+
+
+ }
+ 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);
+ 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 formItems = new ArrayList<>();
+ formItems.add(intolerant);
+ formItems.add(moderatelyTolerant);
+ formItems.add(fairlyTolerant);
+ formItems.add(veryTolerant);
+
+ intolerantVal = Double.parseDouble(intolerant.getValue());
+ modTolerantVal = Double.parseDouble(moderatelyTolerant.getValue());
+ fairTolerantVal = Double.parseDouble(fairlyTolerant.getValue());
+ veryTolerantVal = Double.parseDouble(veryTolerant.getValue());
+
+
}
}
\ No newline at end of file
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 806377b..9a7c4a6 100644
--- a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayFormFragment.java
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayFormFragment.java
@@ -6,54 +6,789 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
+import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.RecyclerView;
-import com.sf.stormwaterutilityandroid.InspectionForm;
+
+import com.addisonelliott.segmentedbutton.SegmentedButton;
+
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.Task;
+import com.google.firebase.Timestamp;
+import com.google.firebase.firestore.DocumentReference;
+import com.google.firebase.firestore.FieldValue;
+import com.google.firebase.firestore.FirebaseFirestore;
+import com.google.firebase.firestore.GeoPoint;
+import com.google.firebase.firestore.model.ServerTimestamps;
import com.sf.stormwaterutilityandroid.R;
import com.sf.stormwaterutilityandroid.SampleFordm;
+import com.sf.stormwaterutilityandroid.User;
+
+import java.sql.Time;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+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;
+import me.riddhimanadib.formmaster.model.FormHeader;
public class WaterWayFormFragment extends Fragment {
+ FormElementTextSingleLine name, site, date, outfallValue, longitudeValue, latitudeValue, invertElevationValue,other1,other2,comments;
+ FormElementPickerSingle subSize, smothering, silting, rootwads, overhangingVeg, oxbows, downed, shallows, waterPlants, deepPools, logs, boulders, undercutBanks, sinuosity, natural, riparianWidth, landUse, bankErosion, streamShading, deepestPool, velocityForm, riffleDepth, riffleSub;
+ FormElementSwitch flow, odor, color, polutants, obstruction, maintenance, screen,rountineEvaluation,illicitDischarge,noIllicitDischarge,complaintInvestigation,furtherActionNeeded;
+ FormElementTextNumber temperature, tubidity, pH, nitrate, phosphate, oxygen, coli, intolerant, moderatelyTolerant, fairlyTolerant, veryTolerant;
+ FormElementPickerMulti typeValue, pipeSizeValue, channelBottomWidthValue, receiving;
+ //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;
+Button submit;
+Boolean boolgen,booldws,boolct,boolbm,boolhq;
+ List formItemsHQ, formItemsGen, formItemsBM, formItemsCT, formItemsDWS;
- Button b1,b2,b3,b4,b5;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
- View root = inflater.inflate(R.layout.fragment_home, container, false);
- b1 = root.findViewById(R.id.button);
- b1.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- startActivity(new Intent(getContext(), SampleFordm.class));
- }
- });
-
- b1 = root.findViewById(R.id.button2);
- b1.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- startActivity(new Intent(getContext(), InspectionForm.class));
- }
- });
-
-
- //CHeck To5a.03 project for dealing saved instance state
- /*
- if (savedInstanceState != null) {
- String allPreviousLifecycleCallbacks = savedInstanceState
- .getString("Email");
- System.out.println("SavedInstanceState: "+allPreviousLifecycleCallbacks);
- element11.setValue(allPreviousLifecycleCallbacks);
- }
-*/
+ View root = inflater.inflate(R.layout.fragment_wwform, container, false);
+ //recylerViews for each piece of the form
+ submit = root.findViewById(R.id.submitForm);
+ rvGen = root.findViewById(R.id.rvWWF);
+ rvDWS = root.findViewById(R.id.rvDWS);
+ rvHQ = root.findViewById(R.id.rvHQ);
+ rvBM = root.findViewById(R.id.rvBM);
+ rvCT = root.findViewById(R.id.rvCT);
+
+ //making recyclerViews invisible
+ rvDWS.setVisibility(View.INVISIBLE);
+ rvHQ.setVisibility(View.INVISIBLE);
+ rvBM.setVisibility(View.INVISIBLE);
+ rvCT.setVisibility(View.INVISIBLE);
+ setupFormGen();
+ //Segemented Control Bar buttons
+ gen = root.findViewById(R.id.gen);
+ dws = root.findViewById(R.id.dws);
+ ct = root.findViewById(R.id.ct);
+ bm = root.findViewById(R.id.bm);
+ hq = root.findViewById(R.id.hq);
+//setting booleans to false. If they are true, then an instance of the form section has been created.
+ boolbm = false;
+ boolct = false;
+ booldws = false;
+ boolhq = false;
+ boolgen = true;
+ gen.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ rvGen.setVisibility(View.VISIBLE);
+ rvDWS.setVisibility(View.INVISIBLE);
+ rvHQ.setVisibility(View.INVISIBLE);
+ rvBM.setVisibility(View.INVISIBLE);
+ rvCT.setVisibility(View.INVISIBLE);
+ if (!boolgen)
+ setupFormGen();
+
+ }
+ });
+ submit.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Map WaterWayDoubleFields = new HashMap();
+ Map WaterWayBoolFields = new HashMap();
+ Map WaterWayStringFields = new HashMap();
+
+
+ tempVal = Double.parseDouble(temperature.getValue() );
+ turbidityVal = Double.parseDouble(tubidity.getValue() );
+ phVal = Double.parseDouble(pH.getValue() );
+ nitrateVal = Double.parseDouble(nitrate.getValue() );
+ phosphateVal = Double.parseDouble(phosphate.getValue() );
+ oxygenVal = Double.parseDouble(oxygen.getValue() );
+ coliVal = Double.parseDouble(coli.getValue());
+ other1Val = other1.getValue();
+ other2Val = other2.getValue();
+
+ nameOfInspector = name.getValue();
+ nameOfSite = site.getValue();
+ dateRow = date.getValue();
+ outfall = String.valueOf(outfallValue.getValue());
+ longitude = String.valueOf(longitudeValue.getValue());
+ latitude = String.valueOf(latitudeValue.getValue());
+ invertElevation = String.valueOf(invertElevationValue.getValue());
+
+ flowPres = convertToBoolean(flow.getValue());
+ odorVal = odor.getValue();
+ odorPres = convertToBoolean(odorVal);
+ colorVal = color.getValue();
+ colorPres = convertToBoolean(colorVal);
+ polutantsVal = polutants.getValue();
+ polutantsPres = convertToBoolean(polutantsVal);
+ obstructionVal = obstruction.getValue();
+ obstructionPres = convertToBoolean(obstructionVal);
+ maintenanceVal = maintenance.getValue();
+ needMaintenance = convertToBoolean(maintenanceVal);
+ screenVal = screen.getValue();
+ screenOK = convertToBoolean(screenVal);
+
+ //HQ value retrieval
+ 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();
+ //BM form retrieval
+ intolerantVal = Double.parseDouble(intolerant.getValue());
+ modTolerantVal = Double.parseDouble(moderatelyTolerant.getValue());
+ fairTolerantVal = Double.parseDouble(fairlyTolerant.getValue());
+ veryTolerantVal = Double.parseDouble(veryTolerant.getValue());
+
+ //Water Quality Index Data
+ WaterWayDoubleFields.put("CT_E_coli",coliVal);
+ 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", convertToBoolean(complaintInvestigation.getValue()));
+ WaterWayBoolFields.put("FC_further_action_needed", convertToBoolean(furtherActionNeeded.getValue()));
+ WaterWayBoolFields.put("FC_illicit_discharge_detected", convertToBoolean(illicitDischarge.getValue()));
+ WaterWayBoolFields.put("FC_no_illicit_discharge_detected", convertToBoolean(noIllicitDischarge.getValue()));
+ WaterWayBoolFields.put("FC_routine_evaluation", convertToBoolean(rountineEvaluation.getValue()));
+
+ //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", comments.getValue());
+ WaterWayStringFields.put("CT_other_1", other1.getValue());
+ WaterWayStringFields.put("CT_other_2", other2.getValue());
+
+ WaterWayReport wp = new WaterWayReport(dateRow,nameOfInspector,nameOfSite, null,new GeoPoint(1.23,17.),WaterWayBoolFields,WaterWayDoubleFields,WaterWayStringFields);
+ FirebaseFirestore.getInstance().collection("Forms").document(User.agid).collection("Waterway").add(wp).addOnCompleteListener(new OnCompleteListener() {
+ @Override
+ public void onComplete(@NonNull Task task) {
+ if (task.isSuccessful()) {
+ Toast.makeText(getContext(),"Successfully Uploaded",Toast.LENGTH_LONG).show();
+ }
+ }
+ });
+ }
+
+
+ });
+ dws.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ rvGen.setVisibility(View.INVISIBLE);
+ rvDWS.setVisibility(View.VISIBLE);
+ rvHQ.setVisibility(View.INVISIBLE);
+ rvBM.setVisibility(View.INVISIBLE);
+ rvCT.setVisibility(View.INVISIBLE);
+ if (!booldws)
+ setupFormDWS();
+
+ }
+ });
+ ct.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ rvGen.setVisibility(View.INVISIBLE);
+ rvDWS.setVisibility(View.INVISIBLE);
+ rvHQ.setVisibility(View.INVISIBLE);
+ rvBM.setVisibility(View.INVISIBLE);
+ rvCT.setVisibility(View.VISIBLE);
+ if (!boolct)
+ setupFormCT();
+
+ }
+ });
+ bm.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ rvGen.setVisibility(View.INVISIBLE);
+ rvDWS.setVisibility(View.INVISIBLE);
+ rvHQ.setVisibility(View.INVISIBLE);
+ rvBM.setVisibility(View.VISIBLE);
+ rvCT.setVisibility(View.INVISIBLE);
+ if (!boolbm)
+ setupFormBM();
+ }
+ });
+ hq.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ rvGen.setVisibility(View.INVISIBLE);
+ rvDWS.setVisibility(View.INVISIBLE);
+ rvHQ.setVisibility(View.VISIBLE);
+ rvBM.setVisibility(View.INVISIBLE);
+ rvCT.setVisibility(View.INVISIBLE);
+ if (!boolhq)
+ setupFormHQ();
+ }
+ });
+
+
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;
+ System.out.println("WQI"+WQIScore);
+ return WQIScore;
+ }
+ private void setupFormGen() {
+
+ boolgen = true;
+ fbGEn = new FormBuilder(getContext(), rvGen);
+ formItemsGen = new ArrayList<>();
+
+ FormHeader title = (FormHeader) new FormHeader().setTitle("Report");
+ formItemsGen.add(title);
+
+ name = FormElementTextSingleLine.createInstance().setTitle("Name of Inspector").setValue("");
+ formItemsGen.add(name);
+
+ site = FormElementTextSingleLine.createInstance().setTitle("Name of site").setValue("");
+ formItemsGen.add(site);
+
+ FormElementPickerDate date = FormElementPickerDate.createInstance().setTitle("Date Row").setDateFormat("dd/MM/yyyy").setValue("");
+ formItemsGen.add(date);
+
+ outfallValue = FormElementTextSingleLine.createInstance().setTitle("Outfall").setValue("0");
+ formItemsGen.add(outfallValue);
+
+ longitudeValue = FormElementTextSingleLine.createInstance().setTitle("Longitude").setValue("0");
+ formItemsGen.add(longitudeValue);
+
+ latitudeValue = FormElementTextSingleLine.createInstance().setTitle("Latitude").setValue("0");
+ formItemsGen.add(latitudeValue);
+
+ invertElevationValue = FormElementTextSingleLine.createInstance().setTitle("Invert Elevation").setValue("0");
+ formItemsGen.add(invertElevationValue);
+
+ List pipeTypeOptions = new ArrayList();
+ pipeTypeOptions.add("Enclosed Pipe");
+ pipeTypeOptions.add("Open Channel");
+ typeValue = FormElementPickerMulti.createInstance().setTitle("Type").setOptions(pipeTypeOptions);
+ formItemsGen.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\"");
+ pipeSizeValue = FormElementPickerMulti.createInstance().setTitle("Pipe Size").setOptions(pipeSizeOptions);
+ formItemsGen.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\"");
+ channelBottomWidthValue = FormElementPickerMulti.createInstance().setTitle("Channel Bottom Width")
+ .setOptions(channelWidthOptions);
+ formItemsGen.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");
+
+ receiving = FormElementPickerMulti.createInstance().setTitle("Receiving Water").setOptions(receivingWaterOptions);
+ formItemsGen.add(receiving);
+ complaintInvestigation = FormElementSwitch.createInstance().setTitle("Complaint Investigation").setSwitchTexts("Yes", "No");
+ furtherActionNeeded = FormElementSwitch.createInstance().setTitle("Further Action Needed").setSwitchTexts("Yes", "No");
+ illicitDischarge = FormElementSwitch.createInstance().setTitle("Illicit Discharge Detected").setSwitchTexts("Yes", "No");
+ noIllicitDischarge = FormElementSwitch.createInstance().setTitle("No Illicit Discharge").setSwitchTexts("Yes", "No");
+ rountineEvaluation = FormElementSwitch.createInstance().setTitle("Rountine Evaluation").setSwitchTexts("Yes", "No");
+ comments = FormElementTextSingleLine.createInstance().setTitle("Comments");
+ formItemsGen.add(complaintInvestigation);
+ formItemsGen.add(furtherActionNeeded);
+ formItemsGen.add(illicitDischarge);
+ formItemsGen.add(noIllicitDischarge);
+ formItemsGen.add(rountineEvaluation);
+ formItemsGen.add(comments);
+ fbGEn.addFormElements(formItemsGen);
+ }
+ private void setupFormHQ() {
+ boolhq = true;
+ fbHQ = new FormBuilder(getContext(),rvHQ);
+ 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)");
+
+ 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");
+
+ smothering = FormElementPickerSingle.createInstance().setTitle("Smothering").setOptions(array_yesNo5).setPickerTitle("Pick one option");
+ silting = FormElementPickerSingle.createInstance().setTitle("Silting").setOptions(array_yesNo5).setPickerTitle("Pick one option");
+ rootwads = FormElementPickerSingle.createInstance().setTitle("Rootwads").setOptions(array_yesNo2).setPickerTitle("Pick one option");
+ overhangingVeg = FormElementPickerSingle.createInstance().setTitle("Overhanging Veg.").setOptions(array_yesNo2).setPickerTitle("Pick one option");
+ oxbows = FormElementPickerSingle.createInstance().setTitle("Oxbows/Black Waters").setOptions(array_yesNo2).setPickerTitle("Pick one option");
+ downed = FormElementPickerSingle.createInstance().setTitle("Downed Trees/Logs").setOptions(array_yesNo2).setPickerTitle("Pick one option");
+ shallows = FormElementPickerSingle.createInstance().setTitle("Shallows (slow water)").setOptions(array_yesNo2).setPickerTitle("Pick one option");
+ waterPlants = FormElementPickerSingle.createInstance().setTitle("Water Plants").setOptions(array_yesNo2).setPickerTitle("Pick one option");
+ deepPools = FormElementPickerSingle.createInstance().setTitle("Deep Pools").setOptions(array_yesNo2).setPickerTitle("Pick one option");
+ logs = FormElementPickerSingle.createInstance().setTitle("Logs/Woody Debris").setOptions(array_yesNo2).setPickerTitle("Pick one option");
+ boulders = FormElementPickerSingle.createInstance().setTitle("Boulders").setOptions(array_yesNo2).setPickerTitle("Pick one option");
+ undercutBanks = FormElementPickerSingle.createInstance().setTitle("Undercut Banks").setOptions(array_yesNo2).setPickerTitle("Pick one option");
+ sinuosity = FormElementPickerSingle.createInstance().setTitle("Sinuosity").setOptions(array_sinuosity).setPickerTitle("Pick one option");
+ natural = FormElementPickerSingle.createInstance().setTitle("Natural").setOptions(array_natural).setPickerTitle("Pick one option");
+ riparianWidth = FormElementPickerSingle.createInstance().setTitle("Riparian Width").setOptions(array_riparian).setPickerTitle("Pick one option");
+ landUse = FormElementPickerSingle.createInstance().setTitle("Land Use").setOptions(array_landUse).setPickerTitle("Pick one option");
+ bankErosion = FormElementPickerSingle.createInstance().setTitle("Bank Erosion").setOptions(array_bankErosion).setPickerTitle("Pick one option");
+ streamShading = FormElementPickerSingle.createInstance().setTitle("Stream Shading").setOptions(array_streamShading).setPickerTitle("Pick one option");
+ deepestPool = FormElementPickerSingle.createInstance().setTitle("Deepest Pool").setOptions(array_deepestPool).setPickerTitle("Pick one option");
+ velocityForm = FormElementPickerSingle.createInstance().setTitle("Velocity").setOptions(array_velocity).setPickerTitle("Pick one option");
+ riffleDepth = FormElementPickerSingle.createInstance().setTitle("Riffle/Run Depth").setOptions(array_riffleDepth).setPickerTitle("Pick one option");
+ 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);
+
+ }
+ 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() {
+
+ booldws = true;
+ fbDWS = new FormBuilder(getContext(), rvDWS);
+
+ FormHeader title = (FormHeader) new FormHeader().setTitle("Dry Weather Screening");
+
+ flow = FormElementSwitch.createInstance().setTitle("Presence of Flow").setSwitchTexts("Yes", "No");
+
+
+ odor = FormElementSwitch.createInstance().setTitle("Unusual Odor").setSwitchTexts("Yes", "No");
+
+
+ color = FormElementSwitch.createInstance().setTitle("Unusual Color").setSwitchTexts("Yes", "No");
+
+
+ polutants = FormElementSwitch.createInstance().setTitle("Polutants Nearby").setSwitchTexts("Yes", "No");
+
+
+ obstruction = FormElementSwitch.createInstance().setTitle("Obstruction").setSwitchTexts("Yes", "No");
+
+
+ maintenance = FormElementSwitch.createInstance().setTitle("Needs Maintenance").setSwitchTexts("Yes", "No");
+
+ screen = FormElementSwitch.createInstance().setTitle("Screen OK").setSwitchTexts("Yes", "No");
+
+
+ formItemsDWS = new ArrayList<>();
+
+ formItemsDWS.add(title);
+ formItemsDWS.add(flow);
+ formItemsDWS.add(odor);
+ formItemsDWS.add(color);
+ formItemsDWS.add(polutants);
+ formItemsDWS.add(obstruction);
+ formItemsDWS.add(maintenance);
+ formItemsDWS.add(screen);
+
+ fbDWS.addFormElements(formItemsDWS);
+ }
+ private void setupFormCT() {
+ boolct = true;
+ fbCT = new FormBuilder(getContext(), rvCT);
+
+
+ FormHeader title = (FormHeader) new FormHeader().setTitle("Chemical Testing");
+
+ temperature = new FormElementTextNumber().createInstance().setTitle("Temperature (C) Change").setValue("0");
+
+ tubidity = new FormElementTextNumber().createInstance().setTitle("Tubidity (NTU)").setValue("0");
+
+ pH = new FormElementTextNumber().createInstance().setTitle("pH").setValue("0");
+
+ nitrate = new FormElementTextNumber().createInstance().setTitle("Nitrate (mg/L)").setValue("0");
+
+ phosphate = new FormElementTextNumber().createInstance().setTitle("Total Phosphate (mg/L)").setValue("0");
+
+ oxygen = new FormElementTextNumber().createInstance().setTitle("Dissolved Oxygen (mg/L)").setValue("0");
+
+ coli = new FormElementTextNumber().createInstance().setTitle("E Coli (col/100mL)").setValue("0");
+
+
+ other1 = new FormElementTextSingleLine().createInstance().setTitle("Other 1").setValue("");
+
+
+ other2 = new FormElementTextSingleLine().createInstance().setTitle("Other 2").setValue("");
+
+ formItemsCT = new ArrayList<>();
+
+ formItemsCT.add(title);
+ formItemsCT.add(temperature);
+ formItemsCT.add(tubidity);
+ formItemsCT.add(pH);
+ formItemsCT.add(nitrate);
+ formItemsCT.add(phosphate);
+ formItemsCT.add(oxygen);
+ formItemsCT.add(coli);
+ formItemsCT.add(other1);
+ formItemsCT.add(other2);
+
+ fbCT.addFormElements(formItemsCT);
+ }
+ private void setupFormBM() {
+ boolbm = true;
+ fbBM = new FormBuilder(getContext(), rvBM);
+
+ intolerant = FormElementTextNumber.createInstance().setTitle("Intolerant").setValue("0");
+ moderatelyTolerant = FormElementTextNumber.createInstance().setTitle("Moderately Tolerant").setValue("0");
+ fairlyTolerant = FormElementTextNumber.createInstance().setTitle("Fairly Tolerant").setValue("0");
+ 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) {
+ if (s.compareTo("Yes") == 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayNav.java b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayNav.java
index fbfc264..2aa475b 100644
--- a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayNav.java
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayNav.java
@@ -13,8 +13,6 @@
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.firebase.auth.FirebaseAuth;
import com.sf.stormwaterutilityandroid.R;
-import com.sf.stormwaterutilityandroid.WaterWay.WaterWayReportFragment;
-import com.sf.stormwaterutilityandroid.WaterWay.WaterWayFormFragment;
public class WaterWayNav extends AppCompatActivity {
@@ -34,14 +32,16 @@ public class WaterWayNav extends AppCompatActivity {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
- case R.id.navigation_home:
+ case R.id.waterWayHome:
+ System.out.println("Print");
// mTextMessage.setText(R.string.title_home);
fm.beginTransaction().hide(active).show(fragment1).commit();
active = fragment1;
fm.popBackStack();
return true;
- case R.id.navigation_dashboard:
+ case R.id.waterWayReports:
+ System.out.println("Print");
// mTextMessage.setText(R.string.title_dashboard);
fm.beginTransaction().hide(active).show(fragment2).commit();
active = fragment2;
@@ -53,7 +53,6 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
return false;
}
};
-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -165,3 +164,8 @@ public boolean onOptionsItemSelected(MenuItem item) {
}
*/
}
+
+
+
+
+
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayReport.java b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayReport.java
new file mode 100644
index 0000000..5100e1b
--- /dev/null
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayReport.java
@@ -0,0 +1,112 @@
+package com.sf.stormwaterutilityandroid.WaterWay;
+
+import com.google.firebase.Timestamp;
+import com.google.firebase.firestore.FieldValue;
+import com.google.firebase.firestore.GeoPoint;
+import com.google.firebase.firestore.ServerTimestamp;
+
+import java.io.Serializable;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+public class WaterWayReport implements Serializable {
+ String H_date;
+ String H_inspector_name;
+ String H_site_name;
+ @ServerTimestamp Date timeStamp;
+ GeoPoint location;
+ Map boolFields = new HashMap<>();
+ Map doubleFields = new HashMap<>();
+ Map stringFields = new HashMap<>();
+
+ public WaterWayReport() {
+ }
+ public WaterWayReport(String h_date, String h_inspector_name, String h_site_name, Date sortTimeStamp, GeoPoint location, Map boolFields, Map doubleFields, Map stringFields) {
+ H_date = h_date;
+ H_inspector_name = h_inspector_name;
+ H_site_name = h_site_name;
+ timeStamp = sortTimeStamp;
+ this.location = location;
+ this.boolFields = boolFields;
+ this.doubleFields = doubleFields;
+ this.stringFields = stringFields;
+ }
+ public WaterWayReport(String h_date, String h_inspector_name, String h_site_name, Date sortTimeStamp, Map boolFields, Map doubleFields, Map stringFields) {
+ H_date = h_date;
+ H_inspector_name = h_inspector_name;
+ H_site_name = h_site_name;
+ timeStamp = sortTimeStamp;
+
+ this.boolFields = boolFields;
+ this.doubleFields = doubleFields;
+ this.stringFields = stringFields;
+ }
+
+ public Date getTimeStamp() {
+ return timeStamp;
+ }
+
+ public void setTimeStamp(Date timeStamp) {
+ this.timeStamp = timeStamp;
+ }
+
+
+
+ public String getH_date() {
+ return H_date;
+ }
+
+ public String getH_inspector_name() {
+ return H_inspector_name;
+ }
+
+ public String getH_site_name() {
+ return H_site_name;
+ }
+
+ public void setH_date(String h_date) {
+ H_date = h_date;
+ }
+
+ public void setH_inspector_name(String h_inspector_name) {
+ H_inspector_name = h_inspector_name;
+ }
+
+ public void setH_site_name(String h_site_name) {
+ H_site_name = h_site_name;
+ }
+
+ public GeoPoint getLocation() {
+ return location;
+ }
+
+ public void setLocation(GeoPoint location) {
+ this.location = location;
+ }
+
+ public Map getBoolFields() {
+ return boolFields;
+ }
+
+ public void setBoolFields(Map boolFields) {
+ this.boolFields = boolFields;
+ }
+
+ public Map getDoubleFields() {
+ return doubleFields;
+ }
+
+ public void setDoubleFields(Map doubleFields) {
+ this.doubleFields = doubleFields;
+ }
+
+ public Map getStringFields() {
+ return stringFields;
+ }
+
+ public void setStringFields(Map stringFields) {
+ this.stringFields = stringFields;
+ }
+}
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayReportFragment.java b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayReportFragment.java
index 150a98d..736023c 100644
--- a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayReportFragment.java
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayReportFragment.java
@@ -1,28 +1,204 @@
package com.sf.stormwaterutilityandroid.WaterWay;
+import android.content.Intent;
import android.os.Bundle;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.util.Log;
import android.view.LayoutInflater;
+import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.SearchView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
+import androidx.recyclerview.widget.DefaultItemAnimator;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.Task;
+import com.google.android.material.bottomnavigation.BottomNavigationView;
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.firestore.DocumentSnapshot;
+import com.google.firebase.firestore.EventListener;
+import com.google.firebase.firestore.FirebaseFirestore;
+import com.google.firebase.firestore.FirebaseFirestoreException;
+import com.google.firebase.firestore.Query;
+import com.google.firebase.firestore.QueryDocumentSnapshot;
+import com.google.firebase.firestore.QuerySnapshot;
+import com.sf.stormwaterutilityandroid.ConstructionReportAdapter;
+import com.sf.stormwaterutilityandroid.GraphPicker;
import com.sf.stormwaterutilityandroid.R;
+import com.sf.stormwaterutilityandroid.ReportAdapter;
+import com.sf.stormwaterutilityandroid.User;
+
+import org.w3c.dom.Document;
+
+import java.util.ArrayList;
+import java.util.List;
+
public class WaterWayReportFragment extends Fragment {
+ public WaterWayReportFragment() {
+ }
+
+ private EditText searchBar;//TODO: Make a search bar later?
+ private RecyclerView recyclerView;
+ private Button btnSiteName, btnDate, btnInspectorName, btnGraph;//TODO: ADDED BTNGRAPH. FINE?
+ List reportList;
+ ReportAdapter reportAdapter;
+ //TODO: Need vars for formdata
+
+ //TODO: Need a var for tvReports: UITableView!
+ // List reportList = new ArrayList<>();
+ //TODO: LayoutInflator inflater, ViewGroup container,Might not be needed
+ //This was a public void
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+
+ View view = inflater.inflate(R.layout.activity_reports, container, false);
+ // recyclerView = view.findViewById(R.id.recyclerView);
+ reportList = new ArrayList<>();
+ reportAdapter = new ReportAdapter(reportList);
+
+
+ btnSiteName = view.findViewById(R.id.btn_site_name);
+ btnDate = view.findViewById(R.id.btn_date);
+ btnInspectorName = view.findViewById(R.id.btn_inspector_name);
+ btnGraph = view.findViewById(R.id.btn_grapher);//TODO: ADDED. FINE?
+ searchBar = view.findViewById(R.id.searchView);
+ recyclerView = view.findViewById(R.id.recyclerView);
+
+ fetchData();
+searchBar.addTextChangedListener(new TextWatcher() {
- public View onCreateView(@NonNull LayoutInflater inflater,
- ViewGroup container, Bundle savedInstanceState) {
- View root = inflater.inflate(R.layout.fragment_dashboard, container, false);
- final TextView textView = root.findViewById(R.id.text_dashboard);
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- return root;
}
-}
\ No newline at end of file
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ if (s.toString().length() == 0) {
+ fetchData();
+ }
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+
+ }
+
+
+});
+
+ btnSiteName.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ //startActivity(new Intent(Reports.this, Site_name.class));
+ String txt = searchBar.getText().toString().trim();
+ if (txt.isEmpty() || txt ==null) {
+ return;
+ }
+ fetchFilteredDate(txt,"H_site_name");
+
+ }
+ });
+
+ btnDate.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String txt = searchBar.getText().toString().trim();
+ if (txt.isEmpty() || txt ==null) {
+ return;
+ }
+ fetchFilteredDate(txt,"H_date");
+ }
+ });
+
+ btnInspectorName.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String txt = searchBar.getText().toString().trim();
+ if (txt.isEmpty() || txt ==null) {
+ return;
+ }
+ fetchFilteredDate(txt,"H_inspector_name");
+ }
+ });
+
+ //TODO: ADDING THIS HERE. FINE?
+ btnGraph.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(getContext(), GraphPicker.class);//TODO: THIS IS WEIRD. IS IT OK?
+ startActivity(intent);
+ }
+ });
+
+ return view;
+
+
+
+ }
+
+ private void fetchFilteredDate(String txt, String searchField) {
+ FirebaseFirestore.getInstance().collection("Forms").document(User.agid).collection("Waterway").whereEqualTo(searchField,txt).get().addOnCompleteListener(new OnCompleteListener() {
+ @Override
+ public void onComplete(@NonNull Task task) {
+ reportList.clear();
+ if (task.isSuccessful() && task != null) {
+ for(QueryDocumentSnapshot document:task.getResult()) {
+ reportList.add(document.toObject(WaterWayReport.class));
+ }
+ reportAdapter.notifyDataSetChanged();
+ }
+ }
+ });
+
+
+ }
+
+ public void fetchData() {
+
+ FirebaseFirestore.getInstance().collection("Forms").document(User.agid).collection("Waterway").orderBy("SortTimeStamp", Query.Direction.DESCENDING).addSnapshotListener(new EventListener() {
+ @Override
+ public void onEvent(@javax.annotation.Nullable QuerySnapshot queryDocumentSnapshots, @javax.annotation.Nullable FirebaseFirestoreException e) {
+ if (e != null) {
+ Log.i("Error", "No data");
+ }
+ reportList.clear();
+ System.out.println("108:" +queryDocumentSnapshots.size());
+ for (DocumentSnapshot d:queryDocumentSnapshots){
+ //needs to be changed to waterway data type
+
+ reportList.add( d.toObject(WaterWayReport.class));
+ }
+ System.out.println(reportList.size());
+
+ reportAdapter.notifyDataSetChanged();
+ }
+ });
+ RecyclerView.LayoutManager layoutmanager = new LinearLayoutManager(getContext());
+ recyclerView.setLayoutManager(layoutmanager);
+ recyclerView.setItemAnimator(new DefaultItemAnimator());
+ recyclerView.setAdapter(reportAdapter);
+ }
+
+}
+
+
+
diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterwayReportDetail.java b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterwayReportDetail.java
new file mode 100644
index 0000000..4436094
--- /dev/null
+++ b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterwayReportDetail.java
@@ -0,0 +1,453 @@
+package com.sf.stormwaterutilityandroid;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.core.app.ActivityCompat;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.DefaultItemAnimator;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.graphics.Typeface;
+import android.graphics.pdf.PdfDocument;
+import android.os.Bundle;
+import android.os.Environment;
+import android.util.Log;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.ListView;
+import android.widget.Toast;
+
+import com.google.firebase.firestore.DocumentSnapshot;
+import com.google.firebase.firestore.EventListener;
+import com.google.firebase.firestore.FirebaseFirestore;
+import com.google.firebase.firestore.FirebaseFirestoreException;
+import com.google.firebase.firestore.Query;
+import com.google.firebase.firestore.QuerySnapshot;
+import com.sf.stormwaterutilityandroid.WaterWay.WaterWayReport;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WaterwayReportDetail extends AppCompatActivity {
+WaterWayReport wp;
+ArrayList s = new ArrayList<>();
+ListView listView;
+private Button btnExport;
+private static final int PERMISSION_REQUEST_CODE = 200;
+String [] keys = new String[] {"WQI","PTI","QHEI","H_inspector_name","H_site_name","H_date","GOD_outfall","GOD_longitude","GOD_latitude","GOD_invert_elevation","GOD_type","GOD_pipe_size","GOD_channel_bottom_width","GOD_receiving_water","DWS_presence_of_flow","DWS_unusual_odor","DWS_unusual_color","DWS_polutants","DWS_obstruction","DWS_needs_maintenance","DWS_screened_OK","FC_routine_evaluation","FC_complaint_investigation","FC_illicit_discharge_detected","FC_no_illicit_discharge_detected","FC_further_action_needed","CT_temperature_change","CT_turbidity","CT_pH","CT_nitrate","CT_total_phosphate","CT_dissolved_oxygen","CT_E_coli","CT_other1","CT_other2","BM_intolerant","BM_moderately_tolerant","BM_fairly_tolerant","BM_very_tolerant","HQ_substrate_size","HQ_smothering","HQ_silting","HQ_rootwads","HQ_overhanging_veg","HQ_oxbowsblack_waters","HQ_downed_treeslogs","HQ_shallows","HQ_water_plants","HQ_deep_pools","HQ_logswoody_debris","HQ_boulders","HQ_undercut_banks","HQ_sinuosity","HQ_natural","HQ_riparian_width","HQ_land_use","HQ_bank_erosion","HQ_stream_shading","HQ_deepest_pool","HQ_velocity","HQ_rifflerun_depth","HQ_rifflerun_substrate", "CS_comments"};
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_waterway_report_detail);
+ Log.d("TEST", "This is the page I'm looking for");
+ btnExport = findViewById(R.id.export_button);
+ if (checkPermission()) {
+ Toast.makeText(this, "Permission Granted", Toast.LENGTH_SHORT).show();
+ } else {
+ requestPermission();
+ }
+ wp = (WaterWayReport) getIntent().getSerializableExtra("report");
+ listView = findViewById(R.id.listView);
+ String[] labels =
+ {"Chemical (WQI): ",
+ "Biological (PTI): ",
+ "Habitat (QHEI): ",
+ "Name of Inspector: ",
+ "Name of Site: ",
+ "Date: ",
+ "Outfall #: ",
+ "Longitude: ",
+ "Latitude: ",
+ "Invert Elevation: ",
+ "Type: ",
+ "Pipe Size: ",
+ "Channel Bottom Width: ",
+ "Receiving Water: ",
+ "Presence Of Flow: ",
+ "Unusual Odor: ",
+ "Unusual Color: ",
+ "Polutants (nearby): ",
+ "Obstruction: ",
+ "Needs Mainenance: ",
+ "Screened Ok: ",
+ "Routine Evaluation: ",
+ "Complaint Investigation: ",
+ "Illicit Discharge Detected: ",
+ "No Illicit Discharge Detected: ",
+ "Further Action Needed: ",
+ "Temperature (C) Change: ",
+ "Turbidity (NTU): ",
+ "pH: ",
+ "Nitrate (mg/L): ",
+ "Total Phosphate (mg/L): ",
+ "Dissolved Oxygen (mg/L): ",
+ "E coli (Col/100ml): ",
+ "Other 1: ",
+ "Other 2: ",
+ "Intolerant: ",
+ "Moderately Tolerant: ",
+ "Fairly Tolerant: ",
+ "Very Tolerant: ",
+ "Substrate Size: ",
+ "Smothering: ",
+ "Silting: ",
+ "Rootwads: ",
+ "Overhanging Veg.: ",
+ "Oxbows/Black Water: ",
+ "Downed Trees/Logs: ",
+ "Shallows (in slow water): ",
+ "Water Plants: ",
+ "Deep Pools: ",
+ "Logs/Woody Debris: ",
+ "Boulders: ",
+ "Undercut Banks: ",
+ "Sinuosity: ",
+ "Natural: ",
+ "Riparian Width: ",
+ "Land Use: ",
+ "Bank Erosion: ",
+ "Stream Shading: ",
+ "Deepest Pool: ",
+ "Velocity: ",
+ "Riffle/Run Depth: ",
+ "Riffle/Run Substrate: ",
+ "Comments: "};
+ s.add( labels[0]+wp.getDoubleFields().get("WQI"));
+ s.add( labels[1]+wp.getDoubleFields().get("PTI"));
+ s.add( labels[2]+wp.getDoubleFields().get("QHEI"));
+ s.add( labels[3]+wp.getH_inspector_name());
+ s.add( labels[4]+wp.getH_site_name());
+ s.add( labels[5]+wp.getH_date());
+ s.add( labels[6]+wp.getDoubleFields().get("GOD_longitude"));
+ s.add(labels[7]+wp.getDoubleFields().get("GOD_latitude"));
+ s.add(labels[8]+wp.getDoubleFields().get("GOD_invert_elevation"));
+ s.add(labels[9] + wp.getDoubleFields().get("GOD_type"));
+ s.add(labels[10] + wp.getDoubleFields().get("GOD_pipe_size"));
+ s.add(labels[11] + wp.getDoubleFields().get("GOD_channel_bottom_width"));
+ s.add(labels[12] + wp.getDoubleFields().get("GOD_receiving_water"));
+ s.add(labels[13] + wp.getBoolFields().get("DWS_presence_of_flow"));
+ s.add(labels[14] + wp.getBoolFields().get("DWS_unusual_odor"));
+ s.add(labels[15] + wp.getBoolFields().get("DWS_unusual_color"));
+ s.add(labels[16] + wp.getBoolFields().get("DWS_polutants"));
+ s.add(labels[17] + wp.getBoolFields().get("DWS_polutants"));
+ s.add(labels[18] + wp.getBoolFields().get("DWS_obstruction"));
+ s.add(labels[19] + wp.getBoolFields().get("DWS_needs_maintenance"));
+ s.add(labels[20] + wp.getBoolFields().get("DWS_screened_OK"));
+ s.add(labels[21] + wp.getBoolFields().get("FC_routine_evaluation"));
+ s.add(labels[22] + wp.getBoolFields().get( "FC_complaint_investigation"));
+ s.add(labels[23] + wp.getBoolFields().get("FC_illicit_discharge_detected"));
+ s.add(labels[24] + wp.getBoolFields().get("FC_no_illicit_discharge_detected"));
+ s.add(labels[25] + wp.getBoolFields().get("FC_further_action_needed"));
+ s.add(labels[26] + wp.getDoubleFields().get("CT_temperature_change"));
+ s.add(labels[27] + wp.getDoubleFields().get("CT_turbidity"));
+ s.add(labels[28] + wp.getDoubleFields().get("CT_pH"));
+ s.add(labels[29] + wp.getDoubleFields().get("CT_nitrate"));
+ s.add(labels[30] + wp.getDoubleFields().get("CT_total_phosphate"));
+ s.add(labels[31] + wp.getDoubleFields().get("CT_dissolved_oxygen"));
+ s.add(labels[32] + wp.getDoubleFields().get("CT_E_coli"));
+ s.add(labels[33] + wp.getDoubleFields().get("FC_further_action_needed"));
+ s.add(labels[34]+wp.getStringFields().get("CT_other_1"));
+ s.add(labels[35]+wp.getStringFields().get("CT_other_2"));
+ s.add(labels[36]+ wp.getDoubleFields().get("BM_intolerant"));
+ s.add(labels[37] + wp.getStringFields().get("BM_moderately_tolerant"));
+ s.add(labels[38] + wp.getStringFields().get("BM_fairly_tolerant"));
+ s.add(labels[39] + wp.getStringFields().get("BM_very_tolerant"));
+ s.add(labels[40] + wp.getStringFields().get("QHEI_substrate_size"));
+ s.add(labels[41] + wp.getStringFields().get("QHEI_smothering"));
+ s.add(labels[42] + wp.getStringFields().get("QHEI_silting"));
+ s.add(labels[43] + wp.getStringFields().get("QHEI_rootwads"));
+ s.add(labels[44] + wp.getStringFields().get("QHEI_overhanging_veg"));
+ s.add(labels[45] + wp.getStringFields().get("QHEI_oxbowsblack_waters"));
+ s.add(labels[46] + wp.getStringFields().get("QHEI_downed_treeslogs"));
+ s.add(labels[47] + wp.getStringFields().get("QHEI_shallows"));
+ s.add(labels[48] + wp.getStringFields().get("QHEI_water_plants"));
+ s.add(labels[49] + wp.getStringFields().get("QHEI_deep_pools"));
+ s.add(labels[50] + wp.getStringFields().get("QHEI_logswoody_debris"));
+ s.add(labels[51] + wp.getStringFields().get("QHEI_boulders"));
+ s.add(labels[52] + wp.getStringFields().get("QHEI_undercut_banks"));
+ s.add(labels[53] + wp.getStringFields().get("QHEI_sinuosity"));
+ s.add(labels[54] + wp.getStringFields().get("QHEI_riparian_width"));
+ s.add(labels[55] + wp.getStringFields().get("QHEI_land_use"));
+ s.add(labels[56] + wp.getStringFields().get("QHEI_bank_erosion"));
+ s.add(labels[57] + wp.getStringFields().get("QHEI_stream_shading"));
+ s.add(labels[58] + wp.getStringFields().get("QHEI_deepest_pool"));
+ s.add(labels[59] + wp.getStringFields().get("QHEI_velocity"));
+ s.add(labels[60] + wp.getStringFields().get("QHEI_rifflerun_depth"));
+ s.add(labels[61] + wp.getStringFields().get("QHEI_rifflerun_substrate"));
+ s.add(labels[62] + wp.getStringFields().get("CS_comments"));
+ ArrayAdapter adapter = new ArrayAdapter(this,
+ android.R.layout.simple_list_item_1, android.R.id.text1, s);
+
+
+ // Assign adapter to ListView
+ listView.setAdapter(adapter);
+
+ btnExport.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ createPDF(labels, wp);
+ }
+ });
+ }
+
+ public void createPDF(String[] labels, WaterWayReport wp) {
+ //Create new doc
+ PdfDocument document = new PdfDocument();
+
+ Paint title = new Paint();//for text
+
+ //Create page description
+ PdfDocument.PageInfo pageInfo = new PdfDocument.PageInfo.Builder((int) (8.5 * 72),11 * 72,1).create();
+
+ //Start page
+ PdfDocument.Page page = document.startPage(pageInfo);
+
+ Canvas canvas = page.getCanvas();
+
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));//Bold text
+ title.setTextSize(18);//John used size 18
+ //title.setColor(ContextCompat.getColor(this, R.color.purple_200));
+ //String header = "Water Quality Test";
+ Log.d("test", Float.toString(title.measureText("Water Quality Test")));
+ canvas.drawText("Water Quality Test", (float) (((8.5*72)-title.measureText("Water Quality Test"))/2), 36, title);
+
+
+ //TODO: GET RID OF THIS AFTER TESTING
+ //canvas.drawText("This is a test.", 20, 20, title);
+ title.setTextSize(12);//15);//TODO: SHOULD I CHANGE THIS?
+
+ writeToCanvas(canvas, title, labels, wp);
+ //Write the document content
+ document.finishPage(page);
+
+ //File naming convention: inspector _ site name _ date
+ String fileName = String.valueOf(wp.getH_inspector_name()) + "_" + String.valueOf(wp.getH_site_name()) + "_" + String.valueOf(wp.getH_date()) + ".pdf";
+
+ File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), fileName);// + "/Test", fileName);//"Test.pdf");
+ if (!file.exists()) {
+ Log.d("pdf", "DOESN'T EXIST");
+ file.getParentFile().mkdirs();
+ }
+ if (file.exists()) {
+ Log.d("pdf", "EXISTS NOW");
+ }
+
+
+ try {
+ //write pdf ot file location
+ document.writeTo(new FileOutputStream(file));
+ Toast.makeText(WaterwayReportDetail.this, "PDF file generated succesfully.", Toast.LENGTH_SHORT).show();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ document.close();
+ }
+
+ private boolean checkPermission() {
+ if (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
+ if (checkSelfPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
+ Log.v("pdf","Permission is granted");
+ //File write logic here
+ return true;
+ }
+ }
+ return false;//if it doesn't return true, it'll return false
+ }
+
+ private void requestPermission() {
+ // requesting permissions if not provided.
+ ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE,android.Manifest.permission.READ_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
+ }
+ @Override
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ if (requestCode == PERMISSION_REQUEST_CODE) {
+ if (grantResults.length > 0) {
+ // after requesting permissions we are showing
+ // users a toast message of permission granted.
+ boolean writeStorage = grantResults[0] == PackageManager.PERMISSION_GRANTED;
+ boolean readStorage = grantResults[1] == PackageManager.PERMISSION_GRANTED;
+
+ if (writeStorage && readStorage) {
+ Toast.makeText(this, "Permission Granted..", Toast.LENGTH_SHORT).show();
+ } else {
+ Toast.makeText(this, "Permission Denined.", Toast.LENGTH_SHORT).show();
+ finish();
+ }
+ }
+ }
+ }
+
+ public void writeToCanvas(Canvas canvas, Paint title, String[] labels, WaterWayReport wp) {
+ int currHi = 36 + 20;//getHeight(title, "Water Quality Test");
+ Log.d("finish", String.valueOf(getHeight(title, "Water Quality Test")));
+ int currWi = 20;
+ int holdHi = 0;
+ for (int i = 0; i <= 2; i++) {
+ //Log.d("test", labels[i]);
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ canvas.drawText(labels[i], currWi, currHi, title);
+ //title.measureText
+ currWi += title.measureText(labels[i]);
+ title.setColor(ContextCompat.getColor(this, R.color.red));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ canvas.drawText(String.valueOf(wp.getDoubleFields().get(keys[i])), currWi, currHi, title);
+ currWi += (int) title.measureText(String.valueOf(wp.getDoubleFields().get(keys[i]))) + 20;
+ }
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ currHi += 16;//getHeight(title, labels[0]);//TODO: IS this ok?
+ for (int i=3; i<=5; i++) {
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ canvas.drawText(labels[i], 20, currHi, title);
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ canvas.drawText(String.valueOf(wp.getStringFields().get(keys[i])), 20 + title.measureText(labels[i]), currHi, title);
+ currHi += 16;//getHeight(title, labels[i]);
+ }
+ canvas.drawText("--------------------------------------------------------------------------------------------------------------------------------------------", 20, currHi, title);
+ currHi += 14;//getHeight(title, "---");//TODO: MAYBE CHANGE
+ holdHi = currHi;
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setTextSize(14);
+ canvas.drawText("General Outfall Data", 20, currHi,title);
+ currHi += 16;//getHeight(title, "General Outfall Data");
+ title.setTextSize(12);
+ for (int i=6; i<=13; i++) {
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ canvas.drawText(labels[i], 20, currHi, title);
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ canvas.drawText(String.valueOf(wp.getStringFields().get(keys[i])), 20 + title.measureText(labels[i]), currHi, title);
+ currHi += 16;//getHeight(title, labels[i]);
+ }
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setTextSize(14);
+ canvas.drawText("Dry Weather Screening", 20, currHi,title);
+ currHi += 16;//getHeight(title, "Dry Weather Screening");
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ title.setTextSize(12);
+ for (int i=14; i<=20; i++) {
+ if (wp.getBoolFields().get(keys[i]) == true) {
+ canvas.drawText("\u2611", 20, currHi, title);//checkbox
+ canvas.drawText(labels[i], 20 + title.measureText("\u2611"), currHi, title);
+ }
+ else {
+ canvas.drawText("\u25A2", 20, currHi, title);//Unchecked box
+ canvas.drawText(labels[i], 20 + title.measureText("\u25A2"), currHi, title);
+ }
+ currHi += 16;//getHeight(title, String.valueOf(wp.getBoolFields().get(keys[i])));
+ }
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setTextSize(14);
+ canvas.drawText("Final Conclusion", 20, currHi,title);
+ currHi += 16;//getHeight(title, "Final Conclusion");
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ title.setTextSize(12);
+ for (int i=21; i<=25; i++) {
+ if (wp.getBoolFields().get(keys[i]) == true) {
+ canvas.drawText("\u2611", 20, currHi, title);//checkbox
+ canvas.drawText(labels[i], 20 + title.measureText("\u2611"), currHi, title);
+ }
+ else {
+ canvas.drawText("\u25A2", 20, currHi, title);//Unchecked box
+ canvas.drawText(labels[i], 20 + title.measureText("\u25A2"), currHi, title);
+ }
+ currHi += 16;//getHeight(title, String.valueOf(wp.getBoolFields().get(keys[i])));
+ }
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setTextSize(14);
+ canvas.drawText("Chemical Testing (Q-Values)", 20, currHi,title);
+ currHi += 16;//getHeight(title, "Chemical Testing (Q-Values)");
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTextSize(12);
+ for (int i=26; i<=32; i++) {
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ canvas.drawText(labels[i], 20, currHi, title);
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ canvas.drawText(String.valueOf(wp.getDoubleFields().get(keys[i])), 20 + title.measureText(labels[i]), currHi, title);
+ currHi += 16;//getHeight(title, labels[i]);
+ }
+ for (int i=33; i<=34; i++) {
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ canvas.drawText(labels[i], 20, currHi, title);
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ canvas.drawText(String.valueOf(wp.getStringFields().get(keys[i])), 20 + title.measureText(labels[i]), currHi, title);
+ currHi += 16;//getHeight(title, labels[i]);
+ }
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setTextSize(14);
+ currWi = (int)(8.5 * 72) / 2;
+ currHi = holdHi;
+ canvas.drawText("Biological Monitoring (# of Taxa)", currWi, currHi,title);
+ currHi += 16;
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTextSize(12);
+ for (int i=35; i<=38; i++) {
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ canvas.drawText(labels[i], currWi, currHi, title);
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ canvas.drawText(String.valueOf(wp.getDoubleFields().get(keys[i])), currWi + title.measureText(labels[i]), currHi, title);
+ currHi += 16;
+ }
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setTextSize(14);
+ canvas.drawText("Habitat Quality", currWi, currHi, title);
+ currHi += 16;
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTextSize(12);
+ for (int i=39; i<=61; i++) {
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ canvas.drawText(labels[i], currWi, currHi, title);
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
+ title.setColor(ContextCompat.getColor(this, R.color.gray));
+ canvas.drawText(String.valueOf(wp.getStringFields().get(keys[i])), currWi + title.measureText(labels[i]), currHi, title);
+ currHi += 16;
+ }
+ title.setColor(ContextCompat.getColor(this, R.color.black));
+ title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
+ title.setTextSize(14);
+ canvas.drawText("Comments", currWi, currHi, title);
+ }
+
+ public int getWidth(Paint title, String text) {
+ return (int) title.measureText(text);
+ }
+ public int getHeight(Paint title, String text) {
+ Rect bounds = new Rect();
+ title.getTextBounds("Water Quality Test", 0, "Water Quality Test".length(), bounds);
+ Log.d("test", String.valueOf(bounds.height()));
+ return bounds.height();
+ }
+}
diff --git a/app/src/main/res/drawable/construction.png b/app/src/main/res/drawable/construction.png
new file mode 100644
index 0000000..62c9edb
Binary files /dev/null and b/app/src/main/res/drawable/construction.png differ
diff --git a/app/src/main/res/drawable/construction2.png b/app/src/main/res/drawable/construction2.png
new file mode 100644
index 0000000..6f9402b
Binary files /dev/null and b/app/src/main/res/drawable/construction2.png differ
diff --git a/app/src/main/res/drawable/settings.png b/app/src/main/res/drawable/settings.png
new file mode 100644
index 0000000..e9500e0
Binary files /dev/null and b/app/src/main/res/drawable/settings.png differ
diff --git a/app/src/main/res/drawable/settings2.png b/app/src/main/res/drawable/settings2.png
new file mode 100644
index 0000000..5b99d80
Binary files /dev/null and b/app/src/main/res/drawable/settings2.png differ
diff --git a/app/src/main/res/drawable/settings3.png b/app/src/main/res/drawable/settings3.png
new file mode 100644
index 0000000..ddb40d4
Binary files /dev/null and b/app/src/main/res/drawable/settings3.png differ
diff --git a/app/src/main/res/drawable/water.png b/app/src/main/res/drawable/water.png
new file mode 100644
index 0000000..9280884
Binary files /dev/null and b/app/src/main/res/drawable/water.png differ
diff --git a/app/src/main/res/layout/activity_graph.xml b/app/src/main/res/layout/activity_graph.xml
new file mode 100644
index 0000000..c78c5cc
--- /dev/null
+++ b/app/src/main/res/layout/activity_graph.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml
index 61b3328..904aa6e 100644
--- a/app/src/main/res/layout/activity_login.xml
+++ b/app/src/main/res/layout/activity_login.xml
@@ -16,8 +16,10 @@
android:padding="@dimen/activity_horizontal_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent">
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="1.0">
+ android:textColor="@android:color/white" />
+ android:textColor="@android:color/white"
+ />
@@ -86,18 +90,14 @@
android:textColor="@android:color/white"
android:textSize="15dp"
tools:ignore="SpUsage" />
-
-
+
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 7c509bc..6a8db70 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -43,6 +43,6 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
- app:menu="@menu/bottom_nav_menu" />
+ app:menu="@menu/waterway_menu" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_menu2.xml b/app/src/main/res/layout/activity_menu2.xml
new file mode 100644
index 0000000..b034775
--- /dev/null
+++ b/app/src/main/res/layout/activity_menu2.xml
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_pdf.xml b/app/src/main/res/layout/activity_pdf.xml
new file mode 100644
index 0000000..61a4490
--- /dev/null
+++ b/app/src/main/res/layout/activity_pdf.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_pick_graph.xml b/app/src/main/res/layout/activity_pick_graph.xml
new file mode 100644
index 0000000..3a8162e
--- /dev/null
+++ b/app/src/main/res/layout/activity_pick_graph.xml
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_reports.xml b/app/src/main/res/layout/activity_reports.xml
new file mode 100644
index 0000000..0a39c25
--- /dev/null
+++ b/app/src/main/res/layout/activity_reports.xml
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_reset_password.xml b/app/src/main/res/layout/activity_reset_password.xml
index 211baa5..2f05b67 100644
--- a/app/src/main/res/layout/activity_reset_password.xml
+++ b/app/src/main/res/layout/activity_reset_password.xml
@@ -69,7 +69,7 @@
android:layout_marginTop="20dip"
android:background="@color/colorAccent"
android:text="@string/btn_reset_password"
- android:textColor="@android:color/black" />
+ android:textColor="@color/White" />
+ android:textColor="@color/White" />
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index 41a0c41..3f58d1c 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -6,4 +6,55 @@
android:layout_height="match_parent"
tools:context=".Settings">
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_sign_up.xml b/app/src/main/res/layout/activity_sign_up.xml
index ff22e10..8524baa 100644
--- a/app/src/main/res/layout/activity_sign_up.xml
+++ b/app/src/main/res/layout/activity_sign_up.xml
@@ -26,8 +26,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="30dp"
- android:src="@drawable/ic_launcher_background"
- />
+ android:src="@drawable/ic_launcher_background" />
-
-
-
-
+ android:textColor="@android:color/white"
-
+ android:textColorHint="@color/white" />
+ android:textColor="@android:color/white"
+ android:textColorHint="@color/white" />
-
+ android:textColor="@android:color/white"
+ android:textColorHint="@color/white" />
-
-
-
-
+ android:id="@+id/progressBar2"
+ style="?android:attr/progressBarStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center" />
+
diff --git a/app/src/main/res/layout/activity_waterway_report_detail.xml b/app/src/main/res/layout/activity_waterway_report_detail.xml
new file mode 100644
index 0000000..c6a4af6
--- /dev/null
+++ b/app/src/main/res/layout/activity_waterway_report_detail.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/cardview_reports.xml b/app/src/main/res/layout/cardview_reports.xml
new file mode 100644
index 0000000..edda339
--- /dev/null
+++ b/app/src/main/res/layout/cardview_reports.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/fragment_wwform.xml b/app/src/main/res/layout/fragment_wwform.xml
index f3062b4..0df8324 100644
--- a/app/src/main/res/layout/fragment_wwform.xml
+++ b/app/src/main/res/layout/fragment_wwform.xml
@@ -1,14 +1,163 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ app:layout_constraintBottom_toTopOf="@+id/submitForm"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/buttonGroup_vectorDrawable" />
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/waterway_menu.xml b/app/src/main/res/menu/waterway_menu.xml
new file mode 100644
index 0000000..97a3a2d
--- /dev/null
+++ b/app/src/main/res/menu/waterway_menu.xml
@@ -0,0 +1,12 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 6fde8eb..46c9cf6 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -10,4 +10,485 @@
#6200EE
#3700B3
#03DAC5
+
+
+
+
+ -- http://www.google.com/design/spec/style/color.html#color-color-palette -->
+
+
+ #FFEBEE
+ #FFCDD2
+ #EF9A9A
+ #E57373
+ #EF5350
+ #F44336
+ #E53935
+ #D32F2F
+ #C62828
+ #B71C1C
+ #FF8A80
+ #FF5252
+ #FF1744
+ #D50000
+
+
+
+
+ #FCE4EC
+ #F8BBD0
+ #F48FB1
+ #F06292
+ #EC407A
+ #E91E63
+ #D81B60
+ #C2185B
+ #AD1457
+ #880E4F
+ #FF80AB
+ #FF4081
+ #F50057
+ #C51162
+
+
+
+ #F3E5F5
+ #E1BEE7
+
+ #BA68C8
+ #AB47BC
+
+ #8E24AA
+
+ #6A1B9A
+ #4A148C
+ #EA80FC
+ #E040FB
+ #D500F9
+ #AA00FF
+
+
+
+ #EDE7F6
+ #D1C4E9
+ #B39DDB
+ #9575CD
+ #7E57C2
+ #673AB7
+ #5E35B1
+ #512DA8
+ #4527A0
+ #311B92
+ #B388FF
+ #7C4DFF
+ #651FFF
+ #6200EA
+
+
+
+ #E8EAF6
+ #C5CAE9
+ #9FA8DA
+ #7986CB
+ #5C6BC0
+ #3F51B5
+ #3949AB
+ #303F9F
+ #283593
+ #1A237E
+ #8C9EFF
+ #536DFE
+ #3D5AFE
+ #304FFE
+
+
+
+ #E3F2FD
+ #BBDEFB
+ #90CAF9
+ #64B5F6
+ #42A5F5
+ #2196F3
+ #1E88E5
+ #1976D2
+ #1565C0
+ #0D47A1
+ #82B1FF
+ #448AFF
+ #2979FF
+ #2962FF
+
+
+
+ #E1F5FE
+ #B3E5FC
+ #81D4FA
+ #4FC3F7
+ #29B6F6
+ #03A9F4
+ #039BE5
+ #0288D1
+ #0277BD
+ #01579B
+ #80D8FF
+ #40C4FF
+ #00B0FF
+ #0091EA
+
+
+
+ #E0F7FA
+ #B2EBF2
+ #80DEEA
+ #4DD0E1
+ #26C6DA
+ #00BCD4
+ #00ACC1
+ #0097A7
+ #00838F
+ #006064
+ #84FFFF
+ #18FFFF
+ #00E5FF
+ #00B8D4
+
+
+
+ #aab2dfdb
+
+ #E0F2F1
+ #B2DFDB
+
+ #4DB6AC
+ #26A69A
+ #009688
+ #00897B
+
+ #00695C
+ #004D40
+ #A7FFEB
+ #64FFDA
+ #1DE9B6
+ #00BFA5
+
+
+
+ #E8F5E9
+ #C8E6C9
+ #A5D6A7
+ #81C784
+ #66BB6A
+ #4CAF50
+ #43A047
+ #388E3C
+ #2E7D32
+ #1B5E20
+ #B9F6CA
+ #69F0AE
+ #00E676
+ #00C853
+
+
+
+ #F1F8E9
+ #DCEDC8
+ #C5E1A5
+ #AED581
+ #9CCC65
+ #8BC34A
+ #7CB342
+ #689F38
+ #558B2F
+ #33691E
+ #CCFF90
+ #B2FF59
+ #76FF03
+ #64DD17
+
+
+
+ #F9FBE7
+ #F0F4C3
+ #E6EE9C
+ #DCE775
+ #D4E157
+ #CDDC39
+ #C0CA33
+ #AFB42B
+ #9E9D24
+ #827717
+ #F4FF81
+ #EEFF41
+ #C6FF00
+ #AEEA00
+
+
+
+ #FFFDE7
+ #FFF9C4
+ #FFF59D
+ #FFF176
+ #FFEE58
+ #FFEB3B
+ #FDD835
+ #FBC02D
+ #F9A825
+ #F57F17
+ #FFFF8D
+ #FFFF00
+ #FFEA00
+ #FFD600
+
+
+
+ #FFF8E1
+ #FFECB3
+ #FFE082
+ #FFD54F
+ #FFCA28
+ #FFC107
+ #FFB300
+ #FFA000
+ #FF8F00
+ #FF6F00
+ #FFE57F
+ #FFD740
+ #FFC400
+ #FFAB00
+
+
+
+ #FFF3E0
+ #FFE0B2
+ #FFCC80
+ #FFB74D
+ #FFA726
+ #FF9800
+ #FB8C00
+ #F57C00
+ #EF6C00
+ #E65100
+ #FFD180
+ #FFAB40
+ #FF9100
+ #FF6D00
+
+
+
+ #FBE9E7
+ #FFCCBC
+ #FFAB91
+ #FF8A65
+ #FF7043
+ #FF5722
+ #F4511E
+ #E64A19
+ #D84315
+ #BF360C
+ #FF9E80
+ #FF6E40
+ #FF3D00
+ #DD2C00
+
+
+
+ #EFEBE9
+ #D7CCC8
+ #BCAAA4
+ #A1887F
+ #8D6E63
+ #795548
+ #6D4C41
+ #5D4037
+ #4E342E
+ #3E2723
+
+
+
+ #FAFAFA
+ #F5F5F5
+ #EEEEEE
+ #E0E0E0
+ #BDBDBD
+ #9E9E9E
+ #757575
+ #616161
+ #424242
+ #212121
+
+ #aa9e9e9e
+
+
+
+
+ #ECEFF1
+ #CFD8DC
+ #B0BEC5
+ #90A4AE
+ #78909C
+ #607D8B
+ #546E7A
+ #455A64
+ #37474F
+ #263238
+
+
+
+
+ #FFFF00
+ #FF00FF
+ #FF0000
+ #C0C0C0
+ #808080
+ #808000
+ #800080
+ #800000
+ #00FFFF
+ #00FF00
+ #008080
+ #008000
+ #0000FF
+ #000080
+ #FFFFFF
+ #FFFFF0
+ #FFFFE0
+ #FFFF00
+ #FFFAFA
+ #FFFAF0
+ #FFFACD
+ #FFF8DC
+ #FFF5EE
+ #FFF0F5
+ #FFEFD5
+ #FFEBCD
+ #FFE4E1
+ #FFE4C4
+ #FFE4B5
+ #FFDEAD
+ #FFDAB9
+ #FFD700
+ #FFC0CB
+ #FFB6C1
+ #FFA500
+ #FFA07A
+ #FF8C00
+ #FF7F50
+ #FF69B4
+ #FF6347
+ #FF4500
+ #FF1493
+ #FF00FF
+ #FF00FF
+ #FF0000
+ #FDF5E6
+ #FAFAD2
+ #FAF0E6
+ #FAEBD7
+ #FA8072
+ #F8F8FF
+ #F5FFFA
+ #F5F5F5
+ #F5F5DC
+ #F5DEB3
+ #F4A460
+ #F0FFFF
+ #F0FFF0
+ #F0F8FF
+ #F0E68C
+ #F08080
+ #EEE8AA
+ #EE82EE
+ #E9967A
+ #E6E6FA
+ #E0FFFF
+ #DEB887
+ #DDA0DD
+ #DCDCDC
+ #DC143C
+ #DB7093
+ #DAA520
+ #DA70D6
+ #D8BFD8
+ #D3D3D3
+ #D2B48C
+ #D2691E
+ #CD853F
+ #CD5C5C
+ #C71585
+ #C0C0C0
+ #BDB76B
+ #BC8F8F
+ #BA55D3
+ #B8860B
+ #B22222
+ #B0E0E6
+ #B0C4DE
+ #AFEEEE
+ #ADFF2F
+ #ADD8E6
+ #A9A9A9
+ #A52A2A
+ #A0522D
+ #9ACD32
+ #9932CC
+ #98FB98
+ #9400D3
+ #9370DB
+ #90EE90
+ #8FBC8F
+ #8B4513
+ #8B008B
+ #8B0000
+ #8A2BE2
+ #87CEFA
+ #87CEEB
+ #808080
+ #808000
+ #800080
+ #800000
+ #7FFFD4
+ #7FFF00
+ #7CFC00
+ #7B68EE
+ #4B0082
+ #778899
+ #708090
+ #6B8E23
+ #6A5ACD
+ #696969
+ #66CDAA
+ #6495ED
+ #5F9EA0
+ #556B2F
+ #48D1CC
+ #483D8B
+ #4682B4
+ #4169E1
+ #40E0D0
+ #3CB371
+ #32CD32
+ #2F4F4F
+ #2E8B57
+ #228B22
+ #20B2AA
+ #1E90FF
+ #191970
+ #00FFFF
+ #00FFFF
+ #00FF7F
+ #00FF00
+ #00FA9A
+ #00CED1
+ #00BFFF
+ #008B8B
+ #008080
+ #008000
+ #006400
+ #0000FF
+ #0000CD
+ #00008B
+ #000080
+ #000000
+ #0000A0
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 1de4043..9eb0df3 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,15 +1,20 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
+
google()
jcenter()
}
dependencies {
+
+
classpath 'com.google.gms:google-services:4.3.5'
- classpath 'com.android.tools.build:gradle:4.1.2'
+ classpath 'com.android.tools.build:gradle:4.1.3'
+
+
// NOTE: Do not place your application dependencies here; they belong
@@ -19,8 +24,12 @@ buildscript {
allprojects {
repositories {
+ maven { url "https://jitpack.io" }
google()
jcenter()
+ //Added this:
+ maven { url 'https://jitpack.io' }
+ //Done adding
}
}