Skip to content

Commit

Permalink
Merge branch 'master' into Evan
Browse files Browse the repository at this point in the history
  • Loading branch information
seford authored Mar 28, 2021
2 parents 38316bf + d6c2a06 commit 60ec652
Show file tree
Hide file tree
Showing 42 changed files with 2,215 additions and 199 deletions.
5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/build.gradle
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 {
Expand Down Expand Up @@ -39,6 +40,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'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
Expand Down
47 changes: 47 additions & 0 deletions app/google-services.json
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"
}
15 changes: 9 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@
<activity android:name=".Settings"></activity>

<activity android:name=".MainMenu" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".WaterWay.WaterWayNav"
>
>
</activity>
<activity android:name=".Construction.ConstructionNav">

</activity>
<activity android:name=".Reset_password" />
<activity android:name=".SampleFordm" />
<activity android:name=".Login" />
<activity android:name=".InspectionForm" />
<activity android:name=".Login" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SignUp" />
</application>

Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/com/sf/stormwaterutilityandroid/AgencyID.java
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,49 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.RecyclerView;

import com.google.firebase.Timestamp;
import com.google.type.DateTime;
import com.sf.stormwaterutilityandroid.R;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Arrays;
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.FormElementSwitch;
import me.riddhimanadib.formmaster.model.FormElementTextMultiLine;
import me.riddhimanadib.formmaster.model.FormElementTextSingleLine;
import me.riddhimanadib.formmaster.model.FormHeader;

public class ConstructionFormFragment extends Fragment {
private FormBuilder formBuilder;
private RecyclerView recyclerView;
private Button submitButton;

public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.activity_sample_fordm, container, false);

View root = inflater.inflate(R.layout.fragment_home, container, false);
recyclerView = root.findViewById(R.id.recyclerView2);

return root;
recyclerView.addView(submitButton);

return root;
}


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

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

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


}



Loading

0 comments on commit 60ec652

Please sign in to comment.