Add persist data functionality
parent
619af3fc95
commit
1eabc8672e
|
@ -77,7 +77,8 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.HSETrainingForms.HseTwoActivity"
|
android:name=".activities.HSETrainingForms.HseTwoActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait"
|
||||||
|
android:windowSoftInputMode="adjustResize"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.HSETrainingForms.HseOneActivity"
|
android:name=".activities.HSETrainingForms.HseOneActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
|
@ -106,7 +107,7 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.LoginActivity"
|
android:name=".activities.LoginActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:screenOrientation="portrait"></activity>
|
android:screenOrientation="portrait"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.DashboardActivity"
|
android:name=".activities.DashboardActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
|
|
@ -17,10 +17,12 @@ import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
import android.text.InputType;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AutoCompleteTextView;
|
import android.widget.AutoCompleteTextView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
@ -44,6 +46,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.utopiaindustries.hseobservationsapp.R;
|
import com.utopiaindustries.hseobservationsapp.R;
|
||||||
import com.utopiaindustries.hseobservationsapp.activities.DashboardActivity;
|
import com.utopiaindustries.hseobservationsapp.activities.DashboardActivity;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.activities.PermitToWorkForms.PermitOneActivity;
|
||||||
import com.utopiaindustries.hseobservationsapp.activities.PermitToWorkForms.PermitTwoActivity;
|
import com.utopiaindustries.hseobservationsapp.activities.PermitToWorkForms.PermitTwoActivity;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.BuildingsAdapter;
|
import com.utopiaindustries.hseobservationsapp.adapters.BuildingsAdapter;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.DepartmentAdapter;
|
import com.utopiaindustries.hseobservationsapp.adapters.DepartmentAdapter;
|
||||||
|
@ -82,29 +85,16 @@ public class HseOneActivity extends AppCompatActivity {
|
||||||
|
|
||||||
ImageView imgBack;
|
ImageView imgBack;
|
||||||
Button btnNext;
|
Button btnNext;
|
||||||
AutoCompleteTextView safetyTextview, targetAudienceTextview, locationTextview, subLocationTextView;
|
AutoCompleteTextView safetyTextview;
|
||||||
|
EditText etTrainingSession, etDescription;
|
||||||
|
|
||||||
private ArrayList<HseSafetyTrainingTopic> safetyTrainingArrayList = new ArrayList<>();
|
private ArrayList<HseSafetyTrainingTopic> safetyTrainingArrayList = new ArrayList<>();
|
||||||
private ArrayList<HseDepartment> departmentArrayList = new ArrayList<>();
|
|
||||||
private ArrayList<HseDepartment> departmentArrayList_temp = new ArrayList<>();
|
|
||||||
|
|
||||||
private DepartmentAdapter departmentAdapter;
|
|
||||||
private SafetyTrainingAdapter safetyTrainingAdapter;
|
private SafetyTrainingAdapter safetyTrainingAdapter;
|
||||||
|
|
||||||
private String safetyTrainingTopic = "";
|
private String safetyTrainingTopic = "";
|
||||||
private String targetAudience = "", location = "", subLocation = "";
|
|
||||||
EditText etNoOfEmployees;
|
EditText etNoOfEmployees;
|
||||||
|
|
||||||
private ArrayList<HseBuilding> locationArrayList_temp = new ArrayList<>();
|
|
||||||
private ArrayList<HseBuilding> locationArrayList = new ArrayList<>();
|
|
||||||
private BuildingsAdapter buildingAdapter;
|
|
||||||
|
|
||||||
private ArrayList<HseFloor> subLocationArrayList_temp = new ArrayList<>();
|
|
||||||
private ArrayList<HseFloor> subLocationArrayList = new ArrayList<>();
|
|
||||||
private FloorsAdapter floorsAdapter;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -118,12 +108,10 @@ public class HseOneActivity extends AppCompatActivity {
|
||||||
|
|
||||||
initializeLayouts();
|
initializeLayouts();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
imgBack.setOnClickListener(new View.OnClickListener() {
|
imgBack.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
finish();
|
alertExit(HseOneActivity.this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -143,30 +131,7 @@ public class HseOneActivity extends AppCompatActivity {
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
safetyTrainingTopic = safetyTrainingArrayList.get(position).getTitle();
|
safetyTrainingTopic = safetyTrainingArrayList.get(position).getTitle();
|
||||||
StorageManager.getInstance().getHseTrainingModel().get(0).setSafetyTopicId(safetyTrainingArrayList.get(position).getId());
|
StorageManager.getInstance().getHseTrainingModel().get(0).setSafetyTopicId(safetyTrainingArrayList.get(position).getId());
|
||||||
}
|
StorageManager.getInstance().getHseTrainingModel().get(0).setSafetyTopicName(safetyTrainingArrayList.get(position).getTitle());
|
||||||
});
|
|
||||||
|
|
||||||
targetAudienceTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
targetAudience = departmentArrayList.get(position).getTitle();
|
|
||||||
StorageManager.getInstance().getHseTrainingModel().get(0).setTargetAudienceId(departmentArrayList.get(position).getId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
locationTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
location = locationArrayList.get(position).getTitle();
|
|
||||||
StorageManager.getInstance().getHseTrainingModel().get(0).setLocationId(locationArrayList.get(position).getId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
subLocationTextView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
subLocation = subLocationArrayList.get(position).getTitle();
|
|
||||||
StorageManager.getInstance().getHseTrainingModel().get(0).setSubLocationId(subLocationArrayList.get(position).getId());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -189,67 +154,99 @@ public class HseOneActivity extends AppCompatActivity {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
etDescription.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
StorageManager.getInstance().getHseTrainingModel().get(0).setDescription(s.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
etTrainingSession.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
if (!s.toString().isEmpty()) {
|
||||||
|
StorageManager.getInstance().getHseTrainingModel().get(0).setTrainingMinutes(Double.parseDouble(s.toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeLayouts() {
|
private void initializeLayouts() {
|
||||||
imgBack = findViewById(R.id.img_back);
|
imgBack = findViewById(R.id.img_back);
|
||||||
btnNext = findViewById(R.id.btn_next);
|
btnNext = findViewById(R.id.btn_next);
|
||||||
etNoOfEmployees = findViewById(R.id.et_no_of_employees);
|
etNoOfEmployees = findViewById(R.id.et_no_of_employees);
|
||||||
|
etTrainingSession = findViewById(R.id.et_training_session);
|
||||||
|
etDescription = findViewById(R.id.et_description);
|
||||||
|
etDescription.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||||
|
etDescription.setRawInputType(InputType.TYPE_CLASS_TEXT);
|
||||||
|
|
||||||
safetyTextview = findViewById(R.id.safety_textview);
|
safetyTextview = findViewById(R.id.safety_textview);
|
||||||
targetAudienceTextview = findViewById(R.id.target_audience_textview);
|
|
||||||
|
|
||||||
locationTextview = findViewById(R.id.location_textview);
|
|
||||||
subLocationTextView = findViewById(R.id.sub_location_textview);
|
|
||||||
|
|
||||||
safetyTrainingArrayList.addAll(Helper.getList(Helper.hseSafetyTrainingTopics, this, HseSafetyTrainingTopic.class));
|
safetyTrainingArrayList.addAll(Helper.getList(Helper.hseSafetyTrainingTopics, this, HseSafetyTrainingTopic.class));
|
||||||
safetyTrainingAdapter = new SafetyTrainingAdapter(this, safetyTrainingArrayList);
|
safetyTrainingAdapter = new SafetyTrainingAdapter(this, safetyTrainingArrayList);
|
||||||
safetyTextview.setAdapter(safetyTrainingAdapter);
|
safetyTextview.setAdapter(safetyTrainingAdapter);
|
||||||
|
|
||||||
departmentArrayList_temp.addAll(Helper.getList(Helper.hseDepartment, this, HseDepartment.class));
|
}
|
||||||
|
|
||||||
if (!departmentArrayList_temp.isEmpty()) {
|
public void alertExit(Context con) {
|
||||||
|
ViewGroup viewGroup = findViewById(android.R.id.content);
|
||||||
|
|
||||||
List<HseDepartment> filteredUnitItems = departmentArrayList_temp.stream()
|
TextView dialogOkBtn, dialogCancelBtn;
|
||||||
.filter(item -> Objects.equals(item.getSiteId(), StorageManager.getInstance().getSite_id()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
departmentArrayList.clear();
|
AlertDialog.Builder builder = new AlertDialog.Builder(con);
|
||||||
departmentArrayList.addAll(filteredUnitItems);
|
View view1 = LayoutInflater.from(con).inflate(R.layout.custom_layout_for_exit, viewGroup, false);
|
||||||
departmentAdapter = new DepartmentAdapter(this, departmentArrayList);
|
builder.setCancelable(false);
|
||||||
targetAudienceTextview.setAdapter(departmentAdapter);
|
builder.setView(view1);
|
||||||
}
|
|
||||||
|
|
||||||
locationArrayList_temp.addAll(Helper.getList(Helper.hseBuildings, this, HseBuilding.class));
|
dialogOkBtn = view1.findViewById(R.id.dialogOkBtn);
|
||||||
|
dialogCancelBtn = view1.findViewById(R.id.dialogCancelBtn);
|
||||||
|
|
||||||
//Location -- Building
|
AlertDialog alertDialog = builder.create();
|
||||||
if (!locationArrayList_temp.isEmpty()) {
|
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
List<HseBuilding> filteredUnitItems = locationArrayList_temp.stream()
|
dialogOkBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
.filter(item -> Objects.equals(item.getSiteId(), StorageManager.getInstance().getSite_id()))
|
@Override
|
||||||
.collect(Collectors.toList());
|
public void onClick(View view) {
|
||||||
|
|
||||||
locationArrayList.clear();
|
alertDialog.dismiss();
|
||||||
locationArrayList.addAll(filteredUnitItems);
|
|
||||||
buildingAdapter = new BuildingsAdapter(this, locationArrayList);
|
|
||||||
locationTextview.setAdapter(buildingAdapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
subLocationArrayList_temp.addAll(Helper.getList(Helper.hseFloors, this, HseFloor.class));
|
StorageManager.getInstance().getHseTrainingModel().clear();
|
||||||
|
finish();
|
||||||
|
|
||||||
//Sub Location -- floor
|
}
|
||||||
if (!subLocationArrayList_temp.isEmpty()) {
|
});
|
||||||
|
|
||||||
List<HseFloor> filteredUnitItems = subLocationArrayList_temp.stream()
|
dialogCancelBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
.filter(item -> Objects.equals(item.getSiteId(), StorageManager.getInstance().getSite_id()))
|
@Override
|
||||||
.collect(Collectors.toList());
|
public void onClick(View view) {
|
||||||
|
|
||||||
subLocationArrayList.clear();
|
alertDialog.dismiss();
|
||||||
subLocationArrayList.addAll(filteredUnitItems);
|
|
||||||
floorsAdapter = new FloorsAdapter(this, subLocationArrayList);
|
|
||||||
subLocationTextView.setAdapter(floorsAdapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alertDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@AfterPermissionGranted(CAMERA_REQUEST_ITEM)
|
/*@AfterPermissionGranted(CAMERA_REQUEST_ITEM)
|
||||||
|
@ -289,23 +286,17 @@ public class HseOneActivity extends AppCompatActivity {
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isValidate() {
|
public boolean isValidate() {
|
||||||
boolean returnValue = true;
|
boolean returnValue = true;
|
||||||
String message = "";
|
String message = "";
|
||||||
|
|
||||||
if (subLocation.isEmpty()) {
|
if (etDescription.getText().toString().isEmpty()) {
|
||||||
message = "Please select floor.";
|
message = "Please enter Description";
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location.isEmpty()) {
|
if (etTrainingSession.getText().toString().isEmpty()) {
|
||||||
message = "Please select building.";
|
message = "Please enter Minutes of Session.";
|
||||||
returnValue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targetAudience.isEmpty()) {
|
|
||||||
message = "Please select department.";
|
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,4 +316,28 @@ public class HseOneActivity extends AppCompatActivity {
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
if (StorageManager.getInstance().getHseTrainingModel() != null &&
|
||||||
|
!StorageManager.getInstance().getHseTrainingModel().isEmpty()) {
|
||||||
|
showPersistData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showPersistData() {
|
||||||
|
safetyTextview.post(() -> safetyTextview.setText(StorageManager.getInstance().getHseTrainingModel().get(0).getSafetyTopicName(), false));
|
||||||
|
|
||||||
|
if (StorageManager.getInstance().getHseTrainingModel().get(0).getEmployeeAttendance() != 0) {
|
||||||
|
etNoOfEmployees.setText(String.valueOf(StorageManager.getInstance().getHseTrainingModel().get(0).getEmployeeAttendance()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StorageManager.getInstance().getHseTrainingModel().get(0).getTrainingMinutes() != 0.0) {
|
||||||
|
etTrainingSession.setText(String.valueOf(StorageManager.getInstance().getHseTrainingModel().get(0).getTrainingMinutes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
etDescription.setText(StorageManager.getInstance().getHseTrainingModel().get(0).getDescription());
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -76,7 +76,7 @@ public class HseTwoActivity extends AppCompatActivity implements EasyPermissions
|
||||||
EasyPermissions.RationaleCallbacks{
|
EasyPermissions.RationaleCallbacks{
|
||||||
|
|
||||||
Button btnSubmit;
|
Button btnSubmit;
|
||||||
EditText etTrainingSession, etDescription;
|
|
||||||
LoginViewModel loginViewModel;
|
LoginViewModel loginViewModel;
|
||||||
ImageView imgBack;
|
ImageView imgBack;
|
||||||
|
|
||||||
|
@ -198,6 +198,7 @@ public class HseTwoActivity extends AppCompatActivity implements EasyPermissions
|
||||||
imgBack.setOnClickListener(new View.OnClickListener() {
|
imgBack.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
StorageManager.getInstance().getHseTrainingModel().get(0).setPictures(imageList);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -226,54 +227,15 @@ public class HseTwoActivity extends AppCompatActivity implements EasyPermissions
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
etTrainingSession.addTextChangedListener(new TextWatcher() {
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
if (!s.toString().isEmpty()) {
|
|
||||||
StorageManager.getInstance().getHseTrainingModel().get(0).setTrainingMinutes(Double.parseDouble(s.toString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
etDescription.addTextChangedListener(new TextWatcher() {
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
StorageManager.getInstance().getHseTrainingModel().get(0).setDescription(s.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeLayouts() {
|
private void initializeLayouts() {
|
||||||
|
|
||||||
btnSubmit = findViewById(R.id.btn_submit);
|
btnSubmit = findViewById(R.id.btn_submit);
|
||||||
etTrainingSession = findViewById(R.id.et_training_session);
|
|
||||||
imgBack = findViewById(R.id.img_back);
|
imgBack = findViewById(R.id.img_back);
|
||||||
imgUpload = findViewById(R.id.img_upload);
|
imgUpload = findViewById(R.id.img_upload);
|
||||||
|
|
||||||
etDescription = findViewById(R.id.et_description);
|
|
||||||
etDescription.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
|
||||||
etDescription.setRawInputType(InputType.TYPE_CLASS_TEXT);
|
|
||||||
|
|
||||||
trainingPicRecyclerView = findViewById(R.id.tPicturesRecyclerView);
|
trainingPicRecyclerView = findViewById(R.id.tPicturesRecyclerView);
|
||||||
|
|
||||||
imagePaperAdapter = new PTWImageAdapter(imageList, this, "");
|
imagePaperAdapter = new PTWImageAdapter(imageList, this, "");
|
||||||
|
@ -337,6 +299,9 @@ public class HseTwoActivity extends AppCompatActivity implements EasyPermissions
|
||||||
hseTrainingRequest.setSupervisorId(StorageManager.getInstance().getSupervisorId());
|
hseTrainingRequest.setSupervisorId(StorageManager.getInstance().getSupervisorId());
|
||||||
hseTrainingRequest.setSupervisorName(StorageManager.getInstance().getSupervisorName());
|
hseTrainingRequest.setSupervisorName(StorageManager.getInstance().getSupervisorName());
|
||||||
hseTrainingRequest.setShift(StorageManager.getInstance().getShift());
|
hseTrainingRequest.setShift(StorageManager.getInstance().getShift());
|
||||||
|
hseTrainingRequest.setDepartmentId(StorageManager.getInstance().getDepartmentId());
|
||||||
|
hseTrainingRequest.setBuildingId(StorageManager.getInstance().getBuildingId());
|
||||||
|
hseTrainingRequest.setFloorId(StorageManager.getInstance().getFloorId());
|
||||||
hseTrainingRequest.setRecordTypeId(StorageManager.getInstance().getRecordTypeId());
|
hseTrainingRequest.setRecordTypeId(StorageManager.getInstance().getRecordTypeId());
|
||||||
hseTrainingRequest.setReportData(reportList);
|
hseTrainingRequest.setReportData(reportList);
|
||||||
|
|
||||||
|
@ -344,7 +309,7 @@ public class HseTwoActivity extends AppCompatActivity implements EasyPermissions
|
||||||
String jsonRequest = gson.toJson(hseTrainingRequest);
|
String jsonRequest = gson.toJson(hseTrainingRequest);
|
||||||
Log.e("RequestModel JSON", jsonRequest);
|
Log.e("RequestModel JSON", jsonRequest);
|
||||||
|
|
||||||
loginViewModel.saveHSEData(hseTrainingRequest);
|
//loginViewModel.saveHSEData(hseTrainingRequest);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -381,16 +346,6 @@ public class HseTwoActivity extends AppCompatActivity implements EasyPermissions
|
||||||
boolean returnValue = true;
|
boolean returnValue = true;
|
||||||
String message = "";
|
String message = "";
|
||||||
|
|
||||||
if (etDescription.getText().toString().isEmpty()) {
|
|
||||||
message = "Please enter Description";
|
|
||||||
returnValue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (etTrainingSession.getText().toString().isEmpty()) {
|
|
||||||
message = "Please enter Minutes of Session.";
|
|
||||||
returnValue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!returnValue) {
|
if (!returnValue) {
|
||||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
@ -684,4 +639,27 @@ public class HseTwoActivity extends AppCompatActivity implements EasyPermissions
|
||||||
public void onRationaleDenied(int requestCode) {
|
public void onRationaleDenied(int requestCode) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
if (StorageManager.getInstance().getPermitToWorkModel() != null &&
|
||||||
|
!StorageManager.getInstance().getPermitToWorkModel().isEmpty()) {
|
||||||
|
showPersistData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showPersistData() {
|
||||||
|
|
||||||
|
if (StorageManager.getInstance().getHseTrainingModel().get(0).getPictures() != null
|
||||||
|
&& !StorageManager.getInstance().getHseTrainingModel().get(0).getPictures().isEmpty()) {
|
||||||
|
imageList.clear();
|
||||||
|
imageList.addAll(StorageManager.getInstance().getHseTrainingModel().get(0).getPictures());
|
||||||
|
imagePaperAdapter = new PTWImageAdapter(imageList, this, "");
|
||||||
|
trainingPicRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
|
||||||
|
trainingPicRecyclerView.setAdapter(imagePaperAdapter);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,41 +1,78 @@
|
||||||
package com.utopiaindustries.hseobservationsapp.activities.ObservationForms;
|
package com.utopiaindustries.hseobservationsapp.activities.ObservationForms;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.provider.MediaStore;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AutoCompleteTextView;
|
import android.widget.AutoCompleteTextView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.activity.EdgeToEdge;
|
import androidx.activity.EdgeToEdge;
|
||||||
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.content.FileProvider;
|
||||||
import androidx.core.graphics.Insets;
|
import androidx.core.graphics.Insets;
|
||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
import com.utopiaindustries.hseobservationsapp.R;
|
import com.utopiaindustries.hseobservationsapp.R;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.activities.DashboardActivity;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.activities.LoginActivity;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.BuildingsAdapter;
|
import com.utopiaindustries.hseobservationsapp.adapters.BuildingsAdapter;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.FloorsAdapter;
|
import com.utopiaindustries.hseobservationsapp.adapters.FloorsAdapter;
|
||||||
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.helper.Helper;
|
import com.utopiaindustries.hseobservationsapp.helper.Helper;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.helper.Preference;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseBuilding;
|
import com.utopiaindustries.hseobservationsapp.models.HseData.HseBuilding;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseFloor;
|
import com.utopiaindustries.hseobservationsapp.models.HseData.HseFloor;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseObservationClass;
|
import com.utopiaindustries.hseobservationsapp.models.HseData.HseObservationClass;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseObservationSubClass;
|
import com.utopiaindustries.hseobservationsapp.models.HseData.HseObservationSubClass;
|
||||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.StorageManager;
|
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.StorageManager;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class ObservationOneActivity extends AppCompatActivity {
|
import pub.devrel.easypermissions.AfterPermissionGranted;
|
||||||
|
import pub.devrel.easypermissions.AppSettingsDialog;
|
||||||
|
import pub.devrel.easypermissions.EasyPermissions;
|
||||||
|
|
||||||
private AutoCompleteTextView observationTextview, observationSubTextview, buildingTextview, floorTextview;
|
public class ObservationOneActivity extends AppCompatActivity implements EasyPermissions.PermissionCallbacks,
|
||||||
|
EasyPermissions.RationaleCallbacks{
|
||||||
|
|
||||||
|
private AutoCompleteTextView observationTextview, observationSubTextview;
|
||||||
|
|
||||||
private ObservationClassAdapter observationClassAdapter;
|
private ObservationClassAdapter observationClassAdapter;
|
||||||
private ObservationSubClassAdapter observationSubClassAdapter;
|
private ObservationSubClassAdapter observationSubClassAdapter;
|
||||||
|
@ -44,19 +81,165 @@ public class ObservationOneActivity extends AppCompatActivity {
|
||||||
private ArrayList<HseObservationSubClass> obSubClassArrayList_temp = new ArrayList<>();
|
private ArrayList<HseObservationSubClass> obSubClassArrayList_temp = new ArrayList<>();
|
||||||
private ArrayList<HseObservationSubClass> obSubClassArrayList = new ArrayList<>();
|
private ArrayList<HseObservationSubClass> obSubClassArrayList = new ArrayList<>();
|
||||||
|
|
||||||
private ArrayList<HseBuilding> hseBuildingArrayList_temp = new ArrayList<>();
|
|
||||||
private ArrayList<HseBuilding> hseBuildingArrayList = new ArrayList<>();
|
|
||||||
|
|
||||||
private ArrayList<HseFloor> hseFloorArrayList_temp = new ArrayList<>();
|
|
||||||
private ArrayList<HseFloor> hseFloorArrayList = new ArrayList<>();
|
|
||||||
|
|
||||||
private Button btnNext;
|
private Button btnNext;
|
||||||
ImageView imgBack;
|
ImageView imgBack;
|
||||||
|
|
||||||
String observationClass = "", observationSubClass = "", building = "", floor = "";
|
String observationClass = "", observationSubClass = "";
|
||||||
int observationClassId = 0, observationSubClassId = 0;
|
int observationClassId = 0, observationSubClassId = 0;
|
||||||
private BuildingsAdapter buildingAdapter;
|
|
||||||
private FloorsAdapter floorsAdapter;
|
ImageView imgBefore, beforeCrossButton, imgAfter, afterCrossButton;
|
||||||
|
private static final int CAMERA_REQUEST = 100;
|
||||||
|
private static final int GALLERY_REQUEST = 200;
|
||||||
|
|
||||||
|
String filePathBefore = "no_pic";
|
||||||
|
String filePathAfter = "no_pic";
|
||||||
|
|
||||||
|
|
||||||
|
String imgType = "";
|
||||||
|
|
||||||
|
// Activity Result Launcher for Gallery
|
||||||
|
private final ActivityResultLauncher<Intent> imagePickerLauncher =
|
||||||
|
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
|
||||||
|
if (result.getResultCode() == RESULT_OK && result.getData() != null) {
|
||||||
|
Uri selectedImage = result.getData().getData();
|
||||||
|
|
||||||
|
if (imgType.equalsIgnoreCase("before")) {
|
||||||
|
|
||||||
|
uriToByteArrayAsync(
|
||||||
|
this,
|
||||||
|
selectedImage,
|
||||||
|
100, // Target size in KB
|
||||||
|
compressedImage -> {
|
||||||
|
// Handle the compressed image here, e.g., display it
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
Glide.with(this)
|
||||||
|
.load(compressedImage) // Glide will handle the decoding and placeholder
|
||||||
|
.placeholder(R.drawable.img_load)
|
||||||
|
.apply(new RequestOptions().centerCrop())
|
||||||
|
.into(imgBefore);
|
||||||
|
|
||||||
|
List<byte[]> tempList = new ArrayList<>();
|
||||||
|
tempList.add(compressedImage);
|
||||||
|
StorageManager.getInstance().getObservationsModel().get(0).setBeforePictures(tempList);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error -> {
|
||||||
|
// Handle any errors
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
Toast.makeText(this, "Error compressing image: " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
uriToByteArrayAsync(
|
||||||
|
this,
|
||||||
|
selectedImage,
|
||||||
|
100, // Target size in KB
|
||||||
|
compressedImage -> {
|
||||||
|
// Handle the compressed image here, e.g., display it
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
Glide.with(this)
|
||||||
|
.load(compressedImage) // Glide will handle the decoding and placeholder
|
||||||
|
.placeholder(R.drawable.img_load)
|
||||||
|
.apply(new RequestOptions().centerCrop())
|
||||||
|
.into(imgAfter);
|
||||||
|
|
||||||
|
List<byte[]> tempList = new ArrayList<>();
|
||||||
|
tempList.add(compressedImage);
|
||||||
|
StorageManager.getInstance().getObservationsModel().get(0).setAfterPictures(tempList);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error -> {
|
||||||
|
// Handle any errors
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
Toast.makeText(this, "Error compressing image: " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (result.getResultCode() == RESULT_CANCELED) {
|
||||||
|
Toast.makeText(this, "Gallery Selection Cancelled!", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Toast.makeText(this, "Gallery Selection Cancelled!", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Activity Result Launcher for Camera
|
||||||
|
private final ActivityResultLauncher<Intent> cameraLauncher =
|
||||||
|
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
|
||||||
|
|
||||||
|
if (result.getResultCode() == RESULT_OK) {
|
||||||
|
|
||||||
|
if (imgType.equalsIgnoreCase("before")) {
|
||||||
|
Uri contentUri = Uri.fromFile(new File((filePathBefore)));
|
||||||
|
|
||||||
|
uriToByteArrayAsync(
|
||||||
|
this,
|
||||||
|
contentUri,
|
||||||
|
100, // Target size in KB
|
||||||
|
compressedImage -> {
|
||||||
|
// Handle the compressed image here, e.g., display it
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
Glide.with(this)
|
||||||
|
.load(contentUri) // Glide will handle the decoding and placeholder
|
||||||
|
.placeholder(R.drawable.img_load)
|
||||||
|
.apply(new RequestOptions().centerCrop())
|
||||||
|
.into(imgBefore);
|
||||||
|
|
||||||
|
List<byte[]> tempList = new ArrayList<>();
|
||||||
|
tempList.add(compressedImage);
|
||||||
|
StorageManager.getInstance().getObservationsModel().get(0).setBeforePictures(tempList);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error -> {
|
||||||
|
// Handle any errors
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
Toast.makeText(this, "Error compressing image: " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Uri contentUri = Uri.fromFile(new File((filePathAfter)));
|
||||||
|
|
||||||
|
uriToByteArrayAsync(
|
||||||
|
this,
|
||||||
|
contentUri,
|
||||||
|
100, // Target size in KB
|
||||||
|
compressedImage -> {
|
||||||
|
// Handle the compressed image here, e.g., display it
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
Glide.with(this)
|
||||||
|
.load(contentUri) // Glide will handle the decoding and placeholder
|
||||||
|
.placeholder(R.drawable.img_load)
|
||||||
|
.apply(new RequestOptions().centerCrop())
|
||||||
|
.into(imgAfter);
|
||||||
|
|
||||||
|
List<byte[]> tempList = new ArrayList<>();
|
||||||
|
tempList.add(compressedImage);
|
||||||
|
StorageManager.getInstance().getObservationsModel().get(0).setAfterPictures(tempList);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error -> {
|
||||||
|
// Handle any errors
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
Toast.makeText(this, "Error compressing image: " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (result.getResultCode() == RESULT_CANCELED) {
|
||||||
|
Toast.makeText(this, "Camera capture failed!", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Toast.makeText(this, "Camera capture failed!", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -74,7 +257,39 @@ public class ObservationOneActivity extends AppCompatActivity {
|
||||||
imgBack.setOnClickListener(new View.OnClickListener() {
|
imgBack.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
finish();
|
alertExit(ObservationOneActivity.this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
imgBefore.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
imgType = "before";
|
||||||
|
alertForPictures(ObservationOneActivity.this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
imgAfter.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
imgType = "after";
|
||||||
|
alertForPictures(ObservationOneActivity.this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeCrossButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
imgBefore.setImageResource(R.drawable.icon_image);
|
||||||
|
StorageManager.getInstance().getObservationsModel().get(0).getBeforePictures().clear();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterCrossButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
imgAfter.setImageResource(R.drawable.icon_image);
|
||||||
|
StorageManager.getInstance().getObservationsModel().get(0).getAfterPictures().clear();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -134,70 +349,66 @@ public class ObservationOneActivity extends AppCompatActivity {
|
||||||
StorageManager.getInstance().getObservationsModel().get(0).setHseObservationSubClassName(observationSubClass);
|
StorageManager.getInstance().getObservationsModel().get(0).setHseObservationSubClassName(observationSubClass);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
buildingTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
public void alertExit(Context con) {
|
||||||
|
ViewGroup viewGroup = findViewById(android.R.id.content);
|
||||||
|
|
||||||
|
TextView dialogOkBtn, dialogCancelBtn;
|
||||||
|
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(con);
|
||||||
|
View view1 = LayoutInflater.from(con).inflate(R.layout.custom_layout_for_exit, viewGroup, false);
|
||||||
|
builder.setCancelable(false);
|
||||||
|
builder.setView(view1);
|
||||||
|
|
||||||
|
dialogOkBtn = view1.findViewById(R.id.dialogOkBtn);
|
||||||
|
dialogCancelBtn = view1.findViewById(R.id.dialogCancelBtn);
|
||||||
|
|
||||||
|
AlertDialog alertDialog = builder.create();
|
||||||
|
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
|
dialogOkBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onClick(View view) {
|
||||||
building = hseBuildingArrayList.get(position).getTitle();
|
|
||||||
StorageManager.getInstance().getObservationsModel().get(0).setBuildingId(hseBuildingArrayList.get(position).getId());
|
alertDialog.dismiss();
|
||||||
StorageManager.getInstance().getObservationsModel().get(0).setBuildingName(hseBuildingArrayList.get(position).getTitle());
|
|
||||||
|
StorageManager.getInstance().getObservationsModel().clear();
|
||||||
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
floorTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
dialogCancelBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onClick(View view) {
|
||||||
floor = hseFloorArrayList.get(position).getTitle();
|
|
||||||
StorageManager.getInstance().getObservationsModel().get(0).setFloorId(hseFloorArrayList.get(position).getId());
|
alertDialog.dismiss();
|
||||||
StorageManager.getInstance().getObservationsModel().get(0).setFloorName(hseFloorArrayList.get(position).getTitle());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
alertDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initializeLayout() {
|
public void initializeLayout() {
|
||||||
observationTextview = findViewById(R.id.observation_textview);
|
observationTextview = findViewById(R.id.observation_textview);
|
||||||
observationSubTextview = findViewById(R.id.observation_sub_textview);
|
observationSubTextview = findViewById(R.id.observation_sub_textview);
|
||||||
buildingTextview = findViewById(R.id.building_textview);
|
|
||||||
floorTextview = findViewById(R.id.floor_textview);
|
|
||||||
btnNext = findViewById(R.id.btn_next);
|
btnNext = findViewById(R.id.btn_next);
|
||||||
imgBack = findViewById(R.id.img_back);
|
imgBack = findViewById(R.id.img_back);
|
||||||
|
|
||||||
|
imgBefore = findViewById(R.id.img_before);
|
||||||
|
imgAfter = findViewById(R.id.img_after);
|
||||||
|
|
||||||
|
beforeCrossButton = findViewById(R.id.before_cross_button);
|
||||||
|
afterCrossButton = findViewById(R.id.after_cross_button);
|
||||||
|
|
||||||
obClassArrayList.addAll(Helper.getList(Helper.observationClass, this, HseObservationClass.class));
|
obClassArrayList.addAll(Helper.getList(Helper.observationClass, this, HseObservationClass.class));
|
||||||
obSubClassArrayList_temp.addAll(Helper.getList(Helper.observationSubClass, this, HseObservationSubClass.class));
|
obSubClassArrayList_temp.addAll(Helper.getList(Helper.observationSubClass, this, HseObservationSubClass.class));
|
||||||
|
|
||||||
observationClassAdapter = new ObservationClassAdapter(this, obClassArrayList);
|
observationClassAdapter = new ObservationClassAdapter(this, obClassArrayList);
|
||||||
observationTextview.setAdapter(observationClassAdapter);
|
observationTextview.setAdapter(observationClassAdapter);
|
||||||
|
|
||||||
hseBuildingArrayList_temp.addAll(Helper.getList(Helper.hseBuildings, this, HseBuilding.class));
|
|
||||||
hseFloorArrayList_temp.addAll(Helper.getList(Helper.hseFloors, this, HseFloor.class));
|
|
||||||
|
|
||||||
//Location -- Building
|
|
||||||
if (!hseBuildingArrayList_temp.isEmpty()) {
|
|
||||||
|
|
||||||
List<HseBuilding> filteredUnitItems = hseBuildingArrayList_temp.stream()
|
|
||||||
.filter(item -> Objects.equals(item.getSiteId(), StorageManager.getInstance().getSite_id()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
hseBuildingArrayList.clear();
|
|
||||||
hseBuildingArrayList.addAll(filteredUnitItems);
|
|
||||||
buildingAdapter = new BuildingsAdapter(this, hseBuildingArrayList);
|
|
||||||
buildingTextview.setAdapter(buildingAdapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Sub Location -- floor
|
|
||||||
if (!hseFloorArrayList_temp.isEmpty()) {
|
|
||||||
|
|
||||||
List<HseFloor> filteredUnitItems = hseFloorArrayList_temp.stream()
|
|
||||||
.filter(item -> Objects.equals(item.getSiteId(), StorageManager.getInstance().getSite_id()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
hseFloorArrayList.clear();
|
|
||||||
hseFloorArrayList.addAll(filteredUnitItems);
|
|
||||||
floorsAdapter = new FloorsAdapter(this, hseFloorArrayList);
|
|
||||||
floorTextview.setAdapter(floorsAdapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
//observation sub class items
|
//observation sub class items
|
||||||
//for Unsafe
|
//for Unsafe
|
||||||
//for condition
|
//for condition
|
||||||
|
@ -206,20 +417,234 @@ public class ObservationOneActivity extends AppCompatActivity {
|
||||||
//observationSubTextview.setAdapter(observationSubClassAdapter);
|
//observationSubTextview.setAdapter(observationSubClassAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingInflatedId")
|
||||||
|
public void alertForPictures(Context con) {
|
||||||
|
ViewGroup viewGroup = findViewById(android.R.id.content);
|
||||||
|
|
||||||
|
TextView dialogCameraBtn, dialogGalleryBtn;
|
||||||
|
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(con);
|
||||||
|
View view1 = LayoutInflater.from(con).inflate(R.layout.custom_layout_for_image, viewGroup, false);
|
||||||
|
builder.setCancelable(false);
|
||||||
|
builder.setView(view1);
|
||||||
|
|
||||||
|
dialogCameraBtn = view1.findViewById(R.id.dialog_camera_btn);
|
||||||
|
dialogGalleryBtn = view1.findViewById(R.id.dialog_gallery_btn);
|
||||||
|
|
||||||
|
AlertDialog alertDialog = builder.create();
|
||||||
|
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
|
dialogCameraBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
|
||||||
|
alertDialog.dismiss();
|
||||||
|
openCamera();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogGalleryBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
|
||||||
|
alertDialog.dismiss();
|
||||||
|
openGallery();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alertDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterPermissionGranted(CAMERA_REQUEST)
|
||||||
|
public void openCamera() {
|
||||||
|
if (hasCameraPermission()) {
|
||||||
|
try {
|
||||||
|
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||||
|
File photoFile = null;
|
||||||
|
try {
|
||||||
|
photoFile = createImageFile(imgType);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
// Error occurred while creating the File
|
||||||
|
}
|
||||||
|
|
||||||
|
if (photoFile != null) {
|
||||||
|
Uri photoURI = FileProvider.getUriForFile(this,
|
||||||
|
"com.utopiaindustries.hseobservationsapp",
|
||||||
|
photoFile);
|
||||||
|
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
|
||||||
|
//startActivityForResult(takePictureIntent, CAMERA_REQUEST);
|
||||||
|
cameraLauncher.launch(takePictureIntent);
|
||||||
|
}
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
Toast.makeText(this, "Camera app not found", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Ask for one permission
|
||||||
|
String[] perms = {};
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
perms = new String[]{Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.CAMERA};
|
||||||
|
} else {
|
||||||
|
perms = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA};
|
||||||
|
}
|
||||||
|
|
||||||
|
EasyPermissions.requestPermissions(this, getString(R.string.rationale_camera), CAMERA_REQUEST, perms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterPermissionGranted(GALLERY_REQUEST)
|
||||||
|
public void openGallery() {
|
||||||
|
if (hasGalleryPermission()) {
|
||||||
|
// Have permission, do the thing!
|
||||||
|
Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||||
|
// Start the Intent
|
||||||
|
//startActivityForResult(galleryIntent, GALLERY_REQUEST);
|
||||||
|
imagePickerLauncher.launch(galleryIntent);
|
||||||
|
} else {
|
||||||
|
// Ask for one permission
|
||||||
|
String[] perms = {};
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
perms = new String[]{Manifest.permission.READ_MEDIA_IMAGES};
|
||||||
|
} else {
|
||||||
|
perms = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE};
|
||||||
|
|
||||||
|
}
|
||||||
|
EasyPermissions.requestPermissions(this, getString(R.string.rationale_gallery), GALLERY_REQUEST, perms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasGalleryPermission() {
|
||||||
|
String[] perms = {};
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
perms = new String[]{Manifest.permission.READ_MEDIA_IMAGES};
|
||||||
|
} else {
|
||||||
|
perms = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE};
|
||||||
|
}
|
||||||
|
|
||||||
|
return EasyPermissions.hasPermissions(this, perms);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasCameraPermission() {
|
||||||
|
String[] perms = {};
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
//Log.e("TIRAMISU: ","***");
|
||||||
|
perms = new String[]{Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.CAMERA};
|
||||||
|
} else {
|
||||||
|
//Log.e("Not-TIRAMISU: ","***");
|
||||||
|
perms = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Log.e("perms: ",""+perms);
|
||||||
|
return EasyPermissions.hasPermissions(this, perms);
|
||||||
|
}
|
||||||
|
|
||||||
|
private File createImageFile(String imgType) throws IOException {
|
||||||
|
// Create an image file name
|
||||||
|
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
|
||||||
|
String imageFileName = "JPEG_" + timeStamp + "_";
|
||||||
|
File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
||||||
|
File image = File.createTempFile(
|
||||||
|
imageFileName, /* prefix */
|
||||||
|
".jpg", /* suffix */
|
||||||
|
storageDir /* directory */
|
||||||
|
);
|
||||||
|
|
||||||
|
if (imgType.equals("before")) {
|
||||||
|
filePathBefore = image.getAbsolutePath();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
filePathAfter = image.getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void uriToByteArrayAsync(
|
||||||
|
Context context,
|
||||||
|
Uri uri,
|
||||||
|
int targetSizeInKB,
|
||||||
|
Consumer<byte[]> onSuccess,
|
||||||
|
Consumer<Exception> onError
|
||||||
|
) {
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
int targetSizeInBytes = targetSizeInKB * 1024;
|
||||||
|
|
||||||
|
// Load the image as a Bitmap without scaling
|
||||||
|
Bitmap bitmap;
|
||||||
|
try (InputStream inputStream = context.getContentResolver().openInputStream(uri)) {
|
||||||
|
bitmap = BitmapFactory.decodeStream(inputStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bitmap == null) {
|
||||||
|
throw new IOException("Failed to decode image from URI.");
|
||||||
|
}
|
||||||
|
|
||||||
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||||
|
int minQuality = 10;
|
||||||
|
int maxQuality = 100;
|
||||||
|
int quality = maxQuality;
|
||||||
|
|
||||||
|
// Binary search for the best quality that meets the target size
|
||||||
|
while (minQuality <= maxQuality) {
|
||||||
|
byteArrayOutputStream.reset();
|
||||||
|
bitmap.compress(Bitmap.CompressFormat.JPEG, quality, byteArrayOutputStream);
|
||||||
|
|
||||||
|
int byteSize = byteArrayOutputStream.size();
|
||||||
|
if (byteSize > targetSizeInBytes) {
|
||||||
|
maxQuality = quality - 1;
|
||||||
|
} else {
|
||||||
|
minQuality = quality + 1;
|
||||||
|
}
|
||||||
|
quality = (minQuality + maxQuality) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
onSuccess.accept(byteArrayOutputStream.toByteArray());
|
||||||
|
} catch (IOException e) {
|
||||||
|
onError.accept(e);
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPermissionsGranted(int requestCode, @NonNull List<String> perms) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
|
||||||
|
if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
|
||||||
|
new AppSettingsDialog.Builder(this).build().show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode,
|
||||||
|
@NonNull String[] permissions,
|
||||||
|
@NonNull int[] grantResults) {
|
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
|
|
||||||
|
// EasyPermissions handles the request result.
|
||||||
|
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRationaleAccepted(int requestCode) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRationaleDenied(int requestCode) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isValidate() {
|
public boolean isValidate() {
|
||||||
boolean returnValue = true;
|
boolean returnValue = true;
|
||||||
String message = "";
|
String message = "";
|
||||||
|
|
||||||
if (floor.isEmpty()) {
|
|
||||||
message = "Please select floor.";
|
|
||||||
returnValue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (building.isEmpty()) {
|
|
||||||
message = "Please select building.";
|
|
||||||
returnValue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (observationSubClass.isEmpty()) {
|
if (observationSubClass.isEmpty()) {
|
||||||
message = "Please select observation sub class.";
|
message = "Please select observation sub class.";
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
|
@ -236,4 +661,52 @@ public class ObservationOneActivity extends AppCompatActivity {
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showPersistData() {
|
||||||
|
//locationSiteTextview.post(() -> locationSiteTextview.setText(Preference.getMyStringPref(Helper.project_file, Helper.locationSiteName, getActivity()), false));
|
||||||
|
observationTextview.post(() -> observationTextview.setText(StorageManager.getInstance().getObservationsModel().get(0).getHseObservationName(), false));
|
||||||
|
observationSubTextview.post(() -> observationSubTextview.setText(StorageManager.getInstance().getObservationsModel().get(0).getHseObservationSubClassName(), false));
|
||||||
|
|
||||||
|
if (!obSubClassArrayList_temp.isEmpty()) {
|
||||||
|
|
||||||
|
List<HseObservationSubClass> filteredUnitItems = obSubClassArrayList_temp.stream()
|
||||||
|
.filter(item -> Objects.equals(item.getObservationClassId(), StorageManager.getInstance().getObservationsModel().get(0).getObservationClassId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
obSubClassArrayList.clear();
|
||||||
|
obSubClassArrayList.addAll(filteredUnitItems);
|
||||||
|
observationSubClassAdapter = new ObservationSubClassAdapter(ObservationOneActivity.this, filteredUnitItems);
|
||||||
|
observationSubTextview.setAdapter(observationSubClassAdapter);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StorageManager.getInstance().getObservationsModel().get(0).getBeforePictures() != null
|
||||||
|
&& !StorageManager.getInstance().getObservationsModel().get(0).getBeforePictures().isEmpty()) {
|
||||||
|
Glide.with(this)
|
||||||
|
.load(StorageManager.getInstance().getObservationsModel().get(0).getBeforePictures().get(0))
|
||||||
|
.placeholder(R.drawable.img_load)
|
||||||
|
.apply(new RequestOptions().centerCrop())
|
||||||
|
.into(imgBefore);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StorageManager.getInstance().getObservationsModel().get(0).getAfterPictures() != null
|
||||||
|
&& !StorageManager.getInstance().getObservationsModel().get(0).getAfterPictures().isEmpty()) {
|
||||||
|
Glide.with(this)
|
||||||
|
.load(StorageManager.getInstance().getObservationsModel().get(0).getAfterPictures().get(0)) // Glide will handle the decoding and placeholder
|
||||||
|
.placeholder(R.drawable.img_load)
|
||||||
|
.apply(new RequestOptions().centerCrop())
|
||||||
|
.into(imgAfter);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
if (StorageManager.getInstance().getObservationsModel() != null &&
|
||||||
|
!StorageManager.getInstance().getObservationsModel().isEmpty()) {
|
||||||
|
showPersistData();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -47,13 +47,12 @@ import java.util.List;
|
||||||
|
|
||||||
public class ObservationThreeActivity extends AppCompatActivity {
|
public class ObservationThreeActivity extends AppCompatActivity {
|
||||||
|
|
||||||
RadioGroup rg1;
|
|
||||||
ImageView imgBack;
|
ImageView imgBack;
|
||||||
Button btnSubmit, btnDraft;
|
Button btnSubmit, btnDraft;
|
||||||
EditText etDescription;
|
|
||||||
String obStatus = "";
|
|
||||||
|
|
||||||
LoginViewModel loginViewModel;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -75,42 +74,10 @@ public class ObservationThreeActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
etDescription.addTextChangedListener(new TextWatcher() {
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
StorageManager.getInstance().getObservationsModel().get(0).setDescription(s.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
rg1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener()
|
|
||||||
{
|
|
||||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
|
||||||
if (checkedId == R.id.rb_open) {
|
|
||||||
obStatus = "true";
|
|
||||||
StorageManager.getInstance().getObservationsModel().get(0).setObservationStatus(true);
|
|
||||||
} else if (checkedId == R.id.rb_closed) {
|
|
||||||
obStatus = "false";
|
|
||||||
StorageManager.getInstance().getObservationsModel().get(0).setObservationStatus(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnSubmit.setOnClickListener(new View.OnClickListener() {
|
btnSubmit.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (isValidate()) {
|
|
||||||
alertReportSubmit(ObservationThreeActivity.this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -124,95 +91,15 @@ public class ObservationThreeActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private void initializeLayouts() {
|
private void initializeLayouts() {
|
||||||
|
|
||||||
rg1 = findViewById(R.id.rg1);
|
|
||||||
imgBack = findViewById(R.id.img_back);
|
imgBack = findViewById(R.id.img_back);
|
||||||
etDescription = findViewById(R.id.et_description);
|
|
||||||
etDescription.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
|
||||||
etDescription.setRawInputType(InputType.TYPE_CLASS_TEXT);
|
|
||||||
|
|
||||||
btnSubmit = findViewById(R.id.btn_submit);
|
btnSubmit = findViewById(R.id.btn_submit);
|
||||||
btnDraft = findViewById(R.id.btn_draft);
|
btnDraft = findViewById(R.id.btn_draft);
|
||||||
|
|
||||||
loginViewModel = new ViewModelProvider(this).get(LoginViewModel.class);
|
|
||||||
|
|
||||||
loginViewModel.getLoadingState().observe(this, isLoading -> {
|
|
||||||
|
|
||||||
if (isLoading != null && isLoading) {
|
|
||||||
showProgressDialog();
|
|
||||||
} else {
|
|
||||||
dismissProgressDialog();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
loginViewModel.getErrorMessage().observe(this, errorResponse -> {
|
|
||||||
Toast.makeText(this, errorResponse, Toast.LENGTH_SHORT).show();
|
|
||||||
});
|
|
||||||
|
|
||||||
loginViewModel.getUserSaveLiveData().observe(this, hseSaveResponse -> {
|
|
||||||
if (hseSaveResponse != null && hseSaveResponse.getStatus().equals("success")) {
|
|
||||||
Toast.makeText(this, "Reported Submitted", Toast.LENGTH_SHORT).show();
|
|
||||||
Intent intent = new Intent(ObservationThreeActivity.this, DashboardActivity.class);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
startActivity(intent);
|
|
||||||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void alertReportSubmit(Context con) {
|
|
||||||
ViewGroup viewGroup = findViewById(android.R.id.content);
|
|
||||||
|
|
||||||
TextView dialogOkBtn, dialogCancelBtn;
|
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(con);
|
|
||||||
View view1 = LayoutInflater.from(con).inflate(R.layout.custom_layout_for_report_submission, viewGroup, false);
|
|
||||||
builder.setCancelable(false);
|
|
||||||
builder.setView(view1);
|
|
||||||
|
|
||||||
dialogOkBtn = view1.findViewById(R.id.dialogOkBtn);
|
|
||||||
dialogCancelBtn = view1.findViewById(R.id.dialogCancelBtn);
|
|
||||||
|
|
||||||
AlertDialog alertDialog = builder.create();
|
|
||||||
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
|
|
||||||
dialogOkBtn.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
|
|
||||||
alertDialog.dismiss();
|
|
||||||
|
|
||||||
List<ObservationModel> observationList = StorageManager.getInstance().getObservationsModel();
|
|
||||||
HseReportRequest<ObservationModel> observationRequest = new HseReportRequest<>();
|
|
||||||
observationRequest.setObservation_date(StorageManager.getInstance().getObservation_date());
|
|
||||||
observationRequest.setUserId(StorageManager.getInstance().getUserId());
|
|
||||||
observationRequest.setSite_id(StorageManager.getInstance().getSite_id());
|
|
||||||
observationRequest.setSupervisorId(StorageManager.getInstance().getSupervisorId());
|
|
||||||
observationRequest.setSupervisorName(StorageManager.getInstance().getSupervisorName());
|
|
||||||
observationRequest.setShift(StorageManager.getInstance().getShift());
|
|
||||||
observationRequest.setRecordTypeId(StorageManager.getInstance().getRecordTypeId());
|
|
||||||
observationRequest.setReportData(observationList);
|
|
||||||
|
|
||||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
|
||||||
String jsonRequest = gson.toJson(observationRequest);
|
|
||||||
Log.e("RequestModel JSON", jsonRequest);
|
|
||||||
|
|
||||||
loginViewModel.saveHSEData(observationRequest);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dialogCancelBtn.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
|
|
||||||
alertDialog.dismiss();
|
|
||||||
//Toast.makeText(con, "Cancel", Toast.LENGTH_SHORT).show();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
alertDialog.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] convertReportToByteArray() {
|
private byte[] convertReportToByteArray() {
|
||||||
byte[] bytes = new byte[0];
|
byte[] bytes = new byte[0];
|
||||||
|
@ -242,33 +129,13 @@ public class ObservationThreeActivity extends AppCompatActivity {
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showProgressDialog() {
|
|
||||||
ProgressDialogFragment progressDialog = new ProgressDialogFragment();
|
|
||||||
progressDialog.setCancelable(false);
|
|
||||||
progressDialog.show(getSupportFragmentManager(), "progressDialog");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dismissProgressDialog() {
|
|
||||||
ProgressDialogFragment progressDialog = (ProgressDialogFragment)
|
|
||||||
getSupportFragmentManager().findFragmentByTag("progressDialog");
|
|
||||||
if (progressDialog != null) {
|
|
||||||
progressDialog.dismiss();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValidate() {
|
public boolean isValidate() {
|
||||||
boolean returnValue = true;
|
boolean returnValue = true;
|
||||||
String message = "";
|
String message = "";
|
||||||
|
|
||||||
if (etDescription.getText().toString().isEmpty()) {
|
|
||||||
message = "Please enter description.";
|
|
||||||
returnValue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obStatus.isEmpty()) {
|
|
||||||
message = "Please select Status.";
|
|
||||||
returnValue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!returnValue) {
|
if (!returnValue) {
|
||||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||||
|
|
|
@ -14,13 +14,21 @@ import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.InputType;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AutoCompleteTextView;
|
import android.widget.AutoCompleteTextView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import android.widget.RadioGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -34,15 +42,23 @@ import androidx.core.content.FileProvider;
|
||||||
import androidx.core.graphics.Insets;
|
import androidx.core.graphics.Insets;
|
||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.request.RequestOptions;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
import com.utopiaindustries.hseobservationsapp.R;
|
import com.utopiaindustries.hseobservationsapp.R;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.activities.DashboardActivity;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.DepartmentAdapter;
|
import com.utopiaindustries.hseobservationsapp.adapters.DepartmentAdapter;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.RiskLevelAdapter;
|
import com.utopiaindustries.hseobservationsapp.adapters.RiskLevelAdapter;
|
||||||
import com.utopiaindustries.hseobservationsapp.helper.Helper;
|
import com.utopiaindustries.hseobservationsapp.helper.Helper;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseDepartment;
|
import com.utopiaindustries.hseobservationsapp.models.HseData.HseDepartment;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.utils.ProgressDialogFragment;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.HseReportRequest;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.ObservationModel;
|
||||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.StorageManager;
|
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.StorageManager;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.viewmodels.LoginViewModel;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -60,175 +76,22 @@ import pub.devrel.easypermissions.AfterPermissionGranted;
|
||||||
import pub.devrel.easypermissions.AppSettingsDialog;
|
import pub.devrel.easypermissions.AppSettingsDialog;
|
||||||
import pub.devrel.easypermissions.EasyPermissions;
|
import pub.devrel.easypermissions.EasyPermissions;
|
||||||
|
|
||||||
public class ObservationTwoActivity extends AppCompatActivity implements EasyPermissions.PermissionCallbacks,
|
public class ObservationTwoActivity extends AppCompatActivity {
|
||||||
EasyPermissions.RationaleCallbacks{
|
|
||||||
|
|
||||||
private Button btnNext;
|
private Button btnNext;
|
||||||
ImageView imgBack;
|
ImageView imgBack;
|
||||||
ImageView imgBefore, beforeCrossButton, imgAfter, afterCrossButton;
|
|
||||||
private AutoCompleteTextView departmentTextview, riskLevelTextview;
|
|
||||||
|
|
||||||
private DepartmentAdapter departmentAdapter;
|
private AutoCompleteTextView riskLevelTextview;
|
||||||
|
|
||||||
private RiskLevelAdapter riskLevelAdapter;
|
private RiskLevelAdapter riskLevelAdapter;
|
||||||
|
|
||||||
private ArrayList<HseDepartment> departmentArrayList = new ArrayList<>();
|
|
||||||
private ArrayList<HseDepartment> departmentArrayList_temp = new ArrayList<>();
|
|
||||||
|
|
||||||
private ArrayList<String> riskLevelArrayList = new ArrayList<>();
|
private ArrayList<String> riskLevelArrayList = new ArrayList<>();
|
||||||
|
|
||||||
private static final int CAMERA_REQUEST = 100;
|
|
||||||
private static final int GALLERY_REQUEST = 200;
|
|
||||||
|
|
||||||
String filePathBefore = "no_pic";
|
|
||||||
String filePathAfter = "no_pic";
|
|
||||||
String departmentName = "";
|
|
||||||
String riskLevel = "";
|
String riskLevel = "";
|
||||||
|
RadioGroup rg1;
|
||||||
String imgType = "";
|
RadioButton rb_open, rb_closed;
|
||||||
|
EditText etDescription;
|
||||||
// Activity Result Launcher for Gallery
|
String obStatus = "";
|
||||||
private final ActivityResultLauncher<Intent> imagePickerLauncher =
|
LoginViewModel loginViewModel;
|
||||||
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
|
|
||||||
if (result.getResultCode() == RESULT_OK && result.getData() != null) {
|
|
||||||
Uri selectedImage = result.getData().getData();
|
|
||||||
|
|
||||||
if (imgType.equalsIgnoreCase("before")) {
|
|
||||||
|
|
||||||
uriToByteArrayAsync(
|
|
||||||
this,
|
|
||||||
selectedImage,
|
|
||||||
100, // Target size in KB
|
|
||||||
compressedImage -> {
|
|
||||||
// Handle the compressed image here, e.g., display it
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
Glide.with(this)
|
|
||||||
.load(compressedImage) // Glide will handle the decoding and placeholder
|
|
||||||
.placeholder(R.drawable.img_load)
|
|
||||||
.apply(new RequestOptions().centerCrop())
|
|
||||||
.into(imgBefore);
|
|
||||||
|
|
||||||
List<byte[]> tempList = new ArrayList<>();
|
|
||||||
tempList.add(compressedImage);
|
|
||||||
StorageManager.getInstance().getObservationsModel().get(0).setBeforePictures(tempList);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error -> {
|
|
||||||
// Handle any errors
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
Toast.makeText(this, "Error compressing image: " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
uriToByteArrayAsync(
|
|
||||||
this,
|
|
||||||
selectedImage,
|
|
||||||
100, // Target size in KB
|
|
||||||
compressedImage -> {
|
|
||||||
// Handle the compressed image here, e.g., display it
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
Glide.with(this)
|
|
||||||
.load(compressedImage) // Glide will handle the decoding and placeholder
|
|
||||||
.placeholder(R.drawable.img_load)
|
|
||||||
.apply(new RequestOptions().centerCrop())
|
|
||||||
.into(imgAfter);
|
|
||||||
|
|
||||||
List<byte[]> tempList = new ArrayList<>();
|
|
||||||
tempList.add(compressedImage);
|
|
||||||
StorageManager.getInstance().getObservationsModel().get(0).setAfterPictures(tempList);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error -> {
|
|
||||||
// Handle any errors
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
Toast.makeText(this, "Error compressing image: " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (result.getResultCode() == RESULT_CANCELED) {
|
|
||||||
Toast.makeText(this, "Gallery Selection Cancelled!", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Toast.makeText(this, "Gallery Selection Cancelled!", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Activity Result Launcher for Camera
|
|
||||||
private final ActivityResultLauncher<Intent> cameraLauncher =
|
|
||||||
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
|
|
||||||
|
|
||||||
if (result.getResultCode() == RESULT_OK) {
|
|
||||||
|
|
||||||
if (imgType.equalsIgnoreCase("before")) {
|
|
||||||
Uri contentUri = Uri.fromFile(new File((filePathBefore)));
|
|
||||||
|
|
||||||
uriToByteArrayAsync(
|
|
||||||
this,
|
|
||||||
contentUri,
|
|
||||||
100, // Target size in KB
|
|
||||||
compressedImage -> {
|
|
||||||
// Handle the compressed image here, e.g., display it
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
Glide.with(this)
|
|
||||||
.load(contentUri) // Glide will handle the decoding and placeholder
|
|
||||||
.placeholder(R.drawable.img_load)
|
|
||||||
.apply(new RequestOptions().centerCrop())
|
|
||||||
.into(imgBefore);
|
|
||||||
|
|
||||||
List<byte[]> tempList = new ArrayList<>();
|
|
||||||
tempList.add(compressedImage);
|
|
||||||
StorageManager.getInstance().getObservationsModel().get(0).setBeforePictures(tempList);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error -> {
|
|
||||||
// Handle any errors
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
Toast.makeText(this, "Error compressing image: " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Uri contentUri = Uri.fromFile(new File((filePathAfter)));
|
|
||||||
|
|
||||||
uriToByteArrayAsync(
|
|
||||||
this,
|
|
||||||
contentUri,
|
|
||||||
100, // Target size in KB
|
|
||||||
compressedImage -> {
|
|
||||||
// Handle the compressed image here, e.g., display it
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
Glide.with(this)
|
|
||||||
.load(contentUri) // Glide will handle the decoding and placeholder
|
|
||||||
.placeholder(R.drawable.img_load)
|
|
||||||
.apply(new RequestOptions().centerCrop())
|
|
||||||
.into(imgAfter);
|
|
||||||
|
|
||||||
List<byte[]> tempList = new ArrayList<>();
|
|
||||||
tempList.add(compressedImage);
|
|
||||||
StorageManager.getInstance().getObservationsModel().get(0).setAfterPictures(tempList);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error -> {
|
|
||||||
// Handle any errors
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
Toast.makeText(this, "Error compressing image: " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (result.getResultCode() == RESULT_CANCELED) {
|
|
||||||
Toast.makeText(this, "Camera capture failed!", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Toast.makeText(this, "Camera capture failed!", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -254,54 +117,12 @@ public class ObservationTwoActivity extends AppCompatActivity implements EasyPer
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (isValidate()) {
|
if (isValidate()) {
|
||||||
Intent intent = new Intent(ObservationTwoActivity.this, ObservationThreeActivity.class);
|
alertReportSubmit(ObservationTwoActivity.this);
|
||||||
startActivity(intent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
imgBefore.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
imgType = "before";
|
|
||||||
alertForPictures(ObservationTwoActivity.this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
imgAfter.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
imgType = "after";
|
|
||||||
alertForPictures(ObservationTwoActivity.this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeCrossButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
imgBefore.setImageResource(R.drawable.icon_image);
|
|
||||||
StorageManager.getInstance().getObservationsModel().get(0).getBeforePictures().clear();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
afterCrossButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
imgAfter.setImageResource(R.drawable.icon_image);
|
|
||||||
StorageManager.getInstance().getObservationsModel().get(0).getAfterPictures().clear();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
departmentTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
departmentName = departmentArrayList.get(position).getTitle();
|
|
||||||
StorageManager.getInstance().getObservationsModel().get(0).setDepartmentId(departmentArrayList.get(position).getId());
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
riskLevelTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
riskLevelTextview.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) {
|
||||||
|
@ -311,77 +132,136 @@ public class ObservationTwoActivity extends AppCompatActivity implements EasyPer
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
etDescription.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
StorageManager.getInstance().getObservationsModel().get(0).setDescription(s.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
rg1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener()
|
||||||
|
{
|
||||||
|
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||||
|
if (checkedId == R.id.rb_open) {
|
||||||
|
obStatus = "true";
|
||||||
|
StorageManager.getInstance().getObservationsModel().get(0).setObservationStatus(true);
|
||||||
|
} else if (checkedId == R.id.rb_closed) {
|
||||||
|
obStatus = "false";
|
||||||
|
StorageManager.getInstance().getObservationsModel().get(0).setObservationStatus(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeLayout() {
|
private void initializeLayout() {
|
||||||
|
|
||||||
btnNext = findViewById(R.id.btn_next);
|
btnNext = findViewById(R.id.btn_next);
|
||||||
imgBack = findViewById(R.id.img_back);
|
imgBack = findViewById(R.id.img_back);
|
||||||
|
rg1 = findViewById(R.id.rg1);
|
||||||
|
etDescription = findViewById(R.id.et_description);
|
||||||
|
etDescription.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||||
|
etDescription.setRawInputType(InputType.TYPE_CLASS_TEXT);
|
||||||
|
|
||||||
imgBefore = findViewById(R.id.img_before);
|
rb_open = findViewById(R.id.rb_open);
|
||||||
imgAfter = findViewById(R.id.img_after);
|
rb_closed = findViewById(R.id.rb_closed);
|
||||||
|
|
||||||
beforeCrossButton = findViewById(R.id.before_cross_button);
|
|
||||||
afterCrossButton = findViewById(R.id.after_cross_button);
|
|
||||||
|
|
||||||
departmentTextview = findViewById(R.id.department_textview);
|
|
||||||
riskLevelTextview = findViewById(R.id.risk_textview);
|
riskLevelTextview = findViewById(R.id.risk_textview);
|
||||||
|
|
||||||
departmentArrayList_temp.addAll(Helper.getList(Helper.hseDepartment, this, HseDepartment.class));
|
|
||||||
|
|
||||||
if (!departmentArrayList_temp.isEmpty()) {
|
|
||||||
|
|
||||||
List<HseDepartment> filteredUnitItems = departmentArrayList_temp.stream()
|
|
||||||
.filter(item -> Objects.equals(item.getSiteId(), StorageManager.getInstance().getSite_id()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
departmentArrayList.clear();
|
|
||||||
departmentArrayList.addAll(filteredUnitItems);
|
|
||||||
departmentAdapter = new DepartmentAdapter(this, departmentArrayList);
|
|
||||||
departmentTextview.setAdapter(departmentAdapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
riskLevelArrayList.add("High");
|
riskLevelArrayList.add("High");
|
||||||
riskLevelArrayList.add("Medium");
|
riskLevelArrayList.add("Medium");
|
||||||
riskLevelArrayList.add("Low");
|
riskLevelArrayList.add("Low");
|
||||||
|
|
||||||
riskLevelAdapter = new RiskLevelAdapter(this, riskLevelArrayList);
|
riskLevelAdapter = new RiskLevelAdapter(this, riskLevelArrayList);
|
||||||
riskLevelTextview.setAdapter(riskLevelAdapter);
|
riskLevelTextview.setAdapter(riskLevelAdapter);
|
||||||
|
|
||||||
|
loginViewModel = new ViewModelProvider(this).get(LoginViewModel.class);
|
||||||
|
|
||||||
|
loginViewModel.getLoadingState().observe(this, isLoading -> {
|
||||||
|
|
||||||
|
if (isLoading != null && isLoading) {
|
||||||
|
showProgressDialog();
|
||||||
|
} else {
|
||||||
|
dismissProgressDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
loginViewModel.getErrorMessage().observe(this, errorResponse -> {
|
||||||
|
Toast.makeText(this, errorResponse, Toast.LENGTH_SHORT).show();
|
||||||
|
});
|
||||||
|
|
||||||
|
loginViewModel.getUserSaveLiveData().observe(this, hseSaveResponse -> {
|
||||||
|
if (hseSaveResponse != null && hseSaveResponse.getStatus().equals("success")) {
|
||||||
|
Toast.makeText(this, "Reported Submitted", Toast.LENGTH_SHORT).show();
|
||||||
|
Intent intent = new Intent(ObservationTwoActivity.this, DashboardActivity.class);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("MissingInflatedId")
|
public void alertReportSubmit(Context con) {
|
||||||
public void alertForPictures(Context con) {
|
|
||||||
ViewGroup viewGroup = findViewById(android.R.id.content);
|
ViewGroup viewGroup = findViewById(android.R.id.content);
|
||||||
|
|
||||||
TextView dialogCameraBtn, dialogGalleryBtn;
|
TextView dialogOkBtn, dialogCancelBtn;
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(con);
|
AlertDialog.Builder builder = new AlertDialog.Builder(con);
|
||||||
View view1 = LayoutInflater.from(con).inflate(R.layout.custom_layout_for_image, viewGroup, false);
|
View view1 = LayoutInflater.from(con).inflate(R.layout.custom_layout_for_report_submission, viewGroup, false);
|
||||||
builder.setCancelable(false);
|
builder.setCancelable(false);
|
||||||
builder.setView(view1);
|
builder.setView(view1);
|
||||||
|
|
||||||
dialogCameraBtn = view1.findViewById(R.id.dialog_camera_btn);
|
dialogOkBtn = view1.findViewById(R.id.dialogOkBtn);
|
||||||
dialogGalleryBtn = view1.findViewById(R.id.dialog_gallery_btn);
|
dialogCancelBtn = view1.findViewById(R.id.dialogCancelBtn);
|
||||||
|
|
||||||
AlertDialog alertDialog = builder.create();
|
AlertDialog alertDialog = builder.create();
|
||||||
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
dialogCameraBtn.setOnClickListener(new View.OnClickListener() {
|
dialogOkBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
||||||
alertDialog.dismiss();
|
alertDialog.dismiss();
|
||||||
openCamera();
|
|
||||||
|
|
||||||
|
List<ObservationModel> observationList = StorageManager.getInstance().getObservationsModel();
|
||||||
|
HseReportRequest<ObservationModel> observationRequest = new HseReportRequest<>();
|
||||||
|
observationRequest.setObservation_date(StorageManager.getInstance().getObservation_date());
|
||||||
|
observationRequest.setUserId(StorageManager.getInstance().getUserId());
|
||||||
|
observationRequest.setSite_id(StorageManager.getInstance().getSite_id());
|
||||||
|
observationRequest.setSupervisorId(StorageManager.getInstance().getSupervisorId());
|
||||||
|
observationRequest.setSupervisorName(StorageManager.getInstance().getSupervisorName());
|
||||||
|
observationRequest.setShift(StorageManager.getInstance().getShift());
|
||||||
|
observationRequest.setDepartmentId(StorageManager.getInstance().getDepartmentId());
|
||||||
|
observationRequest.setBuildingId(StorageManager.getInstance().getBuildingId());
|
||||||
|
observationRequest.setFloorId(StorageManager.getInstance().getFloorId());
|
||||||
|
observationRequest.setRecordTypeId(StorageManager.getInstance().getRecordTypeId());
|
||||||
|
observationRequest.setReportData(observationList);
|
||||||
|
|
||||||
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
|
String jsonRequest = gson.toJson(observationRequest);
|
||||||
|
Log.e("RequestModel JSON", jsonRequest);
|
||||||
|
|
||||||
|
loginViewModel.saveHSEData(observationRequest);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogGalleryBtn.setOnClickListener(new View.OnClickListener() {
|
dialogCancelBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
||||||
alertDialog.dismiss();
|
alertDialog.dismiss();
|
||||||
openGallery();
|
//Toast.makeText(con, "Cancel", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -389,201 +269,22 @@ public class ObservationTwoActivity extends AppCompatActivity implements EasyPer
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterPermissionGranted(CAMERA_REQUEST)
|
|
||||||
public void openCamera() {
|
|
||||||
if (hasCameraPermission()) {
|
|
||||||
try {
|
|
||||||
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
|
||||||
File photoFile = null;
|
|
||||||
try {
|
|
||||||
photoFile = createImageFile(imgType);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
// Error occurred while creating the File
|
|
||||||
}
|
|
||||||
|
|
||||||
if (photoFile != null) {
|
|
||||||
Uri photoURI = FileProvider.getUriForFile(this,
|
|
||||||
"com.utopiaindustries.hseobservationsapp",
|
|
||||||
photoFile);
|
|
||||||
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
|
|
||||||
//startActivityForResult(takePictureIntent, CAMERA_REQUEST);
|
|
||||||
cameraLauncher.launch(takePictureIntent);
|
|
||||||
}
|
|
||||||
} catch (ActivityNotFoundException e) {
|
|
||||||
Toast.makeText(this, "Camera app not found", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Ask for one permission
|
|
||||||
String[] perms = {};
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
||||||
perms = new String[]{Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.CAMERA};
|
|
||||||
} else {
|
|
||||||
perms = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA};
|
|
||||||
}
|
|
||||||
|
|
||||||
EasyPermissions.requestPermissions(this, getString(R.string.rationale_camera), CAMERA_REQUEST, perms);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterPermissionGranted(GALLERY_REQUEST)
|
|
||||||
public void openGallery() {
|
|
||||||
if (hasGalleryPermission()) {
|
|
||||||
// Have permission, do the thing!
|
|
||||||
Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
|
||||||
// Start the Intent
|
|
||||||
//startActivityForResult(galleryIntent, GALLERY_REQUEST);
|
|
||||||
imagePickerLauncher.launch(galleryIntent);
|
|
||||||
} else {
|
|
||||||
// Ask for one permission
|
|
||||||
String[] perms = {};
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
||||||
perms = new String[]{Manifest.permission.READ_MEDIA_IMAGES};
|
|
||||||
} else {
|
|
||||||
perms = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE};
|
|
||||||
|
|
||||||
}
|
|
||||||
EasyPermissions.requestPermissions(this, getString(R.string.rationale_gallery), GALLERY_REQUEST, perms);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean hasGalleryPermission() {
|
|
||||||
String[] perms = {};
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
||||||
perms = new String[]{Manifest.permission.READ_MEDIA_IMAGES};
|
|
||||||
} else {
|
|
||||||
perms = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE};
|
|
||||||
}
|
|
||||||
|
|
||||||
return EasyPermissions.hasPermissions(this, perms);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean hasCameraPermission() {
|
|
||||||
String[] perms = {};
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
||||||
//Log.e("TIRAMISU: ","***");
|
|
||||||
perms = new String[]{Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.CAMERA};
|
|
||||||
} else {
|
|
||||||
//Log.e("Not-TIRAMISU: ","***");
|
|
||||||
perms = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//Log.e("perms: ",""+perms);
|
|
||||||
return EasyPermissions.hasPermissions(this, perms);
|
|
||||||
}
|
|
||||||
|
|
||||||
private File createImageFile(String imgType) throws IOException {
|
|
||||||
// Create an image file name
|
|
||||||
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
|
|
||||||
String imageFileName = "JPEG_" + timeStamp + "_";
|
|
||||||
File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
|
||||||
File image = File.createTempFile(
|
|
||||||
imageFileName, /* prefix */
|
|
||||||
".jpg", /* suffix */
|
|
||||||
storageDir /* directory */
|
|
||||||
);
|
|
||||||
|
|
||||||
if (imgType.equals("before")) {
|
|
||||||
filePathBefore = image.getAbsolutePath();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
filePathAfter = image.getAbsolutePath();
|
|
||||||
}
|
|
||||||
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void uriToByteArrayAsync(
|
|
||||||
Context context,
|
|
||||||
Uri uri,
|
|
||||||
int targetSizeInKB,
|
|
||||||
Consumer<byte[]> onSuccess,
|
|
||||||
Consumer<Exception> onError
|
|
||||||
) {
|
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
|
||||||
int targetSizeInBytes = targetSizeInKB * 1024;
|
|
||||||
|
|
||||||
// Load the image as a Bitmap without scaling
|
|
||||||
Bitmap bitmap;
|
|
||||||
try (InputStream inputStream = context.getContentResolver().openInputStream(uri)) {
|
|
||||||
bitmap = BitmapFactory.decodeStream(inputStream);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bitmap == null) {
|
|
||||||
throw new IOException("Failed to decode image from URI.");
|
|
||||||
}
|
|
||||||
|
|
||||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
||||||
int minQuality = 10;
|
|
||||||
int maxQuality = 100;
|
|
||||||
int quality = maxQuality;
|
|
||||||
|
|
||||||
// Binary search for the best quality that meets the target size
|
|
||||||
while (minQuality <= maxQuality) {
|
|
||||||
byteArrayOutputStream.reset();
|
|
||||||
bitmap.compress(Bitmap.CompressFormat.JPEG, quality, byteArrayOutputStream);
|
|
||||||
|
|
||||||
int byteSize = byteArrayOutputStream.size();
|
|
||||||
if (byteSize > targetSizeInBytes) {
|
|
||||||
maxQuality = quality - 1;
|
|
||||||
} else {
|
|
||||||
minQuality = quality + 1;
|
|
||||||
}
|
|
||||||
quality = (minQuality + maxQuality) / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
onSuccess.accept(byteArrayOutputStream.toByteArray());
|
|
||||||
} catch (IOException e) {
|
|
||||||
onError.accept(e);
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPermissionsGranted(int requestCode, @NonNull List<String> perms) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
|
|
||||||
if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
|
|
||||||
new AppSettingsDialog.Builder(this).build().show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRequestPermissionsResult(int requestCode,
|
|
||||||
@NonNull String[] permissions,
|
|
||||||
@NonNull int[] grantResults) {
|
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
||||||
|
|
||||||
// EasyPermissions handles the request result.
|
|
||||||
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRationaleAccepted(int requestCode) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRationaleDenied(int requestCode) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValidate() {
|
public boolean isValidate() {
|
||||||
boolean returnValue = true;
|
boolean returnValue = true;
|
||||||
String message = "";
|
String message = "";
|
||||||
|
|
||||||
if (riskLevel.isEmpty()) {
|
if (etDescription.getText().toString().isEmpty()) {
|
||||||
message = "Please select Risk level description.";
|
message = "Please enter description.";
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (departmentName.isEmpty()) {
|
if (obStatus.isEmpty()) {
|
||||||
message = "Please select Department.";
|
message = "Please select Status.";
|
||||||
|
returnValue = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (riskLevel.isEmpty()) {
|
||||||
|
message = "Please select Risk level description.";
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,4 +294,41 @@ public class ObservationTwoActivity extends AppCompatActivity implements EasyPer
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showProgressDialog() {
|
||||||
|
ProgressDialogFragment progressDialog = new ProgressDialogFragment();
|
||||||
|
progressDialog.setCancelable(false);
|
||||||
|
progressDialog.show(getSupportFragmentManager(), "progressDialog");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dismissProgressDialog() {
|
||||||
|
ProgressDialogFragment progressDialog = (ProgressDialogFragment)
|
||||||
|
getSupportFragmentManager().findFragmentByTag("progressDialog");
|
||||||
|
if (progressDialog != null) {
|
||||||
|
progressDialog.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
if (!StorageManager.getInstance().getObservationsModel().isEmpty()) {
|
||||||
|
showPersistData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showPersistData() {
|
||||||
|
riskLevelTextview.post(() -> riskLevelTextview.setText(StorageManager.getInstance().getObservationsModel().get(0).getRiskLevel(), false));
|
||||||
|
|
||||||
|
if(StorageManager.getInstance().getObservationsModel().get(0).isObservationStatus()) {
|
||||||
|
rb_open.setChecked(true);
|
||||||
|
}
|
||||||
|
else if (!StorageManager.getInstance().getObservationsModel().get(0).isObservationStatus()) {
|
||||||
|
rb_closed.setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
etDescription.setText(StorageManager.getInstance().getObservationsModel().get(0).getDescription());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,14 +1,20 @@
|
||||||
package com.utopiaindustries.hseobservationsapp.activities.PermitToWorkForms;
|
package com.utopiaindustries.hseobservationsapp.activities.PermitToWorkForms;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AutoCompleteTextView;
|
import android.widget.AutoCompleteTextView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.activity.EdgeToEdge;
|
import androidx.activity.EdgeToEdge;
|
||||||
|
@ -22,6 +28,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.google.android.material.textfield.TextInputLayout;
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
import com.utopiaindustries.hseobservationsapp.R;
|
import com.utopiaindustries.hseobservationsapp.R;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.activities.ObservationForms.ObservationOneActivity;
|
||||||
import com.utopiaindustries.hseobservationsapp.activities.ObservationForms.ObservationThreeActivity;
|
import com.utopiaindustries.hseobservationsapp.activities.ObservationForms.ObservationThreeActivity;
|
||||||
import com.utopiaindustries.hseobservationsapp.activities.ObservationForms.ObservationTwoActivity;
|
import com.utopiaindustries.hseobservationsapp.activities.ObservationForms.ObservationTwoActivity;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.BuildingsAdapter;
|
import com.utopiaindustries.hseobservationsapp.adapters.BuildingsAdapter;
|
||||||
|
@ -49,32 +56,20 @@ public class PermitOneActivity extends AppCompatActivity {
|
||||||
private Button btnNext;
|
private Button btnNext;
|
||||||
ImageView imgBack;
|
ImageView imgBack;
|
||||||
|
|
||||||
private AutoCompleteTextView locationTextview, subLocationTextView, ptwTypeTextView,
|
private AutoCompleteTextView ptwTypeTextView,
|
||||||
ptwSubTypeTextView, workingTeamTextView, departmentTextview;
|
ptwSubTypeTextView, workingTeamTextView;
|
||||||
|
|
||||||
private TextInputLayout ptwTextInputLayout;
|
private TextInputLayout ptwTextInputLayout;
|
||||||
|
|
||||||
private DepartmentAdapter departmentAdapter;
|
|
||||||
private ArrayList<HseDepartment> departmentArrayList_temp = new ArrayList<>();
|
|
||||||
private ArrayList<HseDepartment> departmentArrayList = new ArrayList<>();
|
|
||||||
|
|
||||||
private ArrayList<HseBuilding> locationArrayList_temp = new ArrayList<>();
|
|
||||||
private ArrayList<HseBuilding> locationArrayList = new ArrayList<>();
|
|
||||||
private BuildingsAdapter buildingAdapter;
|
|
||||||
|
|
||||||
private ArrayList<HseFloor> subLocationArrayList_temp = new ArrayList<>();
|
|
||||||
private ArrayList<HseFloor> subLocationArrayList = new ArrayList<>();
|
|
||||||
private FloorsAdapter floorsAdapter;
|
|
||||||
|
|
||||||
private ArrayList<HsePtwType> ptwTypeArrayList = new ArrayList<>();
|
private ArrayList<HsePtwType> ptwTypeArrayList = new ArrayList<>();
|
||||||
private HsePtwTypeAdapter ptwTypeAdapter;
|
private HsePtwTypeAdapter ptwTypeAdapter;
|
||||||
|
|
||||||
|
|
||||||
private ArrayList<HseWorkingTeam> workingTeamArrayList = new ArrayList<>();
|
private ArrayList<HseWorkingTeam> workingTeamArrayList = new ArrayList<>();
|
||||||
private WorkingTeamAdapter workingTeamAdapter;
|
private WorkingTeamAdapter workingTeamAdapter;
|
||||||
|
|
||||||
String location = "", subLocation = "", ptwType = "", workingTeam = "";
|
String ptwType = "", workingTeam = "";
|
||||||
String departmentName = "";
|
private CheckBox checkboxCompany, checkboxContractor;
|
||||||
|
String workingParty = "";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -92,7 +87,7 @@ public class PermitOneActivity extends AppCompatActivity {
|
||||||
imgBack.setOnClickListener(new View.OnClickListener() {
|
imgBack.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
finish();
|
alertExit(PermitOneActivity.this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -106,22 +101,6 @@ public class PermitOneActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
locationTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
location = locationArrayList.get(position).getTitle();
|
|
||||||
StorageManager.getInstance().getPermitToWorkModel().get(0).setLocationId(locationArrayList.get(position).getId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
subLocationTextView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
subLocation = subLocationArrayList.get(position).getTitle();
|
|
||||||
StorageManager.getInstance().getPermitToWorkModel().get(0).setSubLocationId(subLocationArrayList.get(position).getId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ptwTypeTextView.setOnClickListener(v -> {
|
ptwTypeTextView.setOnClickListener(v -> {
|
||||||
showMultiSelectDialog(ptwTypeArrayList, ptwTypeTextView);
|
showMultiSelectDialog(ptwTypeArrayList, ptwTypeTextView);
|
||||||
});
|
});
|
||||||
|
@ -138,18 +117,72 @@ public class PermitOneActivity extends AppCompatActivity {
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
workingTeam = workingTeamArrayList.get(position).getTitle();
|
workingTeam = workingTeamArrayList.get(position).getTitle();
|
||||||
StorageManager.getInstance().getPermitToWorkModel().get(0).setWorkingTeamId(workingTeamArrayList.get(position).getId());
|
StorageManager.getInstance().getPermitToWorkModel().get(0).setWorkingTeamId(workingTeamArrayList.get(position).getId());
|
||||||
|
StorageManager.getInstance().getPermitToWorkModel().get(0).setWorkingTeamName(workingTeamArrayList.get(position).getTitle());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
departmentTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
checkboxCompany.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onClick(View v) {
|
||||||
departmentName = departmentArrayList.get(position).getTitle();
|
if (checkboxCompany.isChecked()) {
|
||||||
StorageManager.getInstance().getPermitToWorkModel().get(0).setDepartmentId(departmentArrayList.get(position).getId());
|
checkboxContractor.setChecked(false);
|
||||||
|
workingParty = "Company";
|
||||||
|
StorageManager.getInstance().getPermitToWorkModel().get(0).setWorkingPartyType("Company");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
checkboxContractor.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (checkboxContractor.isChecked()) {
|
||||||
|
checkboxCompany.setChecked(false);
|
||||||
|
workingParty = "Contractor";
|
||||||
|
StorageManager.getInstance().getPermitToWorkModel().get(0).setWorkingPartyType("Contractor");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void alertExit(Context con) {
|
||||||
|
ViewGroup viewGroup = findViewById(android.R.id.content);
|
||||||
|
|
||||||
|
TextView dialogOkBtn, dialogCancelBtn;
|
||||||
|
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(con);
|
||||||
|
View view1 = LayoutInflater.from(con).inflate(R.layout.custom_layout_for_exit, viewGroup, false);
|
||||||
|
builder.setCancelable(false);
|
||||||
|
builder.setView(view1);
|
||||||
|
|
||||||
|
dialogOkBtn = view1.findViewById(R.id.dialogOkBtn);
|
||||||
|
dialogCancelBtn = view1.findViewById(R.id.dialogCancelBtn);
|
||||||
|
|
||||||
|
AlertDialog alertDialog = builder.create();
|
||||||
|
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
|
dialogOkBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
|
||||||
|
alertDialog.dismiss();
|
||||||
|
|
||||||
|
StorageManager.getInstance().clearPermitToWorkModule();
|
||||||
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dialogCancelBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
|
||||||
|
alertDialog.dismiss();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alertDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeLayout() {
|
private void initializeLayout() {
|
||||||
|
@ -157,11 +190,11 @@ public class PermitOneActivity 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);
|
||||||
|
|
||||||
locationTextview = findViewById(R.id.location_textview);
|
checkboxCompany = findViewById(R.id.checkbox_company);
|
||||||
subLocationTextView = findViewById(R.id.sub_location_textview);
|
checkboxContractor = findViewById(R.id.checkbox_contractor);
|
||||||
|
|
||||||
ptwTypeTextView = findViewById(R.id.ptw_type_textview);
|
ptwTypeTextView = findViewById(R.id.ptw_type_textview);
|
||||||
ptwTextInputLayout = findViewById(R.id.ptw_type_input);
|
ptwTextInputLayout = findViewById(R.id.ptw_type_input);
|
||||||
departmentTextview = findViewById(R.id.department_textview);
|
|
||||||
|
|
||||||
ptwTypeTextView.setFocusable(false);
|
ptwTypeTextView.setFocusable(false);
|
||||||
ptwTypeTextView.setCursorVisible(false);
|
ptwTypeTextView.setCursorVisible(false);
|
||||||
|
@ -170,51 +203,6 @@ public class PermitOneActivity extends AppCompatActivity {
|
||||||
|
|
||||||
workingTeamTextView = findViewById(R.id.working_team_textview);
|
workingTeamTextView = findViewById(R.id.working_team_textview);
|
||||||
|
|
||||||
//department
|
|
||||||
departmentArrayList_temp.addAll(Helper.getList(Helper.hseDepartment, this, HseDepartment.class));
|
|
||||||
|
|
||||||
if (!departmentArrayList_temp.isEmpty()) {
|
|
||||||
|
|
||||||
List<HseDepartment> filteredUnitItems = departmentArrayList_temp.stream()
|
|
||||||
.filter(item -> Objects.equals(item.getSiteId(), StorageManager.getInstance().getSite_id()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
departmentArrayList.clear();
|
|
||||||
departmentArrayList.addAll(filteredUnitItems);
|
|
||||||
departmentAdapter = new DepartmentAdapter(this, departmentArrayList);
|
|
||||||
departmentTextview.setAdapter(departmentAdapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
locationArrayList_temp.addAll(Helper.getList(Helper.hseBuildings, this, HseBuilding.class));
|
|
||||||
|
|
||||||
//Location -- Building
|
|
||||||
if (!locationArrayList_temp.isEmpty()) {
|
|
||||||
|
|
||||||
List<HseBuilding> filteredUnitItems = locationArrayList_temp.stream()
|
|
||||||
.filter(item -> Objects.equals(item.getSiteId(), StorageManager.getInstance().getSite_id()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
locationArrayList.clear();
|
|
||||||
locationArrayList.addAll(filteredUnitItems);
|
|
||||||
buildingAdapter = new BuildingsAdapter(this, locationArrayList);
|
|
||||||
locationTextview.setAdapter(buildingAdapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
subLocationArrayList_temp.addAll(Helper.getList(Helper.hseFloors, this, HseFloor.class));
|
|
||||||
|
|
||||||
//Sub Location -- floor
|
|
||||||
if (!subLocationArrayList_temp.isEmpty()) {
|
|
||||||
|
|
||||||
List<HseFloor> filteredUnitItems = subLocationArrayList_temp.stream()
|
|
||||||
.filter(item -> Objects.equals(item.getSiteId(), StorageManager.getInstance().getSite_id()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
subLocationArrayList.clear();
|
|
||||||
subLocationArrayList.addAll(filteredUnitItems);
|
|
||||||
floorsAdapter = new FloorsAdapter(this, subLocationArrayList);
|
|
||||||
subLocationTextView.setAdapter(floorsAdapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
ptwTypeArrayList.addAll(Helper.getList(Helper.hsePtwType, this, HsePtwType.class));
|
ptwTypeArrayList.addAll(Helper.getList(Helper.hsePtwType, this, HsePtwType.class));
|
||||||
|
|
||||||
workingTeamArrayList.addAll(Helper.getList(Helper.hseWorkingTeams, this, HseWorkingTeam.class));
|
workingTeamArrayList.addAll(Helper.getList(Helper.hseWorkingTeams, this, HseWorkingTeam.class));
|
||||||
|
@ -227,30 +215,16 @@ public class PermitOneActivity extends AppCompatActivity {
|
||||||
boolean returnValue = true;
|
boolean returnValue = true;
|
||||||
String message = "";
|
String message = "";
|
||||||
|
|
||||||
/*if (workingTeam.isEmpty()) {
|
if (workingParty.isEmpty()) {
|
||||||
message = "Please select working type.";
|
message = "Please select Working Party.";
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
if (ptwType.isEmpty()) {
|
if (ptwType.isEmpty()) {
|
||||||
message = "Please select ptw Type.";
|
message = "Please select ptw Type.";
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subLocation.isEmpty()) {
|
|
||||||
message = "Please select sub location.";
|
|
||||||
returnValue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location.isEmpty()) {
|
|
||||||
message = "Please select location.";
|
|
||||||
returnValue = false;
|
|
||||||
}
|
|
||||||
if (departmentName.isEmpty()) {
|
|
||||||
message = "Please select Department.";
|
|
||||||
returnValue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!returnValue) {
|
if (!returnValue) {
|
||||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
@ -280,6 +254,7 @@ public class PermitOneActivity extends AppCompatActivity {
|
||||||
textView.setText(selectedTitles);
|
textView.setText(selectedTitles);
|
||||||
ptwType = selectedTitles;
|
ptwType = selectedTitles;
|
||||||
StorageManager.getInstance().getPermitToWorkModel().get(0).setTypeId(selectedTypeSubType);
|
StorageManager.getInstance().getPermitToWorkModel().get(0).setTypeId(selectedTypeSubType);
|
||||||
|
StorageManager.getInstance().getPermitToWorkModel().get(0).setTypeName(selectedTitles);
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss());
|
builder.setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss());
|
||||||
|
@ -288,4 +263,28 @@ public class PermitOneActivity extends AppCompatActivity {
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
if (StorageManager.getInstance().getPermitToWorkModel() != null &&
|
||||||
|
!StorageManager.getInstance().getPermitToWorkModel().isEmpty()) {
|
||||||
|
showPersistData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showPersistData() {
|
||||||
|
ptwTypeTextView.post(() -> ptwTypeTextView.setText(StorageManager.getInstance().getPermitToWorkModel().get(0).getTypeName(), false));
|
||||||
|
workingTeamTextView.post(() -> workingTeamTextView.setText(StorageManager.getInstance().getPermitToWorkModel().get(0).getWorkingTeamName(), false));
|
||||||
|
|
||||||
|
if (StorageManager.getInstance().getPermitToWorkModel().get(0).getWorkingPartyType() != null
|
||||||
|
&& StorageManager.getInstance().getPermitToWorkModel().get(0).getWorkingPartyType().equals("Company")) {
|
||||||
|
checkboxCompany.setChecked(true);
|
||||||
|
} else if (StorageManager.getInstance().getPermitToWorkModel().get(0).getWorkingPartyType() != null
|
||||||
|
&& StorageManager.getInstance().getPermitToWorkModel().get(0).getWorkingPartyType().equals("Contractor")) {
|
||||||
|
checkboxContractor.setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -29,6 +29,7 @@ import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@ import pub.devrel.easypermissions.EasyPermissions;
|
||||||
public class PermitTwoActivity extends AppCompatActivity implements EasyPermissions.PermissionCallbacks,
|
public class PermitTwoActivity extends AppCompatActivity implements EasyPermissions.PermissionCallbacks,
|
||||||
EasyPermissions.RationaleCallbacks{
|
EasyPermissions.RationaleCallbacks{
|
||||||
|
|
||||||
private CheckBox checkboxCompany, checkboxContractor;
|
|
||||||
RecyclerView ptwRecyclerView;
|
RecyclerView ptwRecyclerView;
|
||||||
PTWImageAdapter imagePaperAdapter;
|
PTWImageAdapter imagePaperAdapter;
|
||||||
String paperFilePath = "no_pic";
|
String paperFilePath = "no_pic";
|
||||||
|
@ -93,8 +94,8 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
||||||
Button btnSubmit;
|
Button btnSubmit;
|
||||||
EditText etDescription;
|
EditText etDescription;
|
||||||
LoginViewModel loginViewModel;
|
LoginViewModel loginViewModel;
|
||||||
NestedScrollView scrollView;
|
ScrollView scrollView;
|
||||||
String workingParty = "";
|
|
||||||
|
|
||||||
// Activity Result Launcher for Gallery
|
// Activity Result Launcher for Gallery
|
||||||
private final ActivityResultLauncher<Intent> imagePickerLauncher =
|
private final ActivityResultLauncher<Intent> imagePickerLauncher =
|
||||||
|
@ -201,27 +202,7 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
||||||
|
|
||||||
initializeLayouts();
|
initializeLayouts();
|
||||||
|
|
||||||
checkboxCompany.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (checkboxCompany.isChecked()) {
|
|
||||||
checkboxContractor.setChecked(false);
|
|
||||||
workingParty = "Company";
|
|
||||||
StorageManager.getInstance().getPermitToWorkModel().get(0).setWorkingPartyType("Company");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
checkboxContractor.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (checkboxContractor.isChecked()) {
|
|
||||||
checkboxCompany.setChecked(false);
|
|
||||||
workingParty = "Contractor";
|
|
||||||
StorageManager.getInstance().getPermitToWorkModel().get(0).setWorkingPartyType("Contractor");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
imgUpload.setOnClickListener(new View.OnClickListener() {
|
imgUpload.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -233,6 +214,8 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
||||||
imgBack.setOnClickListener(new View.OnClickListener() {
|
imgBack.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
StorageManager.getInstance().getPermitToWorkModel().get(0).setPictures(imageList);
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -240,7 +223,8 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
||||||
btnSubmit.setOnClickListener(new View.OnClickListener() {
|
btnSubmit.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (!isValidate()) {
|
Log.e("btn-Submit: ","******");
|
||||||
|
if (isValidate()) {
|
||||||
StorageManager.getInstance().getPermitToWorkModel().get(0).setPictures(imageList);
|
StorageManager.getInstance().getPermitToWorkModel().get(0).setPictures(imageList);
|
||||||
// Toast.makeText(PermitTwoActivity.this,"Reported Submitted",Toast.LENGTH_SHORT).show();
|
// Toast.makeText(PermitTwoActivity.this,"Reported Submitted",Toast.LENGTH_SHORT).show();
|
||||||
alertReportSubmit(PermitTwoActivity.this);
|
alertReportSubmit(PermitTwoActivity.this);
|
||||||
|
@ -266,13 +250,13 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
etDescription.setOnFocusChangeListener((v, hasFocus) -> {
|
/*etDescription.setOnFocusChangeListener((v, hasFocus) -> {
|
||||||
if (hasFocus) {
|
if (hasFocus) {
|
||||||
new Handler().postDelayed(() -> {
|
new Handler().postDelayed(() -> {
|
||||||
scrollView.smoothScrollTo(0, etDescription.getBottom());
|
scrollView.smoothScrollTo(0, etDescription.getBottom());
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void alertReportSubmit(Context con) {
|
public void alertReportSubmit(Context con) {
|
||||||
|
@ -305,6 +289,9 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
||||||
hseTrainingRequest.setSupervisorId(StorageManager.getInstance().getSupervisorId());
|
hseTrainingRequest.setSupervisorId(StorageManager.getInstance().getSupervisorId());
|
||||||
hseTrainingRequest.setSupervisorName(StorageManager.getInstance().getSupervisorName());
|
hseTrainingRequest.setSupervisorName(StorageManager.getInstance().getSupervisorName());
|
||||||
hseTrainingRequest.setShift(StorageManager.getInstance().getShift());
|
hseTrainingRequest.setShift(StorageManager.getInstance().getShift());
|
||||||
|
hseTrainingRequest.setDepartmentId(StorageManager.getInstance().getDepartmentId());
|
||||||
|
hseTrainingRequest.setBuildingId(StorageManager.getInstance().getBuildingId());
|
||||||
|
hseTrainingRequest.setFloorId(StorageManager.getInstance().getFloorId());
|
||||||
hseTrainingRequest.setRecordTypeId(StorageManager.getInstance().getRecordTypeId());
|
hseTrainingRequest.setRecordTypeId(StorageManager.getInstance().getRecordTypeId());
|
||||||
hseTrainingRequest.setReportData(reportList);
|
hseTrainingRequest.setReportData(reportList);
|
||||||
|
|
||||||
|
@ -393,8 +380,7 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeLayouts() {
|
private void initializeLayouts() {
|
||||||
checkboxCompany = findViewById(R.id.checkbox_company);
|
|
||||||
checkboxContractor = findViewById(R.id.checkbox_contractor);
|
|
||||||
imgUpload = findViewById(R.id.img_upload);
|
imgUpload = findViewById(R.id.img_upload);
|
||||||
imgBack = findViewById(R.id.img_back);
|
imgBack = findViewById(R.id.img_back);
|
||||||
btnSubmit = findViewById(R.id.btn_submit);
|
btnSubmit = findViewById(R.id.btn_submit);
|
||||||
|
@ -722,15 +708,34 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (workingParty.isEmpty()) {
|
|
||||||
message = "Please select Working Party.";
|
|
||||||
returnValue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!returnValue) {
|
if (!returnValue) {
|
||||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
if (StorageManager.getInstance().getPermitToWorkModel() != null &&
|
||||||
|
!StorageManager.getInstance().getPermitToWorkModel().isEmpty()) {
|
||||||
|
showPersistData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showPersistData() {
|
||||||
|
etDescription.setText(StorageManager.getInstance().getPermitToWorkModel().get(0).getDescription());
|
||||||
|
|
||||||
|
if (StorageManager.getInstance().getPermitToWorkModel().get(0).getPictures() != null
|
||||||
|
&& !StorageManager.getInstance().getPermitToWorkModel().get(0).getPictures().isEmpty()) {
|
||||||
|
imageList.clear();
|
||||||
|
imageList.addAll(StorageManager.getInstance().getPermitToWorkModel().get(0).getPictures());
|
||||||
|
imagePaperAdapter = new PTWImageAdapter(imageList, this, "");
|
||||||
|
ptwRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
|
||||||
|
ptwRecyclerView.setAdapter(imagePaperAdapter);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -28,12 +28,18 @@ 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.BuildingsAdapter;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.adapters.DepartmentAdapter;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.adapters.FloorsAdapter;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.RecordTypeAdapter;
|
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.SiteAdapter;
|
||||||
import com.utopiaindustries.hseobservationsapp.adapters.SupervisorAdapter;
|
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.HseData.HseBuilding;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.models.HseData.HseDepartment;
|
||||||
|
import com.utopiaindustries.hseobservationsapp.models.HseData.HseFloor;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.HseData.RecordType;
|
import com.utopiaindustries.hseobservationsapp.models.HseData.RecordType;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.HseData.Site;
|
import com.utopiaindustries.hseobservationsapp.models.HseData.Site;
|
||||||
import com.utopiaindustries.hseobservationsapp.models.HseData.Supervisor;
|
import com.utopiaindustries.hseobservationsapp.models.HseData.Supervisor;
|
||||||
|
@ -57,7 +63,8 @@ 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 siteTextView, supervisorTextView, shiftTextview, formTextview;
|
private AutoCompleteTextView siteTextView, supervisorTextView, shiftTextview, formTextview,
|
||||||
|
departmentTextview, buildingTextview, floorTextview;
|
||||||
|
|
||||||
private SiteAdapter siteAdapter;
|
private SiteAdapter siteAdapter;
|
||||||
private ArrayList<Site> siteArrayList = new ArrayList<>();
|
private ArrayList<Site> siteArrayList = new ArrayList<>();
|
||||||
|
@ -72,11 +79,24 @@ public class HomeFragment extends Fragment {
|
||||||
private RecordTypeAdapter recordTypeAdapter;
|
private RecordTypeAdapter recordTypeAdapter;
|
||||||
private List<RecordType> recordTypeArrayList = new ArrayList<>();
|
private List<RecordType> recordTypeArrayList = new ArrayList<>();
|
||||||
|
|
||||||
|
private DepartmentAdapter departmentAdapter;
|
||||||
|
private ArrayList<HseDepartment> departmentArrayList_temp = new ArrayList<>();
|
||||||
|
private ArrayList<HseDepartment> departmentArrayList = new ArrayList<>();
|
||||||
|
|
||||||
|
private ArrayList<HseBuilding> buildingArrayList_temp = new ArrayList<>();
|
||||||
|
private ArrayList<HseBuilding> buildingArrayList = new ArrayList<>();
|
||||||
|
private BuildingsAdapter buildingAdapter;
|
||||||
|
|
||||||
|
private ArrayList<HseFloor> floorArrayList_temp = new ArrayList<>();
|
||||||
|
private ArrayList<HseFloor> floorArrayList = new ArrayList<>();
|
||||||
|
private FloorsAdapter floorsAdapter;
|
||||||
|
|
||||||
int selectedOption = 0;
|
int selectedOption = 0;
|
||||||
String userName = "";
|
String userName = "";
|
||||||
String siteName = "";
|
String siteName = "";
|
||||||
String supervisorName = "";
|
String supervisorName = "";
|
||||||
String shiftName = "";
|
String shiftName = "";
|
||||||
|
String departmentName = "", buildingName = "", floorName = "";
|
||||||
|
|
||||||
LoginViewModel loginViewModel;
|
LoginViewModel loginViewModel;
|
||||||
|
|
||||||
|
@ -92,7 +112,7 @@ public class HomeFragment extends Fragment {
|
||||||
|
|
||||||
initializeLayout(view);
|
initializeLayout(view);
|
||||||
|
|
||||||
txtUserName.setText(String.format("Supervisor Name: %s", userName));
|
txtUserName.setText(String.format("User: %s", userName));
|
||||||
|
|
||||||
imgCalendar.setOnClickListener(new View.OnClickListener() {
|
imgCalendar.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -122,6 +142,46 @@ public class HomeFragment extends Fragment {
|
||||||
supervisorTextView.setAdapter(supervisorAdapter);
|
supervisorTextView.setAdapter(supervisorAdapter);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//department
|
||||||
|
if (!departmentArrayList_temp.isEmpty()) {
|
||||||
|
|
||||||
|
List<HseDepartment> filteredUnitItems = departmentArrayList_temp.stream()
|
||||||
|
.filter(item -> Objects.equals(item.getSiteId(), clickedItem.getId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
departmentArrayList.clear();
|
||||||
|
departmentArrayList.addAll(filteredUnitItems);
|
||||||
|
departmentAdapter = new DepartmentAdapter(getActivity(), departmentArrayList);
|
||||||
|
departmentTextview.setAdapter(departmentAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Location -- Building
|
||||||
|
if (!buildingArrayList_temp.isEmpty()) {
|
||||||
|
|
||||||
|
List<HseBuilding> filteredUnitItems = buildingArrayList_temp.stream()
|
||||||
|
.filter(item -> Objects.equals(item.getSiteId(), clickedItem.getId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
buildingArrayList.clear();
|
||||||
|
buildingArrayList.addAll(filteredUnitItems);
|
||||||
|
buildingAdapter = new BuildingsAdapter(getActivity(), buildingArrayList);
|
||||||
|
buildingTextview.setAdapter(buildingAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Sub Location -- floor
|
||||||
|
if (!floorArrayList_temp.isEmpty()) {
|
||||||
|
|
||||||
|
List<HseFloor> filteredUnitItems = floorArrayList_temp.stream()
|
||||||
|
.filter(item -> Objects.equals(item.getSiteId(), clickedItem.getId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
floorArrayList.clear();
|
||||||
|
floorArrayList.addAll(filteredUnitItems);
|
||||||
|
floorsAdapter = new FloorsAdapter(getActivity(), floorArrayList);
|
||||||
|
floorTextview.setAdapter(floorsAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -157,6 +217,36 @@ public class HomeFragment extends Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
departmentTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
// Perform action when departmentTextview item is clicked
|
||||||
|
//Toast.makeText(getActivity(), "Item clicked: " + departmentArrayList.get(position).getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
|
departmentName = departmentArrayList.get(position).getTitle();
|
||||||
|
StorageManager.getInstance().setDepartmentId(departmentArrayList.get(position).getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
buildingTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
// Perform action when buildingTextview item is clicked
|
||||||
|
//Toast.makeText(getActivity(), "Item clicked: " + buildingArrayList.get(position).getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
|
buildingName = buildingArrayList.get(position).getTitle();
|
||||||
|
StorageManager.getInstance().setBuildingId(buildingArrayList.get(position).getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
floorTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
// Perform action when floorTextview item is clicked
|
||||||
|
//Toast.makeText(getActivity(), "Item clicked: " + floorArrayList.get(position).getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
|
floorName = floorArrayList.get(position).getTitle();
|
||||||
|
StorageManager.getInstance().setFloorId(floorArrayList.get(position).getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
btnNext.setOnClickListener(new View.OnClickListener() {
|
btnNext.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -211,6 +301,10 @@ public class HomeFragment extends Fragment {
|
||||||
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);
|
||||||
|
|
||||||
|
departmentTextview = view.findViewById(R.id.department_textview);
|
||||||
|
buildingTextview = view.findViewById(R.id.building_textview);
|
||||||
|
floorTextview = view.findViewById(R.id.floor_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 = new ViewModelProvider(getActivity()).get(LoginViewModel.class);
|
||||||
|
@ -266,6 +360,7 @@ public class HomeFragment extends Fragment {
|
||||||
if (!qcResponse.getHseFloors().isEmpty()) {
|
if (!qcResponse.getHseFloors().isEmpty()) {
|
||||||
|
|
||||||
Helper.saveList(qcResponse.getHseFloors(), Helper.hseFloors, getActivity());
|
Helper.saveList(qcResponse.getHseFloors(), Helper.hseFloors, getActivity());
|
||||||
|
floorArrayList_temp.addAll(qcResponse.getHseFloors());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qcResponse.getHseActivities().isEmpty()) {
|
if (!qcResponse.getHseActivities().isEmpty()) {
|
||||||
|
@ -276,6 +371,8 @@ public class HomeFragment extends Fragment {
|
||||||
if (!qcResponse.getHseDepartment().isEmpty()) {
|
if (!qcResponse.getHseDepartment().isEmpty()) {
|
||||||
|
|
||||||
Helper.saveList(qcResponse.getHseDepartment(), Helper.hseDepartment, getActivity());
|
Helper.saveList(qcResponse.getHseDepartment(), Helper.hseDepartment, getActivity());
|
||||||
|
//department
|
||||||
|
departmentArrayList_temp.addAll(qcResponse.getHseDepartment());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qcResponse.getHseIncidentTypes().isEmpty()) {
|
if (!qcResponse.getHseIncidentTypes().isEmpty()) {
|
||||||
|
@ -301,6 +398,7 @@ public class HomeFragment extends Fragment {
|
||||||
if (!qcResponse.getHseBuildings().isEmpty()) {
|
if (!qcResponse.getHseBuildings().isEmpty()) {
|
||||||
|
|
||||||
Helper.saveList(qcResponse.getHseBuildings(), Helper.hseBuildings, getActivity());
|
Helper.saveList(qcResponse.getHseBuildings(), Helper.hseBuildings, getActivity());
|
||||||
|
buildingArrayList_temp.addAll(qcResponse.getHseBuildings());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qcResponse.getHseWorkingTeam().isEmpty()) {
|
if (!qcResponse.getHseWorkingTeam().isEmpty()) {
|
||||||
|
@ -331,6 +429,12 @@ public class HomeFragment extends Fragment {
|
||||||
siteArrayList.clear();
|
siteArrayList.clear();
|
||||||
supervisorArrayList_temp.clear();
|
supervisorArrayList_temp.clear();
|
||||||
supervisorArrayList.clear();
|
supervisorArrayList.clear();
|
||||||
|
departmentArrayList_temp.clear();
|
||||||
|
departmentArrayList.clear();
|
||||||
|
buildingArrayList_temp.clear();
|
||||||
|
buildingArrayList.clear();
|
||||||
|
floorArrayList_temp.clear();
|
||||||
|
floorArrayList.clear();
|
||||||
|
|
||||||
siteArrayList.addAll(Helper.getList(Helper.homeSite, getActivity(), Site.class));
|
siteArrayList.addAll(Helper.getList(Helper.homeSite, getActivity(), Site.class));
|
||||||
siteAdapter = new SiteAdapter(getActivity(), siteArrayList);
|
siteAdapter = new SiteAdapter(getActivity(), siteArrayList);
|
||||||
|
@ -341,6 +445,15 @@ public class HomeFragment extends Fragment {
|
||||||
recordTypeArrayList.addAll(Helper.getList(Helper.recordType, getActivity(), RecordType.class));
|
recordTypeArrayList.addAll(Helper.getList(Helper.recordType, getActivity(), RecordType.class));
|
||||||
recordTypeAdapter = new RecordTypeAdapter(getActivity(), recordTypeArrayList);
|
recordTypeAdapter = new RecordTypeAdapter(getActivity(), recordTypeArrayList);
|
||||||
formTextview.setAdapter(recordTypeAdapter);
|
formTextview.setAdapter(recordTypeAdapter);
|
||||||
|
|
||||||
|
//department
|
||||||
|
departmentArrayList_temp.addAll(Helper.getList(Helper.hseDepartment, getActivity(), HseDepartment.class));
|
||||||
|
|
||||||
|
//building
|
||||||
|
buildingArrayList_temp.addAll(Helper.getList(Helper.hseBuildings, getActivity(), HseBuilding.class));
|
||||||
|
|
||||||
|
//floor
|
||||||
|
floorArrayList_temp.addAll(Helper.getList(Helper.hseFloors, getActivity(), HseFloor.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
shiftArrayList.add(new Shift(1, "General Shift(08:00AM - 05:00PM)"));
|
shiftArrayList.add(new Shift(1, "General Shift(08:00AM - 05:00PM)"));
|
||||||
|
@ -375,6 +488,21 @@ public class HomeFragment extends Fragment {
|
||||||
boolean returnValue = true;
|
boolean returnValue = true;
|
||||||
String message = "";
|
String message = "";
|
||||||
|
|
||||||
|
if (floorName.isEmpty()) {
|
||||||
|
message = "Please select floor.";
|
||||||
|
returnValue = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buildingName.isEmpty()) {
|
||||||
|
message = "Please select building.";
|
||||||
|
returnValue = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (departmentName.isEmpty()) {
|
||||||
|
message = "Please select department.";
|
||||||
|
returnValue = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (selectedOption == 0) {
|
if (selectedOption == 0) {
|
||||||
message = "Please select form type.";
|
message = "Please select form type.";
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
|
|
|
@ -12,6 +12,9 @@ public class HseReportRequest<T> {
|
||||||
private String supervisorName;
|
private String supervisorName;
|
||||||
private String shift;
|
private String shift;
|
||||||
private int recordTypeId;
|
private int recordTypeId;
|
||||||
|
private int departmentId;
|
||||||
|
private int buildingId;
|
||||||
|
private int floorId;
|
||||||
|
|
||||||
private List<T> reportData;
|
private List<T> reportData;
|
||||||
|
|
||||||
|
@ -83,7 +86,31 @@ public class HseReportRequest<T> {
|
||||||
this.reportData = new ArrayList<>();
|
this.reportData = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public HseReportRequest(String observation_date, int userId, int site_id, int supervisorId, String supervisorName, String shift, int recordTypeId, List<T> reportData) {
|
public int getDepartmentId() {
|
||||||
|
return departmentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepartmentId(int departmentId) {
|
||||||
|
this.departmentId = departmentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBuildingId() {
|
||||||
|
return buildingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBuildingId(int buildingId) {
|
||||||
|
this.buildingId = buildingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFloorId() {
|
||||||
|
return floorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFloorId(int floorId) {
|
||||||
|
this.floorId = floorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HseReportRequest(String observation_date, int userId, int site_id, int supervisorId, String supervisorName, String shift, int recordTypeId, int departmentId, int buildingId, int floorId, List<T> reportData) {
|
||||||
this.observation_date = observation_date;
|
this.observation_date = observation_date;
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.site_id = site_id;
|
this.site_id = site_id;
|
||||||
|
@ -91,7 +118,9 @@ public class HseReportRequest<T> {
|
||||||
this.supervisorName = supervisorName;
|
this.supervisorName = supervisorName;
|
||||||
this.shift = shift;
|
this.shift = shift;
|
||||||
this.recordTypeId = recordTypeId;
|
this.recordTypeId = recordTypeId;
|
||||||
|
this.departmentId = departmentId;
|
||||||
|
this.buildingId = buildingId;
|
||||||
|
this.floorId = floorId;
|
||||||
this.reportData = reportData;
|
this.reportData = reportData;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -7,12 +7,6 @@ public class HseTrainingModel {
|
||||||
private int safetyTopicId;
|
private int safetyTopicId;
|
||||||
private String safetyTopicName;
|
private String safetyTopicName;
|
||||||
private int employeeAttendance;
|
private int employeeAttendance;
|
||||||
private int targetAudienceId;
|
|
||||||
private String targetAudienceName;
|
|
||||||
private int locationId;
|
|
||||||
private String locationName;
|
|
||||||
private int subLocationId;
|
|
||||||
private String subLocationName;
|
|
||||||
private double trainingMinutes;
|
private double trainingMinutes;
|
||||||
private String description;
|
private String description;
|
||||||
private List<byte[]> pictures;
|
private List<byte[]> pictures;
|
||||||
|
@ -33,14 +27,6 @@ public class HseTrainingModel {
|
||||||
this.employeeAttendance = employeeAttendance;
|
this.employeeAttendance = employeeAttendance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTargetAudienceId() {
|
|
||||||
return targetAudienceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTargetAudienceId(int targetAudienceId) {
|
|
||||||
this.targetAudienceId = targetAudienceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getTrainingMinutes() {
|
public double getTrainingMinutes() {
|
||||||
return trainingMinutes;
|
return trainingMinutes;
|
||||||
}
|
}
|
||||||
|
@ -72,44 +58,4 @@ public class HseTrainingModel {
|
||||||
public void setSafetyTopicName(String safetyTopicName) {
|
public void setSafetyTopicName(String safetyTopicName) {
|
||||||
this.safetyTopicName = safetyTopicName;
|
this.safetyTopicName = safetyTopicName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTargetAudienceName() {
|
|
||||||
return targetAudienceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTargetAudienceName(String targetAudienceName) {
|
|
||||||
this.targetAudienceName = targetAudienceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLocationId() {
|
|
||||||
return locationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocationId(int locationId) {
|
|
||||||
this.locationId = locationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLocationName() {
|
|
||||||
return locationName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocationName(String locationName) {
|
|
||||||
this.locationName = locationName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSubLocationId() {
|
|
||||||
return subLocationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubLocationId(int subLocationId) {
|
|
||||||
this.subLocationId = subLocationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubLocationName() {
|
|
||||||
return subLocationName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubLocationName(String subLocationName) {
|
|
||||||
this.subLocationName = subLocationName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,15 +10,6 @@ public class ObservationModel {
|
||||||
private int observationSubClassId;
|
private int observationSubClassId;
|
||||||
private String hseObservationSubClassName;
|
private String hseObservationSubClassName;
|
||||||
|
|
||||||
private int buildingId;
|
|
||||||
private String buildingName;
|
|
||||||
|
|
||||||
private int floorId;
|
|
||||||
private String floorName;
|
|
||||||
|
|
||||||
private int departmentId;
|
|
||||||
private String departmentName;
|
|
||||||
|
|
||||||
private List<byte[]> beforePictures;
|
private List<byte[]> beforePictures;
|
||||||
private List<byte[]> afterPictures;
|
private List<byte[]> afterPictures;
|
||||||
|
|
||||||
|
@ -58,54 +49,6 @@ public class ObservationModel {
|
||||||
this.hseObservationSubClassName = hseObservationSubClassName;
|
this.hseObservationSubClassName = hseObservationSubClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBuildingId() {
|
|
||||||
return buildingId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBuildingId(int buildingId) {
|
|
||||||
this.buildingId = buildingId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBuildingName() {
|
|
||||||
return buildingName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBuildingName(String buildingName) {
|
|
||||||
this.buildingName = buildingName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFloorId() {
|
|
||||||
return floorId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFloorId(int floorId) {
|
|
||||||
this.floorId = floorId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFloorName() {
|
|
||||||
return floorName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFloorName(String floorName) {
|
|
||||||
this.floorName = floorName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDepartmentId() {
|
|
||||||
return departmentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDepartmentId(int departmentId) {
|
|
||||||
this.departmentId = departmentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDepartmentName() {
|
|
||||||
return departmentName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDepartmentName(String departmentName) {
|
|
||||||
this.departmentName = departmentName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<byte[]> getBeforePictures() {
|
public List<byte[]> getBeforePictures() {
|
||||||
return beforePictures;
|
return beforePictures;
|
||||||
}
|
}
|
||||||
|
@ -153,8 +96,6 @@ public class ObservationModel {
|
||||||
", hseObservationName='" + hseObservationName + '\'' +
|
", hseObservationName='" + hseObservationName + '\'' +
|
||||||
", observationSubClassId=" + observationSubClassId +
|
", observationSubClassId=" + observationSubClassId +
|
||||||
", hseObservationSubClassName='" + hseObservationSubClassName + '\'' +
|
", hseObservationSubClassName='" + hseObservationSubClassName + '\'' +
|
||||||
", departmentId=" + departmentId +
|
|
||||||
", departmentName='" + departmentName + '\'' +
|
|
||||||
", beforePictures=" + beforePictures.size() +
|
", beforePictures=" + beforePictures.size() +
|
||||||
", afterPictures=" + afterPictures.size() +
|
", afterPictures=" + afterPictures.size() +
|
||||||
", riskLevel='" + riskLevel + '\'' +
|
", riskLevel='" + riskLevel + '\'' +
|
||||||
|
|
|
@ -4,12 +4,6 @@ import java.util.List;
|
||||||
|
|
||||||
public class PermitToWorkModel {
|
public class PermitToWorkModel {
|
||||||
|
|
||||||
private int departmentId;
|
|
||||||
private String departmentName;
|
|
||||||
private int locationId;
|
|
||||||
private String locationName;
|
|
||||||
private int subLocationId;
|
|
||||||
private String subLocationName;
|
|
||||||
private String typeId;
|
private String typeId;
|
||||||
private String typeName;
|
private String typeName;
|
||||||
private int workingTeamId;
|
private int workingTeamId;
|
||||||
|
@ -20,22 +14,6 @@ public class PermitToWorkModel {
|
||||||
|
|
||||||
private List<byte[]> pictures;
|
private List<byte[]> pictures;
|
||||||
|
|
||||||
public int getLocationId() {
|
|
||||||
return locationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocationId(int locationId) {
|
|
||||||
this.locationId = locationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSubLocationId() {
|
|
||||||
return subLocationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubLocationId(int subLocationId) {
|
|
||||||
this.subLocationId = subLocationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTypeId() {
|
public String getTypeId() {
|
||||||
return typeId;
|
return typeId;
|
||||||
}
|
}
|
||||||
|
@ -76,38 +54,6 @@ public class PermitToWorkModel {
|
||||||
this.pictures = pictures;
|
this.pictures = pictures;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDepartmentId() {
|
|
||||||
return departmentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDepartmentId(int departmentId) {
|
|
||||||
this.departmentId = departmentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDepartmentName() {
|
|
||||||
return departmentName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDepartmentName(String departmentName) {
|
|
||||||
this.departmentName = departmentName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLocationName() {
|
|
||||||
return locationName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocationName(String locationName) {
|
|
||||||
this.locationName = locationName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubLocationName() {
|
|
||||||
return subLocationName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubLocationName(String subLocationName) {
|
|
||||||
this.subLocationName = subLocationName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTypeName() {
|
public String getTypeName() {
|
||||||
return typeName;
|
return typeName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import java.util.List;
|
||||||
|
|
||||||
public class StorageManager {
|
public class StorageManager {
|
||||||
private static StorageManager instance;
|
private static StorageManager instance;
|
||||||
// private ArrayList<byte[]> imageListPaper;
|
|
||||||
|
|
||||||
private String observation_date;
|
private String observation_date;
|
||||||
private int userId;
|
private int userId;
|
||||||
|
@ -17,6 +16,12 @@ public class StorageManager {
|
||||||
private String shift;
|
private String shift;
|
||||||
private int recordTypeId;
|
private int recordTypeId;
|
||||||
private String recordTypeName;
|
private String recordTypeName;
|
||||||
|
private int departmentId;
|
||||||
|
private String departmentName;
|
||||||
|
private int buildingId;
|
||||||
|
private String buildingName;
|
||||||
|
private int floorId;
|
||||||
|
private String floorName;
|
||||||
|
|
||||||
private List<ObservationModel> observationsModel;
|
private List<ObservationModel> observationsModel;
|
||||||
private List<ReportActivityModel> reportActivityModel;
|
private List<ReportActivityModel> reportActivityModel;
|
||||||
|
@ -118,6 +123,46 @@ public class StorageManager {
|
||||||
this.recordTypeName = recordTypeName;
|
this.recordTypeName = recordTypeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getDepartmentId() {
|
||||||
|
return departmentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepartmentId(int departmentId) {
|
||||||
|
this.departmentId = departmentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDepartmentName() {
|
||||||
|
return departmentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepartmentName(String departmentName) {
|
||||||
|
this.departmentName = departmentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBuildingId() {
|
||||||
|
return buildingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBuildingId(int buildingId) {
|
||||||
|
this.buildingId = buildingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBuildingName() {
|
||||||
|
return buildingName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBuildingName(String buildingName) {
|
||||||
|
this.buildingName = buildingName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFloorId() {
|
||||||
|
return floorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFloorId(int floorId) {
|
||||||
|
this.floorId = floorId;
|
||||||
|
}
|
||||||
|
|
||||||
public List<ObservationModel> getObservationsModel() {
|
public List<ObservationModel> getObservationsModel() {
|
||||||
return observationsModel;
|
return observationsModel;
|
||||||
}
|
}
|
||||||
|
@ -158,21 +203,45 @@ public class StorageManager {
|
||||||
this.hseTrainingModel = hseTrainingModel;
|
this.hseTrainingModel = hseTrainingModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearAllData() {
|
|
||||||
|
|
||||||
observation_date = null;
|
|
||||||
userId = 0;
|
|
||||||
site_id = 0;
|
|
||||||
supervisorId = 0;
|
|
||||||
supervisorName = null;
|
|
||||||
shift = null;
|
|
||||||
recordTypeId = 0;
|
|
||||||
recordTypeName = null;
|
|
||||||
|
|
||||||
observationsModel.clear();
|
public void clearObservationModule() {
|
||||||
reportActivityModel.clear();
|
if (observationsModel != null) {
|
||||||
progressiveActivityModel.clear();
|
observationsModel.clear();
|
||||||
permitToWorkModel.clear();
|
}
|
||||||
hseTrainingModel.clear();
|
observationsModel.add(new ObservationModel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearProgressiveActivityModule() {
|
||||||
|
if (progressiveActivityModel != null) {
|
||||||
|
progressiveActivityModel.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
progressiveActivityModel.add(new ReportActivityModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearPermitToWorkModule() {
|
||||||
|
if (permitToWorkModel != null) {
|
||||||
|
permitToWorkModel.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
permitToWorkModel.add(new PermitToWorkModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearHseTrainingModule() {
|
||||||
|
if (hseTrainingModel != null) {
|
||||||
|
hseTrainingModel.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
hseTrainingModel.add(new HseTrainingModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearReportActivityModule() {
|
||||||
|
if (reportActivityModel != null) {
|
||||||
|
reportActivityModel.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
reportActivityModel.add(new ReportActivityModel());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
<TextView
|
<TextView
|
||||||
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_marginTop="15dp"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:text="Topic Of Safety Training *"
|
android:text="Topic Of Safety Training *"
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
<TextView
|
<TextView
|
||||||
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_marginTop="15dp"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:text="Total No of Employees Present in Training *"
|
android:text="Total No of Employees Present in Training *"
|
||||||
|
@ -115,95 +115,62 @@
|
||||||
<TextView
|
<TextView
|
||||||
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_marginTop="15dp"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:text="Department *"
|
android:text="Total Minutes of Training Sessions *"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="@dimen/_13sdp"
|
android:textSize="@dimen/_13sdp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<EditText
|
||||||
android:id="@+id/target_input"
|
android:id="@+id/et_training_session"
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_marginRight="5dp"
|
android:layout_marginStart="10dp"
|
||||||
android:hint="@string/select_target_audience"
|
android:layout_marginTop="5dp"
|
||||||
android:padding="5dp"
|
android:background="@drawable/et_border"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
android:hint="Training Session"
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
android:imeOptions="actionDone"
|
||||||
|
android:inputType="numberDecimal"
|
||||||
<AutoCompleteTextView
|
android:padding="13dp"
|
||||||
android:id="@+id/target_audience_textview"
|
android:textSize="15sp" />
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:inputType="none"
|
|
||||||
android:textSize="16sp" />
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/heading_description"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:text="Building *"
|
android:text="Description *"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="@dimen/_13sdp"
|
android:textSize="@dimen/_13sdp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/rg1" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<EditText
|
||||||
android:id="@+id/location_input"
|
android:id="@+id/et_description"
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginRight="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:padding="5dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:hint="@string/select_location"
|
android:layout_marginBottom="10dp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
android:background="@drawable/et_border"
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
android:gravity="top|start"
|
||||||
|
android:hint="Write Description Here"
|
||||||
<AutoCompleteTextView
|
android:imeOptions="actionDone"
|
||||||
android:id="@+id/location_textview"
|
android:inputType="textMultiLine"
|
||||||
android:layout_width="match_parent"
|
android:lines="5"
|
||||||
android:layout_height="wrap_content"
|
android:maxLines="5"
|
||||||
android:inputType="none"
|
android:minLines="5"
|
||||||
android:textSize="16sp" />
|
android:padding="10dp"
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
android:textSize="@dimen/_12sdp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
<TextView
|
app:layout_constraintTop_toBottomOf="@+id/heading_description"/>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:gravity="left"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="Floor *"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="@dimen/_13sdp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
|
||||||
android:id="@+id/sub_location_input"
|
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="5dp"
|
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:hint="@string/select_sub_location"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
|
||||||
|
|
||||||
<AutoCompleteTextView
|
|
||||||
android:id="@+id/sub_location_textview"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:inputType="none"
|
|
||||||
android:textSize="16sp" />
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
android:id="@+id/scrollView2"
|
android:id="@+id/scrollView2"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/btn_next"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/toolbar">
|
app:layout_constraintTop_toBottomOf="@+id/toolbar">
|
||||||
|
@ -56,65 +55,7 @@
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:gravity="left"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="Total Minutes of Training Sessions *"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="@dimen/_13sdp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/et_training_session"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:background="@drawable/et_border"
|
|
||||||
android:hint="Training Session"
|
|
||||||
android:imeOptions="actionDone"
|
|
||||||
android:inputType="numberDecimal"
|
|
||||||
android:padding="13dp"
|
|
||||||
android:textSize="15sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/heading_description"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:gravity="left"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="Description *"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="@dimen/_13sdp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/rg1" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/et_description"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:background="@drawable/et_border"
|
|
||||||
android:gravity="top|start"
|
|
||||||
android:hint="Write Description Here"
|
|
||||||
android:imeOptions="actionDone"
|
|
||||||
android:inputType="textMultiLine"
|
|
||||||
android:lines="5"
|
|
||||||
android:maxLines="5"
|
|
||||||
android:minLines="5"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:textSize="@dimen/_12sdp"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/heading_description"/>
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -122,72 +122,81 @@
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/building_heading"
|
android:id="@+id/before_heading"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/observation_sub_input"
|
android:layout_below="@+id/observation_sub_input"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="10dp"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:text="Building *"
|
android:text="Before Picture "
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="@dimen/_13sdp"
|
android:textSize="@dimen/_13sdp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<FrameLayout
|
||||||
android:id="@+id/building_input"
|
android:id="@+id/before_frame"
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
android:layout_width="150dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="150dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_below="@+id/building_heading"
|
android:layout_below="@+id/before_heading">
|
||||||
android:layout_marginLeft="5dp"
|
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:hint="@string/select_building"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
|
||||||
|
|
||||||
<AutoCompleteTextView
|
<ImageView
|
||||||
android:id="@+id/building_textview"
|
android:id="@+id/img_before"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
android:src="@drawable/icon_image" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/before_cross_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="none"
|
android:layout_gravity="top|end"
|
||||||
android:textSize="16sp" />
|
android:background="@drawable/circle_background"
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
android:padding="8dp"
|
||||||
|
android:src="@drawable/ic_close" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/floor_heading"
|
android:id="@+id/after_heading"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/building_input"
|
android:layout_below="@+id/before_frame"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="5dp"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:text="Floor *"
|
android:text="After Picture "
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="@dimen/_13sdp"
|
android:textSize="@dimen/_13sdp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<FrameLayout
|
||||||
android:id="@+id/floor_input"
|
android:id="@+id/after_frame"
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
android:layout_width="150dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="150dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_below="@+id/floor_heading"
|
android:layout_below="@+id/after_heading">
|
||||||
android:layout_marginLeft="5dp"
|
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:hint="@string/select_floors"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
|
||||||
|
|
||||||
<AutoCompleteTextView
|
<ImageView
|
||||||
android:id="@+id/floor_textview"
|
android:id="@+id/img_after"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@drawable/icon_image" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/after_cross_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="none"
|
android:layout_gravity="top|end"
|
||||||
android:textSize="16sp" />
|
android:background="@drawable/circle_background"
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
android:padding="8dp"
|
||||||
|
android:src="@drawable/ic_close" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
|
@ -41,87 +41,7 @@
|
||||||
app:layout_constraintTop_toTopOf="@+id/toolbar"
|
app:layout_constraintTop_toTopOf="@+id/toolbar"
|
||||||
app:srcCompat="@drawable/arrow_back" />
|
app:srcCompat="@drawable/arrow_back" />
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="5dp"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/linearLayout"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/toolbar">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/heading_observation_status"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:gravity="left"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="Observation Status *"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="@dimen/_13sdp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<RadioGroup
|
|
||||||
android:id="@+id/rg1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="left"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="5dp">
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rb_open"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:buttonTint="@color/theme_color"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="Open"
|
|
||||||
android:textSize="@dimen/_13sdp" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rb_closed"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:buttonTint="@color/theme_color"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="Closed"
|
|
||||||
android:textSize="@dimen/_13sdp" />
|
|
||||||
</RadioGroup>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/heading_description"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:gravity="left"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="Description *"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="@dimen/_13sdp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/et_description"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
android:layout_marginBottom="5dp"
|
|
||||||
android:background="@drawable/et_border"
|
|
||||||
android:gravity="top|start"
|
|
||||||
android:hint="Write Description Here"
|
|
||||||
android:imeOptions="actionDone"
|
|
||||||
android:inputType="textMultiLine"
|
|
||||||
android:lines="5"
|
|
||||||
android:maxLines="5"
|
|
||||||
android:minLines="5"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:textSize="@dimen/_12sdp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/linearLayout"
|
android:id="@+id/linearLayout"
|
||||||
|
|
|
@ -55,121 +55,10 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="5dp">
|
android:padding="5dp">
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/observation_heading"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:gravity="left"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="Department Name *"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="@dimen/_13sdp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
|
||||||
android:id="@+id/department_input"
|
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/observation_heading"
|
|
||||||
android:layout_marginLeft="5dp"
|
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:hint="@string/select_department"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
|
||||||
|
|
||||||
<AutoCompleteTextView
|
|
||||||
android:id="@+id/department_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/before_heading"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/department_input"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:gravity="left"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="Before Picture "
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="@dimen/_13sdp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/before_frame"
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_below="@+id/before_heading">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/img_before"
|
|
||||||
android:layout_width="120dp"
|
|
||||||
android:layout_height="120dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:scaleType="fitXY"
|
|
||||||
android:src="@drawable/icon_image" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/before_cross_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="top|end"
|
|
||||||
android:background="@drawable/circle_background"
|
|
||||||
android:padding="8dp"
|
|
||||||
android:src="@drawable/ic_close" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/after_heading"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/before_frame"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:gravity="left"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="After Picture "
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="@dimen/_13sdp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/after_frame"
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_below="@+id/after_heading">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/img_after"
|
|
||||||
android:layout_width="120dp"
|
|
||||||
android:layout_height="120dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:src="@drawable/icon_image" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/after_cross_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="top|end"
|
|
||||||
android:background="@drawable/circle_background"
|
|
||||||
android:padding="8dp"
|
|
||||||
android:src="@drawable/ic_close" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/risk_heading"
|
android:id="@+id/risk_heading"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/after_frame"
|
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
|
@ -186,8 +75,8 @@
|
||||||
android:layout_below="@+id/risk_heading"
|
android:layout_below="@+id/risk_heading"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="5dp"
|
||||||
android:layout_marginRight="5dp"
|
android:layout_marginRight="5dp"
|
||||||
android:padding="5dp"
|
|
||||||
android:hint="@string/select_risk"
|
android:hint="@string/select_risk"
|
||||||
|
android:padding="5dp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
@ -199,6 +88,84 @@
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/risk_input"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="5dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/heading_observation_status"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:gravity="left"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="Observation Status *"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/_13sdp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<RadioGroup
|
||||||
|
android:id="@+id/rg1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="left"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="5dp">
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/rb_open"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:buttonTint="@color/theme_color"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="Open"
|
||||||
|
android:textSize="@dimen/_13sdp" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/rb_closed"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:buttonTint="@color/theme_color"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="Closed"
|
||||||
|
android:textSize="@dimen/_13sdp" />
|
||||||
|
</RadioGroup>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/heading_description"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:gravity="left"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="Description *"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/_13sdp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_description"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:background="@drawable/et_border"
|
||||||
|
android:gravity="top|start"
|
||||||
|
android:hint="Write Description Here"
|
||||||
|
android:imeOptions="actionDone"
|
||||||
|
android:inputType="textMultiLine"
|
||||||
|
android:lines="5"
|
||||||
|
android:maxLines="5"
|
||||||
|
android:minLines="5"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:textSize="@dimen/_12sdp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
@ -209,7 +176,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="@drawable/rounded_btn_login"
|
android:background="@drawable/rounded_btn_login"
|
||||||
android:text="Next"
|
android:text="Submit"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
tools:layout_editor_absoluteX="5dp" />
|
tools:layout_editor_absoluteX="5dp" />
|
||||||
|
|
|
@ -56,99 +56,6 @@
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:gravity="left"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="Department *"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="@dimen/_13sdp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
|
||||||
android:id="@+id/department_input"
|
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="5dp"
|
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:hint="@string/select_location"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
|
||||||
|
|
||||||
<AutoCompleteTextView
|
|
||||||
android:id="@+id/department_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:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:gravity="left"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="Building *"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="@dimen/_13sdp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
|
||||||
android:id="@+id/location_input"
|
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="5dp"
|
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:hint="@string/select_location"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
|
||||||
|
|
||||||
<AutoCompleteTextView
|
|
||||||
android:id="@+id/location_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:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:gravity="left"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="Floor *"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="@dimen/_13sdp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
|
||||||
android:id="@+id/sub_location_input"
|
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="5dp"
|
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:hint="@string/select_sub_location"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
|
||||||
|
|
||||||
<AutoCompleteTextView
|
|
||||||
android:id="@+id/sub_location_textview"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:inputType="none"
|
|
||||||
android:textSize="16sp" />
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -244,6 +151,36 @@
|
||||||
android:inputType="none"
|
android:inputType="none"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:gravity="left"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="Working Party *"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/_13sdp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="5dp">
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/checkbox_company"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Company" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/checkbox_contractor"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Contractor" />
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:srcCompat="@drawable/arrow_back" />
|
app:srcCompat="@drawable/arrow_back" />
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
<ScrollView
|
||||||
android:id="@+id/scrollView2"
|
android:id="@+id/scrollView2"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
@ -59,37 +59,6 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="5dp">
|
android:padding="5dp">
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/observation_heading"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:gravity="left"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="Working Party *"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="@dimen/_13sdp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="5dp">
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/checkbox_company"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Company" />
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/checkbox_contractor"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Contractor" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
@ -162,7 +131,7 @@
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:textSize="@dimen/_12sdp" />
|
android:textSize="@dimen/_12sdp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.core.widget.NestedScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_submit"
|
android:id="@+id/btn_submit"
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:background="@drawable/rounded_white"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="15dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/message"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:paddingLeft="15dp"
|
||||||
|
android:paddingRight="15dp"
|
||||||
|
android:text="Want to move back? All data will be lost"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/_15sdp"
|
||||||
|
android:textStyle="normal" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1px"
|
||||||
|
android:layout_marginTop="7dp"
|
||||||
|
android:background="@color/white" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="3">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/dialogCancelBtn"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1.495"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingTop="15dp"
|
||||||
|
android:paddingBottom="15dp"
|
||||||
|
android:background="@drawable/custom_button"
|
||||||
|
android:text="No"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/_14sdp"
|
||||||
|
android:textStyle="normal" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.05"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:paddingTop="15dp"
|
||||||
|
android:paddingBottom="15dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/dialogOkBtn"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1.495"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingTop="15dp"
|
||||||
|
android:paddingBottom="15dp"
|
||||||
|
android:text="Contine"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:background="@drawable/custom_button"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/_14sdp"
|
||||||
|
android:textStyle="normal" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -24,11 +24,22 @@
|
||||||
android:textSize="@dimen/_13sdp"
|
android:textSize="@dimen/_13sdp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0.6dp"
|
||||||
|
android:layout_below="@+id/txt_user_name"
|
||||||
|
android:background="@color/grey_500"/>
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:id="@+id/scrollView2"
|
android:id="@+id/scrollView2"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_above="@+id/btn_next"
|
android:layout_above="@+id/btn_next"
|
||||||
|
android:scrollbars="vertical"
|
||||||
|
android:fadeScrollbars="false"
|
||||||
|
android:fillViewport="true"
|
||||||
|
android:scrollbarFadeDuration="0"
|
||||||
|
android:scrollbarThumbVertical="@android:color/darker_gray"
|
||||||
android:layout_below="@+id/txt_user_name">
|
android:layout_below="@+id/txt_user_name">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
@ -207,6 +218,108 @@
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<!--Department, Building and Floor-->
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_below="@+id/form_input">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:gravity="left"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="Department *"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/_13sdp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/department_input"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:hint="@string/select_department"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/department_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:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:gravity="left"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="Building *"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/_13sdp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/building_input"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:hint="@string/select_building"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/building_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:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:gravity="left"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="Floor *"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/_13sdp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/floor_input"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:hint="@string/select_floors"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/floor_textview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="none"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
Loading…
Reference in New Issue