-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Samuelford24
authored and
Samuelford24
committed
Mar 16, 2021
1 parent
42a967f
commit b4b66bd
Showing
18 changed files
with
965 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'com.google.gms.google-services' | ||
} | ||
|
||
android { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
97 changes: 92 additions & 5 deletions
97
...c/main/java/com/sf/stormwaterutilityandroid/Construction/ConstructionReportsFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,112 @@ | ||
package com.sf.stormwaterutilityandroid.Construction; | ||
|
||
import android.os.Bundle; | ||
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.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.ConstructionFormData; | ||
import com.sf.stormwaterutilityandroid.ConstructionReportAdapter; | ||
import com.sf.stormwaterutilityandroid.R; | ||
|
||
|
||
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<ConstructionFormData> 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); | ||
|
||
|
||
|
||
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(); | ||
|
||
btnSiteName.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
//startActivity(new Intent(Reports.this, Site_name.class)); | ||
|
||
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; | ||
} | ||
}); | ||
|
||
btnDate.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
//startActivity(new Intent(Reports.this, Date.class)); | ||
} | ||
}); | ||
|
||
btnInspectorName.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
//startActivity(new Intent(Reports.this, Inspector_name.class)); | ||
} | ||
}); | ||
|
||
return view; | ||
|
||
|
||
|
||
} | ||
public void fetchData() { | ||
final ConstructionReportAdapter reporter = new ConstructionReportAdapter(reportList); | ||
FirebaseFirestore.getInstance().collection("ConstructionForms").orderBy("SortTimeStamp", Query.Direction.DESCENDING).addSnapshotListener(new EventListener<QuerySnapshot>() { | ||
@Override | ||
public void onEvent(@javax.annotation.Nullable QuerySnapshot queryDocumentSnapshots, @javax.annotation.Nullable FirebaseFirestoreException e) { | ||
if (e != null) { | ||
Log.i("Error", "No data"); | ||
} | ||
reportList.clear(); | ||
for (DocumentSnapshot d:queryDocumentSnapshots){ | ||
//needs to be changed to waterway data type | ||
reportList.add( d.toObject(ConstructionFormData.class)); | ||
} | ||
|
||
reporter.notifyDataSetChanged(); | ||
} | ||
}); | ||
RecyclerView.LayoutManager layoutmanager = new LinearLayoutManager(getContext()); | ||
recyclerView.setLayoutManager(layoutmanager); | ||
recyclerView.setItemAnimator(new DefaultItemAnimator()); | ||
recyclerView.setAdapter(reporter); | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
app/src/main/java/com/sf/stormwaterutilityandroid/ConstructionFormData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.sf.stormwaterutilityandroid; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class ConstructionFormData { | ||
private Map<String, Object> data; | ||
// String contact | ||
// String date | ||
// String inspector | ||
// String location | ||
|
||
// (they are lists because firebase doesn't serialize arrays) | ||
// List<String> answers | ||
// List<String> imgLink | ||
|
||
public ConstructionFormData(String contact, String date, String inspector, | ||
String location, List<String> answers, List<String> imgLink) { | ||
data = new HashMap<>(); | ||
data.put("contact", contact); | ||
data.put("date", date); | ||
data.put("inspector", inspector); | ||
data.put("location", location); | ||
data.put("answers", answers); | ||
data.put("imgLink", imgLink); | ||
} | ||
|
||
public Map<String, Object> getMap() { | ||
return data; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ConstructionFormData{" + | ||
"data=" + data + | ||
'}'; | ||
} | ||
|
||
} |
61 changes: 61 additions & 0 deletions
61
app/src/main/java/com/sf/stormwaterutilityandroid/ConstructionReportAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<ConstructionReportAdapter.MyHolder>{ | ||
//needs changed to waterway | ||
List<ConstructionFormData> listdata; | ||
|
||
public ConstructionReportAdapter(List<ConstructionFormData> 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.getInspectorName()); | ||
// holder.site.setText(data.getSite()); | ||
// holder.date.setText((CharSequence) 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); | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
app/src/main/java/com/sf/stormwaterutilityandroid/HEI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
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; | ||
} | ||
|
||
} |
Oops, something went wrong.