-
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
Showing
42 changed files
with
2,215 additions
and
199 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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" | ||
} |
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
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/sf/stormwaterutilityandroid/AgencyID.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,13 @@ | ||
package com.sf.stormwaterutilityandroid; | ||
|
||
public class AgencyID { | ||
private String agencyID; | ||
|
||
public AgencyID(String agencyID) { | ||
this.agencyID = agencyID; | ||
} | ||
|
||
public String getAgencyID() { | ||
return agencyID; | ||
} | ||
} |
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
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); | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
|
||
|
Oops, something went wrong.