parent
8e4f0844c5
commit
c574fa1199
|
@ -30,6 +30,8 @@
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.HSEObservationsApp"
|
android:theme="@style/Theme.HSEObservationsApp"
|
||||||
|
android:allowClearUserData="true"
|
||||||
|
android:usesCleartextTraffic="true"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.ObservationForms.ObservationNearMissActivity"
|
android:name=".activities.ObservationForms.ObservationNearMissActivity"
|
||||||
|
|
|
@ -22,6 +22,8 @@ import androidx.viewpager.widget.ViewPager;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
import com.utopiaindustries.hseobservationsapp.R;
|
import com.utopiaindustries.hseobservationsapp.R;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.PagerAdapter;
|
import com.utopiaindustries.hseobservationsapp.adapters.PagerAdapter;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.helper.Helper;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.helper.Preference;
|
||||||
|
|
||||||
public class DashboardActivity extends AppCompatActivity {
|
public class DashboardActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@ -114,6 +116,9 @@ public class DashboardActivity extends AppCompatActivity {
|
||||||
|
|
||||||
alertDialog.dismiss();
|
alertDialog.dismiss();
|
||||||
|
|
||||||
|
Preference.setMyBooleanPref(Helper.project_file, "isLoggedIn", getApplicationContext(), false);
|
||||||
|
Preference.setMyStringPref(Helper.project_file, Helper.firstTimeApiCall, getApplicationContext(), "false");
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
Intent i = new Intent(DashboardActivity.this, LoginActivity.class);
|
Intent i = new Intent(DashboardActivity.this, LoginActivity.class);
|
||||||
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
|
@ -21,6 +21,7 @@ import com.utopiaindustries.hseobservationsapp.activities.DashboardActivity;
|
||||||
import com.utopiaindustries.hseobservationsapp.activities.PermitToWorkForms.PermitTwoActivity;
|
import com.utopiaindustries.hseobservationsapp.activities.PermitToWorkForms.PermitTwoActivity;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.ObservationClassAdapter;
|
import com.utopiaindustries.hseobservationsapp.adapters.ObservationClassAdapter;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.ObservationSubClassAdapter;
|
import com.utopiaindustries.hseobservationsapp.adapters.ObservationSubClassAdapter;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.models.HseData.HseObservationClass;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.Shift;
|
import com.utopiaindustries.hseobservationsapp.models.Shift;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -29,7 +30,7 @@ public class ObservationNearMissActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private AutoCompleteTextView observationTextview;
|
private AutoCompleteTextView observationTextview;
|
||||||
private ObservationClassAdapter observationClassAdapter;
|
private ObservationClassAdapter observationClassAdapter;
|
||||||
private ArrayList<Shift> obClassArrayList = new ArrayList<>();
|
private ArrayList<HseObservationClass> obClassArrayList = new ArrayList<>();
|
||||||
|
|
||||||
private Button btnSubmit;
|
private Button btnSubmit;
|
||||||
ImageView imgBack;
|
ImageView imgBack;
|
||||||
|
@ -88,9 +89,9 @@ public class ObservationNearMissActivity extends AppCompatActivity {
|
||||||
imgBack = findViewById(R.id.img_back);
|
imgBack = findViewById(R.id.img_back);
|
||||||
etDescription = findViewById(R.id.et_description);
|
etDescription = findViewById(R.id.et_description);
|
||||||
|
|
||||||
obClassArrayList.add(new Shift(1, "Option 1"));
|
/*obClassArrayList.add(new Shift(1, "Option 1"));
|
||||||
obClassArrayList.add(new Shift(2, "Option 2"));
|
obClassArrayList.add(new Shift(2, "Option 2"));
|
||||||
obClassArrayList.add(new Shift(3, "Option 3"));
|
obClassArrayList.add(new Shift(3, "Option 3"));*/
|
||||||
|
|
||||||
observationClassAdapter = new ObservationClassAdapter(this, obClassArrayList);
|
observationClassAdapter = new ObservationClassAdapter(this, obClassArrayList);
|
||||||
observationTextview.setAdapter(observationClassAdapter);
|
observationTextview.setAdapter(observationClassAdapter);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.utopiaindustries.hseobservationsapp.activities.ObservationForms;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AutoCompleteTextView;
|
import android.widget.AutoCompleteTextView;
|
||||||
|
@ -19,9 +20,16 @@ import com.utopiaindustries.hseobservationsapp.R;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.ObservationClassAdapter;
|
import com.utopiaindustries.hseobservationsapp.adapters.ObservationClassAdapter;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.ObservationSubClassAdapter;
|
import com.utopiaindustries.hseobservationsapp.adapters.ObservationSubClassAdapter;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.ShiftAdapter;
|
import com.utopiaindustries.hseobservationsapp.adapters.ShiftAdapter;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.helper.Helper;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.models.HseData.HseObservationClass;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.models.HseData.HseObservationSubClass;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.models.HseData.Site;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.Shift;
|
import com.utopiaindustries.hseobservationsapp.models.Shift;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class ObservationOneActivity extends AppCompatActivity {
|
public class ObservationOneActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@ -29,14 +37,16 @@ public class ObservationOneActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private ObservationClassAdapter observationClassAdapter;
|
private ObservationClassAdapter observationClassAdapter;
|
||||||
private ObservationSubClassAdapter observationSubClassAdapter;
|
private ObservationSubClassAdapter observationSubClassAdapter;
|
||||||
private ArrayList<Shift> obClassArrayList = new ArrayList<>();
|
private ArrayList<HseObservationClass> obClassArrayList = new ArrayList<>();
|
||||||
|
|
||||||
private ArrayList<Shift> obSubClassArrayList = new ArrayList<>();
|
private ArrayList<HseObservationSubClass> obSubClassArrayList_temp = new ArrayList<>();
|
||||||
|
private ArrayList<HseObservationSubClass> obSubClassArrayList = new ArrayList<>();
|
||||||
|
|
||||||
private Button btnNext;
|
private Button btnNext;
|
||||||
ImageView imgBack;
|
ImageView imgBack;
|
||||||
|
|
||||||
String observationClass = "", observationSubClass = "";
|
String observationClass = "", observationSubClass = "";
|
||||||
|
int observationClassId = 0, observationSubClassId = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -81,6 +91,30 @@ public class ObservationOneActivity extends AppCompatActivity {
|
||||||
// Perform action when shiftTextview item is clicked
|
// Perform action when shiftTextview item is clicked
|
||||||
//Toast.makeText(ObservationOneActivity.this, "Item clicked: " + obClassArrayList.get(position).getTitle(), Toast.LENGTH_SHORT).show();
|
//Toast.makeText(ObservationOneActivity.this, "Item clicked: " + obClassArrayList.get(position).getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
observationClass = obClassArrayList.get(position).getTitle();
|
observationClass = obClassArrayList.get(position).getTitle();
|
||||||
|
HseObservationClass clickedItem = obClassArrayList.get(position);
|
||||||
|
|
||||||
|
observationSubTextview.setText(null);
|
||||||
|
|
||||||
|
Log.e("ob-Sub-Class: ",""+obSubClassArrayList_temp.size());
|
||||||
|
if (!obSubClassArrayList_temp.isEmpty()) {
|
||||||
|
|
||||||
|
List<HseObservationSubClass> filteredUnitItems = obSubClassArrayList_temp.stream()
|
||||||
|
.filter(item -> Objects.equals(item.getObservationClassId(), clickedItem.getId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
Log.e("clickedItem.getId(): ",""+clickedItem.getId());
|
||||||
|
Log.e("filteredUnitItems: ",""+filteredUnitItems.size());
|
||||||
|
|
||||||
|
for (int i = 0; i < obSubClassArrayList_temp.size(); i++) {
|
||||||
|
Log.e("Sub-Items: ",""+obSubClassArrayList_temp.get(i).getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
obSubClassArrayList.clear();
|
||||||
|
obSubClassArrayList.addAll(filteredUnitItems);
|
||||||
|
observationSubClassAdapter = new ObservationSubClassAdapter(ObservationOneActivity.this, filteredUnitItems);
|
||||||
|
observationSubTextview.setAdapter(observationSubClassAdapter);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -100,9 +134,8 @@ public class ObservationOneActivity extends AppCompatActivity {
|
||||||
btnNext = findViewById(R.id.btn_next);
|
btnNext = findViewById(R.id.btn_next);
|
||||||
imgBack = findViewById(R.id.img_back);
|
imgBack = findViewById(R.id.img_back);
|
||||||
|
|
||||||
obClassArrayList.add(new Shift(1, "Unsafe Act"));
|
obClassArrayList.addAll(Helper.getList(Helper.observationClass, this, HseObservationClass.class));
|
||||||
obClassArrayList.add(new Shift(2, "Unsafe Condition"));
|
obSubClassArrayList_temp.addAll(Helper.getList(Helper.observationSubClass, this, HseObservationSubClass.class));
|
||||||
obClassArrayList.add(new Shift(3, "Near Miss"));
|
|
||||||
|
|
||||||
observationClassAdapter = new ObservationClassAdapter(this, obClassArrayList);
|
observationClassAdapter = new ObservationClassAdapter(this, obClassArrayList);
|
||||||
observationTextview.setAdapter(observationClassAdapter);
|
observationTextview.setAdapter(observationClassAdapter);
|
||||||
|
@ -111,8 +144,8 @@ public class ObservationOneActivity extends AppCompatActivity {
|
||||||
//for Unsafe
|
//for Unsafe
|
||||||
//for condition
|
//for condition
|
||||||
//never miss
|
//never miss
|
||||||
observationSubClassAdapter = new ObservationSubClassAdapter(this, obSubClassArrayList);
|
//observationSubClassAdapter = new ObservationSubClassAdapter(this, obSubClassArrayList);
|
||||||
observationSubTextview.setAdapter(observationSubClassAdapter);
|
//observationSubTextview.setAdapter(observationSubClassAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValidate() {
|
public boolean isValidate() {
|
||||||
|
|
|
@ -8,16 +8,17 @@ import android.widget.ArrayAdapter;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.utopiaindustries.hseobservationsapp.R;
|
import com.utopiaindustries.hseobservationsapp.R;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.models.HseData.HseObservationClass;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.Shift;
|
import com.utopiaindustries.hseobservationsapp.models.Shift;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ObservationClassAdapter extends ArrayAdapter<Shift> {
|
public class ObservationClassAdapter extends ArrayAdapter<HseObservationClass> {
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final List<Shift> items;
|
private final List<HseObservationClass> items;
|
||||||
|
|
||||||
public ObservationClassAdapter(Context context, List<Shift> items) {
|
public ObservationClassAdapter(Context context, List<HseObservationClass> items) {
|
||||||
super(context, 0, items);
|
super(context, 0, items);
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.items = items;
|
this.items = items;
|
||||||
|
@ -29,7 +30,7 @@ public class ObservationClassAdapter extends ArrayAdapter<Shift> {
|
||||||
convertView = LayoutInflater.from(context).inflate(R.layout.list_items, parent, false);
|
convertView = LayoutInflater.from(context).inflate(R.layout.list_items, parent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Shift item = items.get(position);
|
HseObservationClass item = items.get(position);
|
||||||
|
|
||||||
TextView titleTextView = convertView.findViewById(R.id.item_text);
|
TextView titleTextView = convertView.findViewById(R.id.item_text);
|
||||||
|
|
||||||
|
|
|
@ -8,16 +8,17 @@ import android.widget.ArrayAdapter;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.utopiaindustries.hseobservationsapp.R;
|
import com.utopiaindustries.hseobservationsapp.R;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.models.HseData.HseObservationSubClass;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.Shift;
|
import com.utopiaindustries.hseobservationsapp.models.Shift;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ObservationSubClassAdapter extends ArrayAdapter<Shift> {
|
public class ObservationSubClassAdapter extends ArrayAdapter<HseObservationSubClass> {
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final List<Shift> items;
|
private final List<HseObservationSubClass> items;
|
||||||
|
|
||||||
public ObservationSubClassAdapter(Context context, List<Shift> items) {
|
public ObservationSubClassAdapter(Context context, List<HseObservationSubClass> items) {
|
||||||
super(context, 0, items);
|
super(context, 0, items);
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.items = items;
|
this.items = items;
|
||||||
|
@ -29,7 +30,7 @@ public class ObservationSubClassAdapter extends ArrayAdapter<Shift> {
|
||||||
convertView = LayoutInflater.from(context).inflate(R.layout.list_items, parent, false);
|
convertView = LayoutInflater.from(context).inflate(R.layout.list_items, parent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Shift item = items.get(position);
|
HseObservationSubClass item = items.get(position);
|
||||||
|
|
||||||
TextView titleTextView = convertView.findViewById(R.id.item_text);
|
TextView titleTextView = convertView.findViewById(R.id.item_text);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.utopiaindustries.hseobservationsapp.adapters;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.utopiaindustries.hseobservationsapp.R;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.models.HseData.RecordType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RecordTypeAdapter extends ArrayAdapter<RecordType> {
|
||||||
|
|
||||||
|
private final Context context;
|
||||||
|
private final List<RecordType> items;
|
||||||
|
|
||||||
|
public RecordTypeAdapter(Context context, List<RecordType> items) {
|
||||||
|
super(context, 0, items);
|
||||||
|
this.context = context;
|
||||||
|
this.items = items;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
if (convertView == null) {
|
||||||
|
convertView = LayoutInflater.from(context).inflate(R.layout.list_items, parent, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
RecordType item = items.get(position);
|
||||||
|
|
||||||
|
TextView titleTextView = convertView.findViewById(R.id.item_text);
|
||||||
|
|
||||||
|
titleTextView.setText(item.getTitle());
|
||||||
|
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,17 +8,17 @@ import android.widget.ArrayAdapter;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.utopiaindustries.hseobservationsapp.R;
|
import com.utopiaindustries.hseobservationsapp.R;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.FormType;
|
import com.utopiaindustries.hseobservationsapp.models.HseData.Site;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.LocationSite;
|
import com.utopiaindustries.hseobservationsapp.models.Shift;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class FormTypeAdapter extends ArrayAdapter<FormType> {
|
public class SiteAdapter extends ArrayAdapter<Site> {
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final List<FormType> items;
|
private final List<Site> items;
|
||||||
|
|
||||||
public FormTypeAdapter(Context context, List<FormType> items) {
|
public SiteAdapter(Context context, List<Site> items) {
|
||||||
super(context, 0, items);
|
super(context, 0, items);
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.items = items;
|
this.items = items;
|
||||||
|
@ -30,7 +30,7 @@ public class FormTypeAdapter extends ArrayAdapter<FormType> {
|
||||||
convertView = LayoutInflater.from(context).inflate(R.layout.list_items, parent, false);
|
convertView = LayoutInflater.from(context).inflate(R.layout.list_items, parent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
FormType item = items.get(position);
|
Site item = items.get(position);
|
||||||
|
|
||||||
TextView titleTextView = convertView.findViewById(R.id.item_text);
|
TextView titleTextView = convertView.findViewById(R.id.item_text);
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.utopiaindustries.hseobservationsapp.adapters;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.utopiaindustries.hseobservationsapp.R;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.models.HseData.HseObservationClass;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.models.HseData.Supervisor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SupervisorAdapter extends ArrayAdapter<Supervisor> {
|
||||||
|
|
||||||
|
private final Context context;
|
||||||
|
private final List<Supervisor> items;
|
||||||
|
|
||||||
|
public SupervisorAdapter(Context context, List<Supervisor> items) {
|
||||||
|
super(context, 0, items);
|
||||||
|
this.context = context;
|
||||||
|
this.items = items;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
if (convertView == null) {
|
||||||
|
convertView = LayoutInflater.from(context).inflate(R.layout.list_items, parent, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
Supervisor item = items.get(position);
|
||||||
|
|
||||||
|
TextView titleTextView = convertView.findViewById(R.id.item_text);
|
||||||
|
|
||||||
|
titleTextView.setText(item.getName());
|
||||||
|
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package com.utopiaindustries.hseobservationsapp.apiservice;
|
package com.utopiaindustries.hseobservationsapp.apiservice;
|
||||||
|
|
||||||
|
import com.utopiaindustries.hseobservationsapp.models.HseData.HseResponse;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.QualityControl;
|
import com.utopiaindustries.hseobservationsapp.models.QualityControl;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.QualityControlResponse;
|
import com.utopiaindustries.hseobservationsapp.models.QualityControlResponse;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.QualitySaveResponse;
|
import com.utopiaindustries.hseobservationsapp.models.QualitySaveResponse;
|
||||||
|
@ -17,8 +18,8 @@ public interface ApiService {
|
||||||
@Query("username") String username
|
@Query("username") String username
|
||||||
);*/
|
);*/
|
||||||
|
|
||||||
@GET("rest/uic/quality-control/get-quality-control-data")
|
@GET("rest/uic/hse/get-hse-report-data")
|
||||||
Call<QualityControlResponse> getQualityControlData();
|
Call<HseResponse> getHseData();
|
||||||
|
|
||||||
|
|
||||||
@POST("rest/uic/quality-control/save-quality-control")
|
@POST("rest/uic/quality-control/save-quality-control")
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -27,17 +28,26 @@ import com.utopiaindustries.hseobservationsapp.activities.OtherHSEActivityForms.
|
||||||
import com.utopiaindustries.hseobservationsapp.activities.PermitToWorkForms.PermitOneActivity;
|
import com.utopiaindustries.hseobservationsapp.activities.PermitToWorkForms.PermitOneActivity;
|
||||||
import com.utopiaindustries.hseobservationsapp.activities.ProgressiveActivityForms.ProgressiveActivity;
|
import com.utopiaindustries.hseobservationsapp.activities.ProgressiveActivityForms.ProgressiveActivity;
|
||||||
import com.utopiaindustries.hseobservationsapp.activities.WeeklyActivityForms.WeeklyFormOne;
|
import com.utopiaindustries.hseobservationsapp.activities.WeeklyActivityForms.WeeklyFormOne;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.FormTypeAdapter;
|
import com.utopiaindustries.hseobservationsapp.adapters.RecordTypeAdapter;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.ShiftAdapter;
|
import com.utopiaindustries.hseobservationsapp.adapters.ShiftAdapter;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.adapters.SiteAdapter;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.adapters.SupervisorAdapter;
|
||||||
import com.utopiaindustries.hseobservationsapp.helper.Helper;
|
import com.utopiaindustries.hseobservationsapp.helper.Helper;
|
||||||
import com.utopiaindustries.hseobservationsapp.helper.Preference;
|
import com.utopiaindustries.hseobservationsapp.helper.Preference;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.FormType;
|
import com.utopiaindustries.hseobservationsapp.models.HseData.RecordType;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.models.HseData.Site;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.models.HseData.Supervisor;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.Shift;
|
import com.utopiaindustries.hseobservationsapp.models.Shift;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.utils.ProgressDialogFragment;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.viewmodels.LoginViewModel;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class HomeFragment extends Fragment {
|
public class HomeFragment extends Fragment {
|
||||||
|
|
||||||
|
@ -46,18 +56,29 @@ public class HomeFragment extends Fragment {
|
||||||
private TextView txtUserName, txtDate;
|
private TextView txtUserName, txtDate;
|
||||||
private ImageView imgCalendar;
|
private ImageView imgCalendar;
|
||||||
private Button btnNext;
|
private Button btnNext;
|
||||||
private AutoCompleteTextView shiftTextview, formTextview;
|
private AutoCompleteTextView siteTextView, supervisorTextView, shiftTextview, formTextview;
|
||||||
|
|
||||||
|
private SiteAdapter siteAdapter;
|
||||||
|
private ArrayList<Site> siteArrayList = new ArrayList<>();
|
||||||
|
|
||||||
|
private SupervisorAdapter supervisorAdapter;
|
||||||
|
private ArrayList<Supervisor> supervisorArrayList_temp = new ArrayList<>();
|
||||||
|
private ArrayList<Supervisor> supervisorArrayList = new ArrayList<>();
|
||||||
|
|
||||||
private ShiftAdapter shiftAdapter;
|
private ShiftAdapter shiftAdapter;
|
||||||
private ArrayList<Shift> shiftArrayList = new ArrayList<>();
|
private ArrayList<Shift> shiftArrayList = new ArrayList<>();
|
||||||
|
|
||||||
private FormTypeAdapter formTypeAdapter;
|
private RecordTypeAdapter recordTypeAdapter;
|
||||||
private ArrayList<FormType> formArrayList = new ArrayList<>();
|
private List<RecordType> recordTypeArrayList = new ArrayList<>();
|
||||||
|
|
||||||
int selectedOption = 0;
|
int selectedOption = 0;
|
||||||
String userName = "";
|
String userName = "";
|
||||||
|
String siteName = "";
|
||||||
|
String supervisorName = "";
|
||||||
String shiftName = "";
|
String shiftName = "";
|
||||||
|
|
||||||
|
LoginViewModel loginViewModel;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -79,6 +100,29 @@ public class HomeFragment extends Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
siteTextView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
// Perform action when siteTextView item is clicked
|
||||||
|
//Toast.makeText(getActivity(), "Item clicked: " + siteArrayList.get(position).getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
|
siteName = siteArrayList.get(position).getTitle();
|
||||||
|
Site clickedItem = siteArrayList.get(position);
|
||||||
|
supervisorTextView.setText(null);
|
||||||
|
|
||||||
|
if (!supervisorArrayList_temp.isEmpty()) {
|
||||||
|
List<Supervisor> filteredUnitItems = supervisorArrayList_temp.stream()
|
||||||
|
.filter(item -> Objects.equals(item.getSiteId(), clickedItem.getId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
supervisorArrayList.clear();
|
||||||
|
supervisorArrayList.addAll(filteredUnitItems);
|
||||||
|
supervisorAdapter = new SupervisorAdapter(getActivity(), supervisorArrayList);
|
||||||
|
supervisorTextView.setAdapter(supervisorAdapter);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
shiftTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
shiftTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
@ -94,7 +138,7 @@ public class HomeFragment extends Fragment {
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
// Perform action when formTextview item is clicked
|
// Perform action when formTextview item is clicked
|
||||||
// Toast.makeText(getActivity(), "Item clicked: " + formArrayList.get(position).getTitle(), Toast.LENGTH_SHORT).show();
|
// Toast.makeText(getActivity(), "Item clicked: " + formArrayList.get(position).getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
selectedOption = formArrayList.get(position).getId();
|
selectedOption = recordTypeArrayList.get(position).getId();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -148,28 +192,144 @@ public class HomeFragment extends Fragment {
|
||||||
imgCalendar = view.findViewById(R.id.img_calendar);
|
imgCalendar = view.findViewById(R.id.img_calendar);
|
||||||
btnNext = view.findViewById(R.id.btn_next);
|
btnNext = view.findViewById(R.id.btn_next);
|
||||||
|
|
||||||
|
siteTextView = view.findViewById(R.id.site_textview);
|
||||||
|
supervisorTextView = view.findViewById(R.id.supervisor_textview);
|
||||||
shiftTextview = view.findViewById(R.id.shift_textview);
|
shiftTextview = view.findViewById(R.id.shift_textview);
|
||||||
formTextview = view.findViewById(R.id.form_textview);
|
formTextview = view.findViewById(R.id.form_textview);
|
||||||
|
|
||||||
userName = Preference.getMyStringPref(Helper.project_file, Helper.logInUser, getActivity());
|
userName = Preference.getMyStringPref(Helper.project_file, Helper.logInUser, getActivity());
|
||||||
|
|
||||||
|
loginViewModel = new ViewModelProvider(getActivity()).get(LoginViewModel.class);
|
||||||
|
|
||||||
|
loginViewModel.getLoadingState().observe(getActivity(), isLoading -> {
|
||||||
|
|
||||||
|
if (isLoading != null && isLoading) {
|
||||||
|
showProgressDialog();
|
||||||
|
} else {
|
||||||
|
dismissProgressDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
loginViewModel.getErrorMessage().observe(getActivity(), errorResponse -> {
|
||||||
|
Toast.makeText(getActivity(), errorResponse, Toast.LENGTH_SHORT).show();
|
||||||
|
});
|
||||||
|
|
||||||
|
loginViewModel.getUserLiveData().observe(getActivity(), qcResponse -> {
|
||||||
|
if (qcResponse != null) {
|
||||||
|
|
||||||
|
if (!qcResponse.getSites().isEmpty()) {
|
||||||
|
|
||||||
|
Helper.saveList(qcResponse.getSites(), Helper.homeSite, getActivity());
|
||||||
|
siteArrayList.addAll(qcResponse.getSites());
|
||||||
|
siteAdapter = new SiteAdapter(getActivity(), siteArrayList);
|
||||||
|
siteTextView.setAdapter(siteAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!qcResponse.getRecordTypes().isEmpty()) {
|
||||||
|
|
||||||
|
Helper.saveList(qcResponse.getRecordTypes(), Helper.recordType, getActivity());
|
||||||
|
recordTypeArrayList.addAll(qcResponse.getRecordTypes());
|
||||||
|
recordTypeAdapter = new RecordTypeAdapter(getActivity(), recordTypeArrayList);
|
||||||
|
formTextview.setAdapter(recordTypeAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!qcResponse.getSupervisors().isEmpty()) {
|
||||||
|
|
||||||
|
Helper.saveList(qcResponse.getSupervisors(), Helper.superVisor, getActivity());
|
||||||
|
supervisorArrayList_temp.addAll(qcResponse.getSupervisors());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!qcResponse.getHseObservationClasses().isEmpty()) {
|
||||||
|
|
||||||
|
Helper.saveList(qcResponse.getHseObservationClasses(), Helper.observationClass, getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!qcResponse.getHseObservationSubClasses().isEmpty()) {
|
||||||
|
|
||||||
|
Helper.saveList(qcResponse.getHseObservationSubClasses(), Helper.observationSubClass, getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!qcResponse.getHseFloors().isEmpty()) {
|
||||||
|
|
||||||
|
Helper.saveList(qcResponse.getHseFloors(), Helper.hseFloors, getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!qcResponse.getHseActivities().isEmpty()) {
|
||||||
|
|
||||||
|
Helper.saveList(qcResponse.getHseActivities(), Helper.hseActivities, getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!qcResponse.getHseDepartment().isEmpty()) {
|
||||||
|
|
||||||
|
Helper.saveList(qcResponse.getHseDepartment(), Helper.hseDepartment, getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!qcResponse.getHseIncidentTypes().isEmpty()) {
|
||||||
|
|
||||||
|
Helper.saveList(qcResponse.getHseIncidentTypes(), Helper.hseIncidentTypes, getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!qcResponse.getHseInjuredBodyPart().isEmpty()) {
|
||||||
|
|
||||||
|
Helper.saveList(qcResponse.getHseInjuredBodyPart(), Helper.hseInjuredBodyPart, getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!qcResponse.getHsePtwType().isEmpty()) {
|
||||||
|
|
||||||
|
Helper.saveList(qcResponse.getHsePtwType(), Helper.hsePtwType, getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!qcResponse.getHseSafetyTrainingTopics().isEmpty()) {
|
||||||
|
|
||||||
|
Helper.saveList(qcResponse.getHseSafetyTrainingTopics(), Helper.hseSafetyTrainingTopics, getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!qcResponse.getHseBuildings().isEmpty()) {
|
||||||
|
|
||||||
|
Helper.saveList(qcResponse.getHseBuildings(), Helper.hseBuildings, getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!qcResponse.getHseInjuries().isEmpty()) {
|
||||||
|
|
||||||
|
Helper.saveList(qcResponse.getHseInjuries(), Helper.hseInjuries, getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
Preference.setMyStringPref(Helper.project_file, Helper.firstTimeApiCall, getActivity(), "true");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getActivity(), "Fetching Records Failed", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (Preference.getMyStringPref(Helper.project_file, Helper.firstTimeApiCall, getActivity()).equalsIgnoreCase("false") ||
|
||||||
|
Preference.getMyStringPref(Helper.project_file, Helper.firstTimeApiCall, getActivity()).equalsIgnoreCase("default")) {
|
||||||
|
loginViewModel.getHSEData();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
siteArrayList.clear();
|
||||||
|
recordTypeArrayList.clear();
|
||||||
|
siteArrayList.clear();
|
||||||
|
supervisorArrayList_temp.clear();
|
||||||
|
supervisorArrayList.clear();
|
||||||
|
|
||||||
|
siteArrayList.addAll(Helper.getList(Helper.homeSite, getActivity(), Site.class));
|
||||||
|
siteAdapter = new SiteAdapter(getActivity(), siteArrayList);
|
||||||
|
siteTextView.setAdapter(siteAdapter);
|
||||||
|
|
||||||
|
supervisorArrayList_temp.addAll(Helper.getList(Helper.superVisor, getActivity(), Supervisor.class));
|
||||||
|
|
||||||
|
recordTypeArrayList.addAll(Helper.getList(Helper.recordType, getActivity(), RecordType.class));
|
||||||
|
recordTypeAdapter = new RecordTypeAdapter(getActivity(), recordTypeArrayList);
|
||||||
|
formTextview.setAdapter(recordTypeAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
shiftArrayList.add(new Shift(1, "General Shift(08:00AM - 05:00PM)"));
|
shiftArrayList.add(new Shift(1, "General Shift(08:00AM - 05:00PM)"));
|
||||||
shiftArrayList.add(new Shift(2, "Evening Shift(12:00PM - 09:00PM)"));
|
shiftArrayList.add(new Shift(2, "Evening Shift(12:00PM - 09:00PM)"));
|
||||||
shiftArrayList.add(new Shift(3, "Night Shift(09:00PM - 06:00AM)"));
|
shiftArrayList.add(new Shift(3, "Night Shift(09:00PM - 06:00AM)"));
|
||||||
|
|
||||||
shiftAdapter = new ShiftAdapter(getActivity(), shiftArrayList);
|
shiftAdapter = new ShiftAdapter(getActivity(), shiftArrayList);
|
||||||
shiftTextview.setAdapter(shiftAdapter);
|
shiftTextview.setAdapter(shiftAdapter);
|
||||||
|
|
||||||
formArrayList.add(new FormType(1, "Observation Form"));
|
|
||||||
formArrayList.add(new FormType(2, "Permit To Work Form"));
|
|
||||||
formArrayList.add(new FormType(3, "HSE Training Form"));
|
|
||||||
formArrayList.add(new FormType(4, "Injury Record Form"));
|
|
||||||
formArrayList.add(new FormType(5, "Weekly Activities Form"));
|
|
||||||
formArrayList.add(new FormType(6, "Progressive Activities Form"));
|
|
||||||
formArrayList.add(new FormType(7, "Other HSE Form"));
|
|
||||||
|
|
||||||
formTypeAdapter = new FormTypeAdapter(getActivity(), formArrayList);
|
|
||||||
formTextview.setAdapter(formTypeAdapter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showDatePickerDialog(Context context) {
|
private void showDatePickerDialog(Context context) {
|
||||||
|
@ -216,4 +376,18 @@ public class HomeFragment extends Fragment {
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showProgressDialog() {
|
||||||
|
ProgressDialogFragment progressDialog = new ProgressDialogFragment();
|
||||||
|
progressDialog.setCancelable(false);
|
||||||
|
progressDialog.show(requireActivity().getSupportFragmentManager(), "progressDialog");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dismissProgressDialog() {
|
||||||
|
ProgressDialogFragment progressDialog = (ProgressDialogFragment)
|
||||||
|
requireActivity().getSupportFragmentManager().findFragmentByTag("progressDialog");
|
||||||
|
if (progressDialog != null) {
|
||||||
|
progressDialog.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -31,6 +31,28 @@ public class Helper {
|
||||||
|
|
||||||
public static final String logInUser = "LogInUser";
|
public static final String logInUser = "LogInUser";
|
||||||
|
|
||||||
|
public static final String firstTimeApiCall = "isFirstTimeApiCall";
|
||||||
|
|
||||||
|
public static final String homeSite = "Sites";
|
||||||
|
public static final String superVisor = "SuperVisor";
|
||||||
|
public static final String recordType = "RecordType";
|
||||||
|
|
||||||
|
public static final String observationClass = "observationClass";
|
||||||
|
public static final String observationSubClass = "observationSubClass";
|
||||||
|
|
||||||
|
public static final String hseFloors = "hseFloors";
|
||||||
|
public static final String hseActivities = "hseActivities";
|
||||||
|
|
||||||
|
public static final String hseDepartment = "hseDepartment";
|
||||||
|
public static final String hseIncidentTypes = "hseIncidentTypes";
|
||||||
|
public static final String hseInjuredBodyPart = "hseInjuredBodyPart";
|
||||||
|
public static final String hsePtwType = "hsePtwType";
|
||||||
|
|
||||||
|
public static final String hseSafetyTrainingTopics = "hseSafetyTrainingTopics";
|
||||||
|
public static final String hseBuildings = "hseBuildings";
|
||||||
|
|
||||||
|
public static final String hseInjuries = "hseInjuries";
|
||||||
|
|
||||||
public static boolean isValidEmail(CharSequence target) {
|
public static boolean isValidEmail(CharSequence target) {
|
||||||
return !TextUtils.isEmpty(target) && android.util.Patterns.EMAIL_ADDRESS.matcher(target).matches();
|
return !TextUtils.isEmpty(target) && android.util.Patterns.EMAIL_ADDRESS.matcher(target).matches();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
package com.utopiaindustries.hseobservationsapp.models.HseData;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class HseActivity {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private Integer id;
|
||||||
|
@SerializedName("title")
|
||||||
|
@Expose
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
package com.utopiaindustries.hseobservationsapp.models.HseData;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class HseBuilding {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private Integer id;
|
||||||
|
@SerializedName("siteId")
|
||||||
|
@Expose
|
||||||
|
private Integer siteId;
|
||||||
|
@SerializedName("title")
|
||||||
|
@Expose
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSiteId() {
|
||||||
|
return siteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSiteId(Integer siteId) {
|
||||||
|
this.siteId = siteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
package com.utopiaindustries.hseobservationsapp.models.HseData;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class HseDepartment {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private Integer id;
|
||||||
|
@SerializedName("title")
|
||||||
|
@Expose
|
||||||
|
private String title;
|
||||||
|
@SerializedName("siteId")
|
||||||
|
@Expose
|
||||||
|
private Integer siteId;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSiteId() {
|
||||||
|
return siteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSiteId(Integer siteId) {
|
||||||
|
this.siteId = siteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
package com.utopiaindustries.hseobservationsapp.models.HseData;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class HseFloor {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private Integer id;
|
||||||
|
@SerializedName("siteId")
|
||||||
|
@Expose
|
||||||
|
private Integer siteId;
|
||||||
|
@SerializedName("title")
|
||||||
|
@Expose
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSiteId() {
|
||||||
|
return siteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSiteId(Integer siteId) {
|
||||||
|
this.siteId = siteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
package com.utopiaindustries.hseobservationsapp.models.HseData;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class HseIncidentType {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private Integer id;
|
||||||
|
@SerializedName("title")
|
||||||
|
@Expose
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
package com.utopiaindustries.hseobservationsapp.models.HseData;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class HseInjuredBodyPart {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private Integer id;
|
||||||
|
@SerializedName("title")
|
||||||
|
@Expose
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
package com.utopiaindustries.hseobservationsapp.models.HseData;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class HseInjury {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private Integer id;
|
||||||
|
@SerializedName("incidentId")
|
||||||
|
@Expose
|
||||||
|
private Integer incidentId;
|
||||||
|
@SerializedName("title")
|
||||||
|
@Expose
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIncidentId() {
|
||||||
|
return incidentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIncidentId(Integer incidentId) {
|
||||||
|
this.incidentId = incidentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
|
||||||
|
package com.utopiaindustries.hseobservationsapp.models.HseData;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class HseObservationClass {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private Integer id;
|
||||||
|
@SerializedName("title")
|
||||||
|
@Expose
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
|
||||||
|
package com.utopiaindustries.hseobservationsapp.models.HseData;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class HseObservationSubClass {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private Integer id;
|
||||||
|
@SerializedName("title")
|
||||||
|
@Expose
|
||||||
|
private String title;
|
||||||
|
@SerializedName("observationClassId")
|
||||||
|
@Expose
|
||||||
|
private Integer observationClassId;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getObservationClassId() {
|
||||||
|
return observationClassId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObservationClassId(Integer observationClassId) {
|
||||||
|
this.observationClassId = observationClassId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
package com.utopiaindustries.hseobservationsapp.models.HseData;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class HsePtwType {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private Integer id;
|
||||||
|
@SerializedName("title")
|
||||||
|
@Expose
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,165 @@
|
||||||
|
|
||||||
|
package com.utopiaindustries.hseobservationsapp.models.HseData;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class HseResponse {
|
||||||
|
|
||||||
|
@SerializedName("hseFloors")
|
||||||
|
@Expose
|
||||||
|
private List<HseFloor> hseFloors;
|
||||||
|
@SerializedName("hseObservationSubClasses")
|
||||||
|
@Expose
|
||||||
|
private List<HseObservationSubClass> hseObservationSubClasses;
|
||||||
|
@SerializedName("recordTypes")
|
||||||
|
@Expose
|
||||||
|
private List<RecordType> recordTypes;
|
||||||
|
@SerializedName("hseObservationClasses")
|
||||||
|
@Expose
|
||||||
|
private List<HseObservationClass> hseObservationClasses;
|
||||||
|
@SerializedName("hseActivities")
|
||||||
|
@Expose
|
||||||
|
private List<HseActivity> hseActivities;
|
||||||
|
@SerializedName("sites")
|
||||||
|
@Expose
|
||||||
|
private List<Site> sites;
|
||||||
|
@SerializedName("hseDepartment")
|
||||||
|
@Expose
|
||||||
|
private List<HseDepartment> hseDepartment;
|
||||||
|
@SerializedName("hseIncidentTypes")
|
||||||
|
@Expose
|
||||||
|
private List<HseIncidentType> hseIncidentTypes;
|
||||||
|
@SerializedName("hseInjuredBodyPart")
|
||||||
|
@Expose
|
||||||
|
private List<HseInjuredBodyPart> hseInjuredBodyPart;
|
||||||
|
@SerializedName("hsePtwType")
|
||||||
|
@Expose
|
||||||
|
private List<HsePtwType> hsePtwType;
|
||||||
|
@SerializedName("hseSafetyTrainingTopics")
|
||||||
|
@Expose
|
||||||
|
private List<HseSafetyTrainingTopic> hseSafetyTrainingTopics;
|
||||||
|
@SerializedName("hseBuildings")
|
||||||
|
@Expose
|
||||||
|
private List<HseBuilding> hseBuildings;
|
||||||
|
@SerializedName("hseInjuries")
|
||||||
|
@Expose
|
||||||
|
private List<HseInjury> hseInjuries;
|
||||||
|
@SerializedName("supervisors")
|
||||||
|
@Expose
|
||||||
|
private List<Supervisor> supervisors;
|
||||||
|
|
||||||
|
public List<HseFloor> getHseFloors() {
|
||||||
|
return hseFloors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHseFloors(List<HseFloor> hseFloors) {
|
||||||
|
this.hseFloors = hseFloors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HseObservationSubClass> getHseObservationSubClasses() {
|
||||||
|
return hseObservationSubClasses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHseObservationSubClasses(List<HseObservationSubClass> hseObservationSubClasses) {
|
||||||
|
this.hseObservationSubClasses = hseObservationSubClasses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RecordType> getRecordTypes() {
|
||||||
|
return recordTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecordTypes(List<RecordType> recordTypes) {
|
||||||
|
this.recordTypes = recordTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HseObservationClass> getHseObservationClasses() {
|
||||||
|
return hseObservationClasses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHseObservationClasses(List<HseObservationClass> hseObservationClasses) {
|
||||||
|
this.hseObservationClasses = hseObservationClasses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HseActivity> getHseActivities() {
|
||||||
|
return hseActivities;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHseActivities(List<HseActivity> hseActivities) {
|
||||||
|
this.hseActivities = hseActivities;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Site> getSites() {
|
||||||
|
return sites;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSites(List<Site> sites) {
|
||||||
|
this.sites = sites;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HseDepartment> getHseDepartment() {
|
||||||
|
return hseDepartment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHseDepartment(List<HseDepartment> hseDepartment) {
|
||||||
|
this.hseDepartment = hseDepartment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HseIncidentType> getHseIncidentTypes() {
|
||||||
|
return hseIncidentTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHseIncidentTypes(List<HseIncidentType> hseIncidentTypes) {
|
||||||
|
this.hseIncidentTypes = hseIncidentTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HseInjuredBodyPart> getHseInjuredBodyPart() {
|
||||||
|
return hseInjuredBodyPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHseInjuredBodyPart(List<HseInjuredBodyPart> hseInjuredBodyPart) {
|
||||||
|
this.hseInjuredBodyPart = hseInjuredBodyPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HsePtwType> getHsePtwType() {
|
||||||
|
return hsePtwType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHsePtwType(List<HsePtwType> hsePtwType) {
|
||||||
|
this.hsePtwType = hsePtwType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HseSafetyTrainingTopic> getHseSafetyTrainingTopics() {
|
||||||
|
return hseSafetyTrainingTopics;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHseSafetyTrainingTopics(List<HseSafetyTrainingTopic> hseSafetyTrainingTopics) {
|
||||||
|
this.hseSafetyTrainingTopics = hseSafetyTrainingTopics;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HseBuilding> getHseBuildings() {
|
||||||
|
return hseBuildings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHseBuildings(List<HseBuilding> hseBuildings) {
|
||||||
|
this.hseBuildings = hseBuildings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HseInjury> getHseInjuries() {
|
||||||
|
return hseInjuries;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHseInjuries(List<HseInjury> hseInjuries) {
|
||||||
|
this.hseInjuries = hseInjuries;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Supervisor> getSupervisors() {
|
||||||
|
return supervisors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSupervisors(List<Supervisor> supervisors) {
|
||||||
|
this.supervisors = supervisors;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
package com.utopiaindustries.hseobservationsapp.models.HseData;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class HseSafetyTrainingTopic {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private Integer id;
|
||||||
|
@SerializedName("title")
|
||||||
|
@Expose
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
|
||||||
|
package com.utopiaindustries.hseobservationsapp.models.HseData;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class RecordType {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private Integer id;
|
||||||
|
@SerializedName("title")
|
||||||
|
@Expose
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
|
||||||
|
package com.utopiaindustries.hseobservationsapp.models.HseData;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class Site {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private Integer id;
|
||||||
|
@SerializedName("title")
|
||||||
|
@Expose
|
||||||
|
private String title;
|
||||||
|
@SerializedName("shortTitle")
|
||||||
|
@Expose
|
||||||
|
private String shortTitle;
|
||||||
|
@SerializedName("address")
|
||||||
|
@Expose
|
||||||
|
private String address;
|
||||||
|
@SerializedName("hasColony")
|
||||||
|
@Expose
|
||||||
|
private Boolean hasColony;
|
||||||
|
@SerializedName("units")
|
||||||
|
@Expose
|
||||||
|
private Object units;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShortTitle() {
|
||||||
|
return shortTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShortTitle(String shortTitle) {
|
||||||
|
this.shortTitle = shortTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getHasColony() {
|
||||||
|
return hasColony;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasColony(Boolean hasColony) {
|
||||||
|
this.hasColony = hasColony;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getUnits() {
|
||||||
|
return units;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUnits(Object units) {
|
||||||
|
this.units = units;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
|
||||||
|
package com.utopiaindustries.hseobservationsapp.models.HseData;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class Supervisor {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
@Expose
|
||||||
|
private Integer id;
|
||||||
|
@SerializedName("name")
|
||||||
|
@Expose
|
||||||
|
private String name;
|
||||||
|
@SerializedName("siteId")
|
||||||
|
@Expose
|
||||||
|
private Integer siteId;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSiteId() {
|
||||||
|
return siteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSiteId(Integer siteId) {
|
||||||
|
this.siteId = siteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
import com.utopiaindustries.hseobservationsapp.apiservice.ApiService;
|
import com.utopiaindustries.hseobservationsapp.apiservice.ApiService;
|
||||||
import com.utopiaindustries.hseobservationsapp.apiservice.ApiServiceFactory;
|
import com.utopiaindustries.hseobservationsapp.apiservice.ApiServiceFactory;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.models.HseData.HseResponse;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.QualityControlResponse;
|
import com.utopiaindustries.hseobservationsapp.models.QualityControlResponse;
|
||||||
|
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
|
@ -15,7 +16,7 @@ import retrofit2.Response;
|
||||||
|
|
||||||
public class LoginViewModel extends ViewModel {
|
public class LoginViewModel extends ViewModel {
|
||||||
|
|
||||||
private MutableLiveData<QualityControlResponse> userLiveData;
|
private MutableLiveData<HseResponse> userLiveData;
|
||||||
private MutableLiveData<Boolean> userLoginLiveData;
|
private MutableLiveData<Boolean> userLoginLiveData;
|
||||||
private MutableLiveData<String> errorLiveData;
|
private MutableLiveData<String> errorLiveData;
|
||||||
private MutableLiveData<Boolean> isLoading;
|
private MutableLiveData<Boolean> isLoading;
|
||||||
|
@ -29,7 +30,7 @@ public class LoginViewModel extends ViewModel {
|
||||||
isLoading = new MutableLiveData<>();
|
isLoading = new MutableLiveData<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiveData<QualityControlResponse> getUserLiveData() {
|
public LiveData<HseResponse> getUserLiveData() {
|
||||||
return userLiveData;
|
return userLiveData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,11 +67,35 @@ public class LoginViewModel extends ViewModel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getHSEData() {
|
||||||
|
isLoading.setValue(true);
|
||||||
|
apiService.getHseData().enqueue(new Callback<HseResponse>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<HseResponse> call, Response<HseResponse> response) {
|
||||||
|
|
||||||
|
isLoading.setValue(false);
|
||||||
|
if (response.isSuccessful() && response.body() != null) {
|
||||||
|
//Log.e("onResponse: ", "Successful");
|
||||||
|
userLiveData.setValue(response.body());
|
||||||
|
} else {
|
||||||
|
errorLiveData.setValue(response.message());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<HseResponse> call, Throwable t) {
|
||||||
|
//Log.e("onResponse: ", "Fail");
|
||||||
|
isLoading.setValue(false);
|
||||||
|
errorLiveData.setValue(t.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public LiveData<Boolean> getLoginUser() {
|
public LiveData<Boolean> getLoginUser() {
|
||||||
return userLoginLiveData;
|
return userLoginLiveData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiveData<QualityControlResponse> getUser() {
|
public LiveData<HseResponse> getUser() {
|
||||||
return userLiveData;
|
return userLiveData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,14 @@
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:padding="5dp">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/txt_user_name"
|
android:id="@+id/txt_user_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
|
@ -24,128 +24,204 @@
|
||||||
android:textSize="@dimen/_13sdp"
|
android:textSize="@dimen/_13sdp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/date_heading"
|
|
||||||
|
<ScrollView
|
||||||
|
android:id="@+id/scrollView2"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:layout_below="@+id/txt_user_name"
|
android:layout_above="@+id/btn_next"
|
||||||
android:gravity="left"
|
android:layout_below="@+id/txt_user_name">
|
||||||
android:padding="5dp"
|
|
||||||
android:text="Date *"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="@dimen/_13sdp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
<RelativeLayout
|
||||||
android:id="@+id/txt_date"
|
android:id="@+id/rl1"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/date_heading"
|
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:gravity="left"
|
|
||||||
android:hint="MM-dd-yyyy"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="@dimen/_13sdp" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/img_calendar"
|
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:layout_below="@+id/date_heading"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
android:src="@drawable/icon_calendar" />
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/rl1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/txt_date"
|
|
||||||
android:layout_marginTop="40dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/shift_heading"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="20dp"
|
android:padding="5dp">
|
||||||
android:gravity="left"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="Shift Name *"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="@dimen/_13sdp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<TextView
|
||||||
android:id="@+id/shift_input"
|
android:id="@+id/date_heading"
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/shift_heading"
|
|
||||||
android:layout_marginLeft="5dp"
|
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:hint="@string/select_shift"
|
|
||||||
android:padding="5dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
|
||||||
|
|
||||||
<AutoCompleteTextView
|
|
||||||
android:id="@+id/shift_textview"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="none"
|
android:gravity="left"
|
||||||
android:textSize="16sp" />
|
android:layout_marginStart="5dp"
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
android:padding="5dp"
|
||||||
|
android:text="Date *"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/_13sdp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/form_heading"
|
android:id="@+id/txt_date"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/shift_input"
|
android:layout_below="@+id/date_heading"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginStart="5dp"
|
||||||
android:gravity="left"
|
android:layout_marginTop="5dp"
|
||||||
android:padding="5dp"
|
android:gravity="left"
|
||||||
android:text="Form Type *"
|
android:hint="MM-dd-yyyy"
|
||||||
android:textColor="@color/black"
|
android:padding="5dp"
|
||||||
android:textSize="@dimen/_13sdp"
|
android:textColor="@color/black"
|
||||||
android:textStyle="bold" />
|
android:textSize="@dimen/_13sdp" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<ImageView
|
||||||
android:id="@+id/form_input"
|
android:id="@+id/img_calendar"
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
android:layout_width="40dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="40dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_below="@+id/date_heading"
|
||||||
android:layout_below="@+id/form_heading"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_marginRight="5dp"
|
android:src="@drawable/icon_calendar" />
|
||||||
android:hint="@string/select_form"
|
|
||||||
android:padding="5dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
|
||||||
|
|
||||||
<AutoCompleteTextView
|
<TextView
|
||||||
android:id="@+id/form_textview"
|
android:id="@+id/site_heading"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="none"
|
android:layout_marginTop="10dp"
|
||||||
android:textSize="16sp" />
|
android:layout_below="@+id/txt_date"
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
android:gravity="left"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="Site Name *"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/_13sdp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/site_input"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/site_heading"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:hint="@string/select_site"
|
||||||
|
android:padding="5dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/site_textview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="none"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/supervisor_heading"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/site_input"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:gravity="left"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="Supervisor Name *"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/_13sdp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/supervisor_input"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/supervisor_heading"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:hint="@string/select_super"
|
||||||
|
android:padding="5dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/supervisor_textview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="none"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/shift_heading"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/supervisor_input"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:gravity="left"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="Shift Name *"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/_13sdp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/shift_input"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/shift_heading"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:hint="@string/select_shift"
|
||||||
|
android:padding="5dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/shift_textview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="none"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/form_heading"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/shift_input"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:gravity="left"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="Form Type *"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/_13sdp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/form_input"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/form_heading"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:hint="@string/select_form"
|
||||||
|
android:padding="5dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/form_textview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="none"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_next"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:background="@drawable/rounded_btn_login"
|
||||||
|
android:text="Next"
|
||||||
|
android:textColor="@color/white" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_next"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="50dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_gravity="bottom"
|
|
||||||
android:background="@drawable/rounded_btn_login"
|
|
||||||
android:text="Next"
|
|
||||||
android:textColor="@color/white" />
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
<string name="app_version">Version 1.0</string>
|
<string name="app_version">Version 1.0</string>
|
||||||
|
|
||||||
|
<string name="select_site">Select Site</string>
|
||||||
|
<string name="select_super">Select Supervisor</string>
|
||||||
<string name="select_shift">Select Shift</string>
|
<string name="select_shift">Select Shift</string>
|
||||||
<string name="select_form">Select Form</string>
|
<string name="select_form">Select Form</string>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue