Add Department, building, floors dropdown Permit to work module working
parent
316589220b
commit
619af3fc95
|
@ -85,7 +85,7 @@
|
|||
<activity
|
||||
android:name=".activities.PermitToWorkForms.PermitTwoActivity"
|
||||
android:exported="false"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activities.PermitToWorkForms.PermitOneActivity"
|
||||
|
|
|
@ -16,10 +16,15 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -40,8 +45,18 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import com.utopiaindustries.hseobservationsapp.R;
|
||||
import com.utopiaindustries.hseobservationsapp.activities.DashboardActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.activities.PermitToWorkForms.PermitTwoActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.BuildingsAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.DepartmentAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.FloorsAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.PTWImageAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.SafetyTrainingAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.helper.Helper;
|
||||
import com.utopiaindustries.hseobservationsapp.models.DocumentTypeImageModel;
|
||||
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.HseSafetyTrainingTopic;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.StorageManager;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
|
@ -51,117 +66,44 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import pub.devrel.easypermissions.AfterPermissionGranted;
|
||||
import pub.devrel.easypermissions.AppSettingsDialog;
|
||||
import pub.devrel.easypermissions.EasyPermissions;
|
||||
|
||||
public class HseOneActivity extends AppCompatActivity implements EasyPermissions.PermissionCallbacks,
|
||||
EasyPermissions.RationaleCallbacks{
|
||||
public class HseOneActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
RecyclerView trainingPicRecyclerView;
|
||||
PTWImageAdapter imagePaperAdapter;
|
||||
String paperFilePath = "no_pic";
|
||||
ArrayList<byte[]> PaperImageList = new ArrayList<>();
|
||||
String docTypeId = "";
|
||||
String docTypeTitle = "";
|
||||
private static final int CAMERA_REQUEST_PAPER = 101;
|
||||
private static final int GALLERY_REQUEST = 201;
|
||||
ImageView imgUpload, imgBack;
|
||||
|
||||
ImageView imgBack;
|
||||
Button btnNext;
|
||||
AutoCompleteTextView safetyTextview, targetAudienceTextview, locationTextview, subLocationTextView;
|
||||
|
||||
// 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();
|
||||
private ArrayList<HseSafetyTrainingTopic> safetyTrainingArrayList = new ArrayList<>();
|
||||
private ArrayList<HseDepartment> departmentArrayList = new ArrayList<>();
|
||||
private ArrayList<HseDepartment> departmentArrayList_temp = new ArrayList<>();
|
||||
|
||||
uriToByteArrayAsync(
|
||||
this,
|
||||
selectedImage,
|
||||
100, // Target size in KB
|
||||
compressedImage -> {
|
||||
// Handle the compressed image here, e.g., display it
|
||||
runOnUiThread(() -> {
|
||||
/*DocumentTypeImageModel documentImage = new DocumentTypeImageModel(
|
||||
docTypeId,
|
||||
docTypeTitle,
|
||||
compressedImage
|
||||
);*/
|
||||
private DepartmentAdapter departmentAdapter;
|
||||
private SafetyTrainingAdapter safetyTrainingAdapter;
|
||||
|
||||
//Log.e("doc-image: ",""+ documentImage);
|
||||
private String safetyTrainingTopic = "";
|
||||
private String targetAudience = "", location = "", subLocation = "";
|
||||
EditText etNoOfEmployees;
|
||||
|
||||
int position = PaperImageList.size();
|
||||
PaperImageList.add(compressedImage);
|
||||
imagePaperAdapter.notifyItemInserted(position);
|
||||
});
|
||||
},
|
||||
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();
|
||||
}
|
||||
});
|
||||
private ArrayList<HseBuilding> locationArrayList_temp = new ArrayList<>();
|
||||
private ArrayList<HseBuilding> locationArrayList = new ArrayList<>();
|
||||
private BuildingsAdapter buildingAdapter;
|
||||
|
||||
// Activity Result Launcher for Paper Camera
|
||||
private final ActivityResultLauncher<Intent> paperCameraLauncher =
|
||||
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
|
||||
private ArrayList<HseFloor> subLocationArrayList_temp = new ArrayList<>();
|
||||
private ArrayList<HseFloor> subLocationArrayList = new ArrayList<>();
|
||||
private FloorsAdapter floorsAdapter;
|
||||
|
||||
if (result.getResultCode() == RESULT_OK) {
|
||||
|
||||
File imageFile = new File(paperFilePath);
|
||||
if (imageFile.exists()) {
|
||||
|
||||
Bitmap originalBitmap = fixImageRotation(paperFilePath);
|
||||
|
||||
//Bitmap timestampedBitmap = addTimestampToImage(originalBitmap);
|
||||
|
||||
bitmapToByteArrayAsync(
|
||||
originalBitmap,
|
||||
100, // Target size in KB
|
||||
imageBytes -> {
|
||||
this.runOnUiThread(() -> {
|
||||
|
||||
/*DocumentTypeImageModel documentImage = new DocumentTypeImageModel(
|
||||
docTypeId,
|
||||
docTypeTitle,
|
||||
imageBytes
|
||||
);*/
|
||||
|
||||
//Log.e("doc-image: ",""+ documentImage);
|
||||
|
||||
int position = PaperImageList.size();
|
||||
PaperImageList.add(imageBytes);
|
||||
imagePaperAdapter.notifyItemInserted(position);
|
||||
|
||||
});
|
||||
},
|
||||
error -> {
|
||||
error.printStackTrace();
|
||||
}
|
||||
);
|
||||
|
||||
} else {
|
||||
Toast.makeText(this, "Image file not found!", 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
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -176,12 +118,7 @@ public class HseOneActivity extends AppCompatActivity implements EasyPermissions
|
|||
|
||||
initializeLayouts();
|
||||
|
||||
imgUpload.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
alertForPictures(HseOneActivity.this);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
imgBack.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -193,237 +130,126 @@ public class HseOneActivity extends AppCompatActivity implements EasyPermissions
|
|||
btnNext.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(HseOneActivity.this, HseTwoActivity.class);
|
||||
startActivity(intent);
|
||||
if (isValidate()) {
|
||||
Intent intent = new Intent(HseOneActivity.this, HseTwoActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
safetyTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
safetyTrainingTopic = safetyTrainingArrayList.get(position).getTitle();
|
||||
StorageManager.getInstance().getHseTrainingModel().get(0).setSafetyTopicId(safetyTrainingArrayList.get(position).getId());
|
||||
}
|
||||
});
|
||||
|
||||
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());
|
||||
}
|
||||
});
|
||||
|
||||
etNoOfEmployees.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).setEmployeeAttendance(Integer.parseInt(s.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initializeLayouts() {
|
||||
imgUpload = findViewById(R.id.img_upload);
|
||||
imgBack = findViewById(R.id.img_back);
|
||||
btnNext = findViewById(R.id.btn_next);
|
||||
etNoOfEmployees = findViewById(R.id.et_no_of_employees);
|
||||
|
||||
trainingPicRecyclerView = findViewById(R.id.tPicturesRecyclerView);
|
||||
safetyTextview = findViewById(R.id.safety_textview);
|
||||
targetAudienceTextview = findViewById(R.id.target_audience_textview);
|
||||
|
||||
imagePaperAdapter = new PTWImageAdapter(PaperImageList, this, "");
|
||||
trainingPicRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
|
||||
trainingPicRecyclerView.setAdapter(imagePaperAdapter);
|
||||
locationTextview = findViewById(R.id.location_textview);
|
||||
subLocationTextView = findViewById(R.id.sub_location_textview);
|
||||
|
||||
}
|
||||
safetyTrainingArrayList.addAll(Helper.getList(Helper.hseSafetyTrainingTopics, this, HseSafetyTrainingTopic.class));
|
||||
safetyTrainingAdapter = new SafetyTrainingAdapter(this, safetyTrainingArrayList);
|
||||
safetyTextview.setAdapter(safetyTrainingAdapter);
|
||||
|
||||
public void bitmapToByteArrayAsync(
|
||||
Bitmap bitmap,
|
||||
int targetSizeInKB,
|
||||
Consumer<byte[]> onSuccess,
|
||||
Consumer<Exception> onError
|
||||
) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
if (bitmap == null) {
|
||||
throw new IllegalArgumentException("Bitmap cannot be null.");
|
||||
}
|
||||
departmentArrayList_temp.addAll(Helper.getList(Helper.hseDepartment, this, HseDepartment.class));
|
||||
|
||||
int targetSizeInBytes = targetSizeInKB * 1024;
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
int minQuality = 10;
|
||||
int maxQuality = 100;
|
||||
int quality = maxQuality;
|
||||
if (!departmentArrayList_temp.isEmpty()) {
|
||||
|
||||
// Binary search for the best quality that meets the target size
|
||||
while (minQuality <= maxQuality) {
|
||||
byteArrayOutputStream.reset();
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, quality, byteArrayOutputStream);
|
||||
List<HseDepartment> filteredUnitItems = departmentArrayList_temp.stream()
|
||||
.filter(item -> Objects.equals(item.getSiteId(), StorageManager.getInstance().getSite_id()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
int byteSize = byteArrayOutputStream.size();
|
||||
if (byteSize > targetSizeInBytes) {
|
||||
maxQuality = quality - 1;
|
||||
} else {
|
||||
minQuality = quality + 1;
|
||||
}
|
||||
quality = (minQuality + maxQuality) / 2;
|
||||
}
|
||||
|
||||
onSuccess.accept(byteArrayOutputStream.toByteArray());
|
||||
} catch (Exception e) {
|
||||
onError.accept(e);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
private Bitmap fixImageRotation(String imagePath) {
|
||||
Bitmap bitmap = BitmapFactory.decodeFile(imagePath);
|
||||
try {
|
||||
ExifInterface exif = new ExifInterface(imagePath);
|
||||
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED);
|
||||
|
||||
int rotationAngle = 0;
|
||||
switch (orientation) {
|
||||
case ExifInterface.ORIENTATION_ROTATE_90:
|
||||
rotationAngle = 90;
|
||||
break;
|
||||
case ExifInterface.ORIENTATION_ROTATE_180:
|
||||
rotationAngle = 180;
|
||||
break;
|
||||
case ExifInterface.ORIENTATION_ROTATE_270:
|
||||
rotationAngle = 270;
|
||||
break;
|
||||
}
|
||||
|
||||
if (rotationAngle != 0) {
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.postRotate(rotationAngle);
|
||||
return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
departmentArrayList.clear();
|
||||
departmentArrayList.addAll(filteredUnitItems);
|
||||
departmentAdapter = new DepartmentAdapter(this, departmentArrayList);
|
||||
targetAudienceTextview.setAdapter(departmentAdapter);
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
public void alertForPictures(Context con) {
|
||||
ViewGroup viewGroup = findViewById(android.R.id.content);
|
||||
locationArrayList_temp.addAll(Helper.getList(Helper.hseBuildings, this, HseBuilding.class));
|
||||
|
||||
TextView dialogCameraBtn, dialogGalleryBtn;
|
||||
//Location -- Building
|
||||
if (!locationArrayList_temp.isEmpty()) {
|
||||
|
||||
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);
|
||||
List<HseBuilding> filteredUnitItems = locationArrayList_temp.stream()
|
||||
.filter(item -> Objects.equals(item.getSiteId(), StorageManager.getInstance().getSite_id()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
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(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);
|
||||
locationArrayList.clear();
|
||||
locationArrayList.addAll(filteredUnitItems);
|
||||
buildingAdapter = new BuildingsAdapter(this, locationArrayList);
|
||||
locationTextview.setAdapter(buildingAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
@AfterPermissionGranted(CAMERA_REQUEST_PAPER)
|
||||
public void openCamera() {
|
||||
if (hasCameraPermission()) {
|
||||
try {
|
||||
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
File photoFile = null;
|
||||
try {
|
||||
photoFile = createImageFile();
|
||||
} catch (IOException ex) {
|
||||
// Error occurred while creating the File
|
||||
}
|
||||
subLocationArrayList_temp.addAll(Helper.getList(Helper.hseFloors, this, HseFloor.class));
|
||||
|
||||
if (photoFile != null) {
|
||||
//Sub Location -- floor
|
||||
if (!subLocationArrayList_temp.isEmpty()) {
|
||||
|
||||
Uri photoURI = FileProvider.getUriForFile(this,
|
||||
getPackageName(),
|
||||
photoFile);
|
||||
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
|
||||
//startActivityForResult(takePictureIntent, CAMERA_REQUEST);
|
||||
paperCameraLauncher.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};
|
||||
}
|
||||
List<HseFloor> filteredUnitItems = subLocationArrayList_temp.stream()
|
||||
.filter(item -> Objects.equals(item.getSiteId(), StorageManager.getInstance().getSite_id()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
EasyPermissions.requestPermissions(this, getString(R.string.rationale_camera), CAMERA_REQUEST_PAPER, perms);
|
||||
subLocationArrayList.clear();
|
||||
subLocationArrayList.addAll(filteredUnitItems);
|
||||
floorsAdapter = new FloorsAdapter(this, subLocationArrayList);
|
||||
subLocationTextView.setAdapter(floorsAdapter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*@AfterPermissionGranted(CAMERA_REQUEST_ITEM)
|
||||
|
@ -462,76 +288,41 @@ public class HseOneActivity extends AppCompatActivity implements EasyPermissions
|
|||
}
|
||||
}*/
|
||||
|
||||
@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 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();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasCameraPermission() {
|
||||
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};
|
||||
public boolean isValidate() {
|
||||
boolean returnValue = true;
|
||||
String message = "";
|
||||
|
||||
if (subLocation.isEmpty()) {
|
||||
message = "Please select floor.";
|
||||
returnValue = false;
|
||||
}
|
||||
|
||||
//Log.e("perms: ",""+perms);
|
||||
return EasyPermissions.hasPermissions(this, 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};
|
||||
if (location.isEmpty()) {
|
||||
message = "Please select building.";
|
||||
returnValue = false;
|
||||
}
|
||||
|
||||
return EasyPermissions.hasPermissions(this, perms);
|
||||
}
|
||||
if (targetAudience.isEmpty()) {
|
||||
message = "Please select department.";
|
||||
returnValue = false;
|
||||
}
|
||||
|
||||
private File createImageFile() 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 (etNoOfEmployees.getText().toString().isEmpty()) {
|
||||
message = "Please enter No of Employees.";
|
||||
returnValue = false;
|
||||
}
|
||||
|
||||
paperFilePath = image.getAbsolutePath();
|
||||
if (safetyTrainingTopic.isEmpty()) {
|
||||
message = "Please select Safety Training Topic.";
|
||||
returnValue = false;
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRationaleAccepted(int requestCode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRationaleDenied(int requestCode) {
|
||||
if (!returnValue) {
|
||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
}
|
|
@ -1,24 +1,186 @@
|
|||
package com.utopiaindustries.hseobservationsapp.activities.HSETrainingForms;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.media.ExifInterface;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
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.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
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.core.content.FileProvider;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.utopiaindustries.hseobservationsapp.R;
|
||||
import com.utopiaindustries.hseobservationsapp.activities.DashboardActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.activities.PermitToWorkForms.PermitTwoActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.PTWImageAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.ProgressDialogFragment;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.HseReportRequest;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.HseTrainingModel;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.ReportActivityModel;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.StorageManager;
|
||||
import com.utopiaindustries.hseobservationsapp.viewmodels.LoginViewModel;
|
||||
|
||||
public class HseTwoActivity extends AppCompatActivity {
|
||||
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.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import pub.devrel.easypermissions.AfterPermissionGranted;
|
||||
import pub.devrel.easypermissions.AppSettingsDialog;
|
||||
import pub.devrel.easypermissions.EasyPermissions;
|
||||
|
||||
public class HseTwoActivity extends AppCompatActivity implements EasyPermissions.PermissionCallbacks,
|
||||
EasyPermissions.RationaleCallbacks{
|
||||
|
||||
Button btnSubmit;
|
||||
EditText etTrainingSession, etDescription;
|
||||
LoginViewModel loginViewModel;
|
||||
ImageView imgBack;
|
||||
|
||||
RecyclerView trainingPicRecyclerView;
|
||||
PTWImageAdapter imagePaperAdapter;
|
||||
String paperFilePath = "no_pic";
|
||||
ArrayList<byte[]> imageList = new ArrayList<>();
|
||||
|
||||
private static final int CAMERA_REQUEST_PAPER = 1011;
|
||||
private static final int GALLERY_REQUEST = 2011;
|
||||
|
||||
ImageView imgUpload;
|
||||
|
||||
// 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();
|
||||
|
||||
uriToByteArrayAsync(
|
||||
this,
|
||||
selectedImage,
|
||||
100, // Target size in KB
|
||||
compressedImage -> {
|
||||
// Handle the compressed image here, e.g., display it
|
||||
runOnUiThread(() -> {
|
||||
/*DocumentTypeImageModel documentImage = new DocumentTypeImageModel(
|
||||
docTypeId,
|
||||
docTypeTitle,
|
||||
compressedImage
|
||||
);*/
|
||||
|
||||
//Log.e("doc-image: ",""+ documentImage);
|
||||
|
||||
int position = imageList.size();
|
||||
imageList.add(compressedImage);
|
||||
imagePaperAdapter.notifyItemInserted(position);
|
||||
});
|
||||
},
|
||||
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 Paper Camera
|
||||
private final ActivityResultLauncher<Intent> paperCameraLauncher =
|
||||
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
|
||||
|
||||
if (result.getResultCode() == RESULT_OK) {
|
||||
|
||||
File imageFile = new File(paperFilePath);
|
||||
if (imageFile.exists()) {
|
||||
|
||||
Bitmap originalBitmap = fixImageRotation(paperFilePath);
|
||||
|
||||
//Bitmap timestampedBitmap = addTimestampToImage(originalBitmap);
|
||||
|
||||
bitmapToByteArrayAsync(
|
||||
originalBitmap,
|
||||
100, // Target size in KB
|
||||
imageBytes -> {
|
||||
this.runOnUiThread(() -> {
|
||||
|
||||
/*DocumentTypeImageModel documentImage = new DocumentTypeImageModel(
|
||||
docTypeId,
|
||||
docTypeTitle,
|
||||
imageBytes
|
||||
);*/
|
||||
|
||||
//Log.e("doc-image: ",""+ documentImage);
|
||||
|
||||
int position = imageList.size();
|
||||
imageList.add(imageBytes);
|
||||
imagePaperAdapter.notifyItemInserted(position);
|
||||
|
||||
});
|
||||
},
|
||||
error -> {
|
||||
error.printStackTrace();
|
||||
}
|
||||
);
|
||||
|
||||
} else {
|
||||
Toast.makeText(this, "Image file not found!", 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
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -33,10 +195,109 @@ public class HseTwoActivity extends AppCompatActivity {
|
|||
|
||||
initializeLayouts();
|
||||
|
||||
imgBack.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
imgUpload.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
alertForPictures(HseTwoActivity.this);
|
||||
}
|
||||
});
|
||||
|
||||
btnSubmit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(HseTwoActivity.this,"Reported Submitted",Toast.LENGTH_SHORT).show();
|
||||
/*Toast.makeText(HseTwoActivity.this,"Reported Submitted",Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent(HseTwoActivity.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);*/
|
||||
if (isValidate()){
|
||||
StorageManager.getInstance().getHseTrainingModel().get(0).setPictures(imageList);
|
||||
alertReportSubmit(HseTwoActivity.this);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
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() {
|
||||
|
||||
btnSubmit = findViewById(R.id.btn_submit);
|
||||
etTrainingSession = findViewById(R.id.et_training_session);
|
||||
imgBack = findViewById(R.id.img_back);
|
||||
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);
|
||||
|
||||
imagePaperAdapter = new PTWImageAdapter(imageList, this, "");
|
||||
trainingPicRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
|
||||
trainingPicRecyclerView.setAdapter(imagePaperAdapter);
|
||||
|
||||
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(HseTwoActivity.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);
|
||||
|
@ -46,8 +307,381 @@ public class HseTwoActivity extends AppCompatActivity {
|
|||
});
|
||||
}
|
||||
|
||||
private void initializeLayouts() {
|
||||
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<HseTrainingModel> reportList = StorageManager.getInstance().getHseTrainingModel();
|
||||
HseReportRequest<HseTrainingModel> hseTrainingRequest = new HseReportRequest<>();
|
||||
hseTrainingRequest.setObservation_date(StorageManager.getInstance().getObservation_date());
|
||||
hseTrainingRequest.setUserId(StorageManager.getInstance().getUserId());
|
||||
hseTrainingRequest.setSite_id(StorageManager.getInstance().getSite_id());
|
||||
hseTrainingRequest.setSupervisorId(StorageManager.getInstance().getSupervisorId());
|
||||
hseTrainingRequest.setSupervisorName(StorageManager.getInstance().getSupervisorName());
|
||||
hseTrainingRequest.setShift(StorageManager.getInstance().getShift());
|
||||
hseTrainingRequest.setRecordTypeId(StorageManager.getInstance().getRecordTypeId());
|
||||
hseTrainingRequest.setReportData(reportList);
|
||||
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
String jsonRequest = gson.toJson(hseTrainingRequest);
|
||||
Log.e("RequestModel JSON", jsonRequest);
|
||||
|
||||
loginViewModel.saveHSEData(hseTrainingRequest);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
dialogCancelBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
alertDialog.dismiss();
|
||||
//Toast.makeText(con, "Cancel", Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
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() {
|
||||
boolean returnValue = true;
|
||||
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) {
|
||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public void bitmapToByteArrayAsync(
|
||||
Bitmap bitmap,
|
||||
int targetSizeInKB,
|
||||
Consumer<byte[]> onSuccess,
|
||||
Consumer<Exception> onError
|
||||
) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
if (bitmap == null) {
|
||||
throw new IllegalArgumentException("Bitmap cannot be null.");
|
||||
}
|
||||
|
||||
int targetSizeInBytes = targetSizeInKB * 1024;
|
||||
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 (Exception e) {
|
||||
onError.accept(e);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
private Bitmap fixImageRotation(String imagePath) {
|
||||
Bitmap bitmap = BitmapFactory.decodeFile(imagePath);
|
||||
try {
|
||||
ExifInterface exif = new ExifInterface(imagePath);
|
||||
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED);
|
||||
|
||||
int rotationAngle = 0;
|
||||
switch (orientation) {
|
||||
case ExifInterface.ORIENTATION_ROTATE_90:
|
||||
rotationAngle = 90;
|
||||
break;
|
||||
case ExifInterface.ORIENTATION_ROTATE_180:
|
||||
rotationAngle = 180;
|
||||
break;
|
||||
case ExifInterface.ORIENTATION_ROTATE_270:
|
||||
rotationAngle = 270;
|
||||
break;
|
||||
}
|
||||
|
||||
if (rotationAngle != 0) {
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.postRotate(rotationAngle);
|
||||
return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
@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(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);
|
||||
}
|
||||
}
|
||||
|
||||
@AfterPermissionGranted(CAMERA_REQUEST_PAPER)
|
||||
public void openCamera() {
|
||||
if (hasCameraPermission()) {
|
||||
try {
|
||||
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
File photoFile = null;
|
||||
try {
|
||||
photoFile = createImageFile();
|
||||
} catch (IOException ex) {
|
||||
// Error occurred while creating the File
|
||||
}
|
||||
|
||||
if (photoFile != null) {
|
||||
|
||||
Uri photoURI = FileProvider.getUriForFile(this,
|
||||
getPackageName(),
|
||||
photoFile);
|
||||
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
|
||||
//startActivityForResult(takePictureIntent, CAMERA_REQUEST);
|
||||
paperCameraLauncher.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_PAPER, perms);
|
||||
}
|
||||
}
|
||||
|
||||
@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 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();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasCameraPermission() {
|
||||
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};
|
||||
|
||||
}
|
||||
|
||||
//Log.e("perms: ",""+perms);
|
||||
return EasyPermissions.hasPermissions(this, 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 File createImageFile() 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
|
||||
);
|
||||
|
||||
paperFilePath = image.getAbsolutePath();
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRationaleAccepted(int requestCode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRationaleDenied(int requestCode) {
|
||||
|
||||
btnSubmit = findViewById(R.id.btn_submit);
|
||||
}
|
||||
}
|
|
@ -17,9 +17,13 @@ import androidx.core.view.ViewCompat;
|
|||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.utopiaindustries.hseobservationsapp.R;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.BuildingsAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.FloorsAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.ObservationClassAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.ObservationSubClassAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.helper.Helper;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseBuilding;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseFloor;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseObservationClass;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseObservationSubClass;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.StorageManager;
|
||||
|
@ -31,7 +35,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
public class ObservationOneActivity extends AppCompatActivity {
|
||||
|
||||
private AutoCompleteTextView observationTextview, observationSubTextview;
|
||||
private AutoCompleteTextView observationTextview, observationSubTextview, buildingTextview, floorTextview;
|
||||
|
||||
private ObservationClassAdapter observationClassAdapter;
|
||||
private ObservationSubClassAdapter observationSubClassAdapter;
|
||||
|
@ -40,11 +44,19 @@ public class ObservationOneActivity extends AppCompatActivity {
|
|||
private ArrayList<HseObservationSubClass> obSubClassArrayList_temp = 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;
|
||||
ImageView imgBack;
|
||||
|
||||
String observationClass = "", observationSubClass = "";
|
||||
String observationClass = "", observationSubClass = "", building = "", floor = "";
|
||||
int observationClassId = 0, observationSubClassId = 0;
|
||||
private BuildingsAdapter buildingAdapter;
|
||||
private FloorsAdapter floorsAdapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -92,6 +104,7 @@ public class ObservationOneActivity extends AppCompatActivity {
|
|||
HseObservationClass clickedItem = obClassArrayList.get(position);
|
||||
|
||||
StorageManager.getInstance().getObservationsModel().get(0).setObservationClassId(clickedItem.getId());
|
||||
StorageManager.getInstance().getObservationsModel().get(0).setHseObservationName(observationClass);
|
||||
|
||||
observationSubTextview.setText(null);
|
||||
|
||||
|
@ -116,7 +129,28 @@ public class ObservationOneActivity extends AppCompatActivity {
|
|||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
// Perform action when shiftTextview item is clicked
|
||||
//Toast.makeText(ObservationOneActivity.this, "Item clicked: " + obSubClassArrayList.get(position).getTitle(), Toast.LENGTH_SHORT).show();
|
||||
observationSubClass = obSubClassArrayList.get(position).getTitle();
|
||||
StorageManager.getInstance().getObservationsModel().get(0).setObservationSubClassId(obSubClassArrayList.get(position).getId());
|
||||
StorageManager.getInstance().getObservationsModel().get(0).setHseObservationSubClassName(observationSubClass);
|
||||
}
|
||||
});
|
||||
|
||||
buildingTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
building = hseBuildingArrayList.get(position).getTitle();
|
||||
StorageManager.getInstance().getObservationsModel().get(0).setBuildingId(hseBuildingArrayList.get(position).getId());
|
||||
StorageManager.getInstance().getObservationsModel().get(0).setBuildingName(hseBuildingArrayList.get(position).getTitle());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
floorTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
floor = hseFloorArrayList.get(position).getTitle();
|
||||
StorageManager.getInstance().getObservationsModel().get(0).setFloorId(hseFloorArrayList.get(position).getId());
|
||||
StorageManager.getInstance().getObservationsModel().get(0).setFloorName(hseFloorArrayList.get(position).getTitle());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -124,6 +158,8 @@ public class ObservationOneActivity extends AppCompatActivity {
|
|||
public void initializeLayout() {
|
||||
observationTextview = findViewById(R.id.observation_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);
|
||||
imgBack = findViewById(R.id.img_back);
|
||||
|
||||
|
@ -133,6 +169,35 @@ public class ObservationOneActivity extends AppCompatActivity {
|
|||
observationClassAdapter = new ObservationClassAdapter(this, obClassArrayList);
|
||||
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
|
||||
//for Unsafe
|
||||
//for condition
|
||||
|
@ -145,6 +210,16 @@ public class ObservationOneActivity extends AppCompatActivity {
|
|||
boolean returnValue = true;
|
||||
String message = "";
|
||||
|
||||
if (floor.isEmpty()) {
|
||||
message = "Please select floor.";
|
||||
returnValue = false;
|
||||
}
|
||||
|
||||
if (building.isEmpty()) {
|
||||
message = "Please select building.";
|
||||
returnValue = false;
|
||||
}
|
||||
|
||||
if (observationSubClass.isEmpty()) {
|
||||
message = "Please select observation sub class.";
|
||||
returnValue = false;
|
||||
|
|
|
@ -33,6 +33,8 @@ import com.google.gson.GsonBuilder;
|
|||
import com.utopiaindustries.hseobservationsapp.R;
|
||||
import com.utopiaindustries.hseobservationsapp.activities.DashboardActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.HSERequestModel;
|
||||
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.ProgressDialogFragment;
|
||||
import com.utopiaindustries.hseobservationsapp.viewmodels.LoginViewModel;
|
||||
|
@ -40,6 +42,7 @@ import com.utopiaindustries.hseobservationsapp.viewmodels.LoginViewModel;
|
|||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ObservationThreeActivity extends AppCompatActivity {
|
||||
|
@ -48,6 +51,7 @@ public class ObservationThreeActivity extends AppCompatActivity {
|
|||
ImageView imgBack;
|
||||
Button btnSubmit, btnDraft;
|
||||
EditText etDescription;
|
||||
String obStatus = "";
|
||||
|
||||
LoginViewModel loginViewModel;
|
||||
|
||||
|
@ -92,8 +96,10 @@ public class ObservationThreeActivity extends AppCompatActivity {
|
|||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -102,14 +108,9 @@ public class ObservationThreeActivity extends AppCompatActivity {
|
|||
btnSubmit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
alertReportSubmit(ObservationThreeActivity.this);
|
||||
/*Toast.makeText(ObservationThreeActivity.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);*/
|
||||
if (isValidate()) {
|
||||
alertReportSubmit(ObservationThreeActivity.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -181,22 +182,22 @@ public class ObservationThreeActivity extends AppCompatActivity {
|
|||
|
||||
alertDialog.dismiss();
|
||||
|
||||
// byte[] reportBytes = convertReportToByteArray();
|
||||
/*HSERequestModel requestModel = new HSERequestModel();
|
||||
requestModel.setSite_id(StorageManager.getInstance().getSite_id());
|
||||
requestModel.setSupervisorId(StorageManager.getInstance().getSupervisorId());
|
||||
requestModel.setObservation_date(StorageManager.getInstance().getObservation_date());
|
||||
requestModel.setShift(StorageManager.getInstance().getShift());
|
||||
requestModel.setRecordTypeId(StorageManager.getInstance().getRecordTypeId());
|
||||
requestModel.setObservationModel(StorageManager.getInstance().getObservationsModel());*/
|
||||
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(StorageManager.getInstance());
|
||||
String jsonRequest = gson.toJson(observationRequest);
|
||||
Log.e("RequestModel JSON", jsonRequest);
|
||||
|
||||
//loginViewModel.saveHSEData(requestModel);
|
||||
|
||||
|
||||
loginViewModel.saveHSEData(observationRequest);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -254,4 +255,25 @@ public class ObservationThreeActivity extends AppCompatActivity {
|
|||
progressDialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isValidate() {
|
||||
boolean returnValue = true;
|
||||
String message = "";
|
||||
|
||||
if (etDescription.getText().toString().isEmpty()) {
|
||||
message = "Please enter description.";
|
||||
returnValue = false;
|
||||
}
|
||||
|
||||
if (obStatus.isEmpty()) {
|
||||
message = "Please select Status.";
|
||||
returnValue = false;
|
||||
}
|
||||
|
||||
if (!returnValue) {
|
||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
}
|
|
@ -33,9 +33,14 @@ import com.utopiaindustries.hseobservationsapp.R;
|
|||
import com.utopiaindustries.hseobservationsapp.activities.DashboardActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.HSERequestModel;
|
||||
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.ReportActivityModel;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.StorageManager;
|
||||
import com.utopiaindustries.hseobservationsapp.viewmodels.LoginViewModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OtherHseActivity extends AppCompatActivity {
|
||||
|
||||
Button btnSubmit;
|
||||
|
@ -188,11 +193,22 @@ public class OtherHseActivity extends AppCompatActivity {
|
|||
|
||||
alertDialog.dismiss();
|
||||
|
||||
List<ReportActivityModel> reportList = StorageManager.getInstance().getReportActivityModel();
|
||||
HseReportRequest<ReportActivityModel> reportRequest = new HseReportRequest<>();
|
||||
reportRequest.setObservation_date(StorageManager.getInstance().getObservation_date());
|
||||
reportRequest.setUserId(StorageManager.getInstance().getUserId());
|
||||
reportRequest.setSite_id(StorageManager.getInstance().getSite_id());
|
||||
reportRequest.setSupervisorId(StorageManager.getInstance().getSupervisorId());
|
||||
reportRequest.setSupervisorName(StorageManager.getInstance().getSupervisorName());
|
||||
reportRequest.setShift(StorageManager.getInstance().getShift());
|
||||
reportRequest.setRecordTypeId(StorageManager.getInstance().getRecordTypeId());
|
||||
reportRequest.setReportData(reportList);
|
||||
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
String jsonRequest = gson.toJson(StorageManager.getInstance());
|
||||
String jsonRequest = gson.toJson(reportRequest);
|
||||
Log.e("RequestModel JSON", jsonRequest);
|
||||
|
||||
//loginViewModel.saveHSEData(requestModel);
|
||||
loginViewModel.saveHSEData(reportRequest);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -25,12 +25,14 @@ import com.utopiaindustries.hseobservationsapp.R;
|
|||
import com.utopiaindustries.hseobservationsapp.activities.ObservationForms.ObservationThreeActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.activities.ObservationForms.ObservationTwoActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.BuildingsAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.DepartmentAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.FloorsAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.HsePtwTypeAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.WorkingTeamAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.helper.Helper;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseActivity;
|
||||
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.HsePtwType;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseWorkingTeam;
|
||||
|
@ -41,16 +43,21 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
//Department dropdown working
|
||||
public class PermitOneActivity extends AppCompatActivity {
|
||||
|
||||
private Button btnNext;
|
||||
ImageView imgBack;
|
||||
|
||||
private AutoCompleteTextView locationTextview, subLocationTextView, ptwTypeTextView,
|
||||
ptwSubTypeTextView, workingTeamTextView;
|
||||
ptwSubTypeTextView, workingTeamTextView, departmentTextview;
|
||||
|
||||
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;
|
||||
|
@ -67,6 +74,7 @@ public class PermitOneActivity extends AppCompatActivity {
|
|||
private WorkingTeamAdapter workingTeamAdapter;
|
||||
|
||||
String location = "", subLocation = "", ptwType = "", workingTeam = "";
|
||||
String departmentName = "";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -133,6 +141,15 @@ public class PermitOneActivity extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
|
||||
departmentTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
departmentName = departmentArrayList.get(position).getTitle();
|
||||
StorageManager.getInstance().getPermitToWorkModel().get(0).setDepartmentId(departmentArrayList.get(position).getId());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initializeLayout() {
|
||||
|
@ -144,6 +161,7 @@ public class PermitOneActivity extends AppCompatActivity {
|
|||
subLocationTextView = findViewById(R.id.sub_location_textview);
|
||||
ptwTypeTextView = findViewById(R.id.ptw_type_textview);
|
||||
ptwTextInputLayout = findViewById(R.id.ptw_type_input);
|
||||
departmentTextview = findViewById(R.id.department_textview);
|
||||
|
||||
ptwTypeTextView.setFocusable(false);
|
||||
ptwTypeTextView.setCursorVisible(false);
|
||||
|
@ -152,6 +170,21 @@ public class PermitOneActivity extends AppCompatActivity {
|
|||
|
||||
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
|
||||
|
@ -213,6 +246,10 @@ public class PermitOneActivity extends AppCompatActivity {
|
|||
message = "Please select location.";
|
||||
returnValue = false;
|
||||
}
|
||||
if (departmentName.isEmpty()) {
|
||||
message = "Please select Department.";
|
||||
returnValue = false;
|
||||
}
|
||||
|
||||
if (!returnValue) {
|
||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||
|
@ -239,8 +276,10 @@ public class PermitOneActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
String selectedTitles = selected.get(0).getTitle() + ", " + selected.get(1).getTitle();
|
||||
String selectedTypeSubType = selected.get(0).getId() + ", " + selected.get(1).getId();
|
||||
textView.setText(selectedTitles);
|
||||
ptwType = selectedTitles;
|
||||
StorageManager.getInstance().getPermitToWorkModel().get(0).setTypeId(selectedTypeSubType);
|
||||
});
|
||||
|
||||
builder.setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss());
|
||||
|
|
|
@ -15,10 +15,12 @@ import android.net.Uri;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
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.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -40,17 +42,26 @@ import androidx.core.content.FileProvider;
|
|||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
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.activities.DashboardActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.activities.ObservationForms.ObservationThreeActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.PTWImageAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.models.DocumentTypeImageModel;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.ProgressDialogFragment;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.HseReportRequest;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.HseTrainingModel;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.PermitToWorkModel;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.StorageManager;
|
||||
import com.utopiaindustries.hseobservationsapp.viewmodels.LoginViewModel;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
|
@ -81,6 +92,9 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
|||
ImageView imgUpload, imgBack;
|
||||
Button btnSubmit;
|
||||
EditText etDescription;
|
||||
LoginViewModel loginViewModel;
|
||||
NestedScrollView scrollView;
|
||||
String workingParty = "";
|
||||
|
||||
// Activity Result Launcher for Gallery
|
||||
private final ActivityResultLauncher<Intent> imagePickerLauncher =
|
||||
|
@ -192,6 +206,7 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
|||
public void onClick(View v) {
|
||||
if (checkboxCompany.isChecked()) {
|
||||
checkboxContractor.setChecked(false);
|
||||
workingParty = "Company";
|
||||
StorageManager.getInstance().getPermitToWorkModel().get(0).setWorkingPartyType("Company");
|
||||
}
|
||||
}
|
||||
|
@ -202,6 +217,7 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
|||
public void onClick(View v) {
|
||||
if (checkboxContractor.isChecked()) {
|
||||
checkboxCompany.setChecked(false);
|
||||
workingParty = "Contractor";
|
||||
StorageManager.getInstance().getPermitToWorkModel().get(0).setWorkingPartyType("Contractor");
|
||||
}
|
||||
}
|
||||
|
@ -224,13 +240,12 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
|||
btnSubmit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
StorageManager.getInstance().getPermitToWorkModel().get(0).setPictures(imageList);
|
||||
Toast.makeText(PermitTwoActivity.this,"Reported Submitted",Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent(PermitTwoActivity.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);
|
||||
if (!isValidate()) {
|
||||
StorageManager.getInstance().getPermitToWorkModel().get(0).setPictures(imageList);
|
||||
// Toast.makeText(PermitTwoActivity.this,"Reported Submitted",Toast.LENGTH_SHORT).show();
|
||||
alertReportSubmit(PermitTwoActivity.this);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -250,6 +265,70 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
etDescription.setOnFocusChangeListener((v, hasFocus) -> {
|
||||
if (hasFocus) {
|
||||
new Handler().postDelayed(() -> {
|
||||
scrollView.smoothScrollTo(0, etDescription.getBottom());
|
||||
}, 200);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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<PermitToWorkModel> reportList = StorageManager.getInstance().getPermitToWorkModel();
|
||||
HseReportRequest<PermitToWorkModel> hseTrainingRequest = new HseReportRequest<>();
|
||||
hseTrainingRequest.setObservation_date(StorageManager.getInstance().getObservation_date());
|
||||
hseTrainingRequest.setUserId(StorageManager.getInstance().getUserId());
|
||||
hseTrainingRequest.setSite_id(StorageManager.getInstance().getSite_id());
|
||||
hseTrainingRequest.setSupervisorId(StorageManager.getInstance().getSupervisorId());
|
||||
hseTrainingRequest.setSupervisorName(StorageManager.getInstance().getSupervisorName());
|
||||
hseTrainingRequest.setShift(StorageManager.getInstance().getShift());
|
||||
hseTrainingRequest.setRecordTypeId(StorageManager.getInstance().getRecordTypeId());
|
||||
hseTrainingRequest.setReportData(reportList);
|
||||
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
String jsonRequest = gson.toJson(hseTrainingRequest);
|
||||
Log.e("RequestModel JSON", jsonRequest);
|
||||
|
||||
loginViewModel.saveHSEData(hseTrainingRequest);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
dialogCancelBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
alertDialog.dismiss();
|
||||
//Toast.makeText(con, "Cancel", Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
|
@ -322,6 +401,7 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
|||
etDescription = findViewById(R.id.et_description);
|
||||
etDescription.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
etDescription.setRawInputType(InputType.TYPE_CLASS_TEXT);
|
||||
scrollView = findViewById(R.id.scrollView2);
|
||||
|
||||
ptwRecyclerView = findViewById(R.id.ptwRecyclerView);
|
||||
|
||||
|
@ -329,6 +409,32 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
|||
ptwRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
|
||||
ptwRecyclerView.setAdapter(imagePaperAdapter);
|
||||
|
||||
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(PermitTwoActivity.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);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@AfterPermissionGranted(CAMERA_REQUEST_PAPER)
|
||||
|
@ -592,4 +698,39 @@ public class PermitTwoActivity extends AppCompatActivity implements EasyPermissi
|
|||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
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() {
|
||||
boolean returnValue = true;
|
||||
String message = "";
|
||||
|
||||
if (etDescription.getText().toString().isEmpty()) {
|
||||
message = "Please enter description.";
|
||||
returnValue = false;
|
||||
}
|
||||
|
||||
if (workingParty.isEmpty()) {
|
||||
message = "Please select Working Party.";
|
||||
returnValue = false;
|
||||
}
|
||||
|
||||
if (!returnValue) {
|
||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@ 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.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -41,17 +42,24 @@ import androidx.core.content.FileProvider;
|
|||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.utopiaindustries.hseobservationsapp.R;
|
||||
import com.utopiaindustries.hseobservationsapp.activities.DashboardActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.activities.PermitToWorkForms.PermitTwoActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.activities.WeeklyActivityForms.WeeklyFormOne;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.HseActivitiesAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.PTWImageAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.helper.Helper;
|
||||
import com.utopiaindustries.hseobservationsapp.models.DocumentTypeImageModel;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.ProgressDialogFragment;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.HseReportRequest;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.ReportActivityModel;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.StorageManager;
|
||||
import com.utopiaindustries.hseobservationsapp.viewmodels.LoginViewModel;
|
||||
|
||||
|
@ -212,12 +220,17 @@ public class ProgressiveActivity extends AppCompatActivity implements EasyPermis
|
|||
btnSubmit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(ProgressiveActivity.this,"Reported Submitted",Toast.LENGTH_SHORT).show();
|
||||
|
||||
StorageManager.getInstance().getProgressiveActivityModel().get(0).setPictures(PaperImageList);
|
||||
// Toast.makeText(PermitTwoActivity.this,"Reported Submitted",Toast.LENGTH_SHORT).show();
|
||||
alertReportSubmit(ProgressiveActivity.this);
|
||||
/*Toast.makeText(ProgressiveActivity.this,"Reported Submitted",Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent(ProgressiveActivity.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);
|
||||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);*/
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -250,6 +263,62 @@ public class ProgressiveActivity extends AppCompatActivity implements EasyPermis
|
|||
});
|
||||
}
|
||||
|
||||
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<ReportActivityModel> reportList = StorageManager.getInstance().getReportActivityModel();
|
||||
HseReportRequest<ReportActivityModel> reportRequest = new HseReportRequest<>();
|
||||
reportRequest.setObservation_date(StorageManager.getInstance().getObservation_date());
|
||||
reportRequest.setUserId(StorageManager.getInstance().getUserId());
|
||||
reportRequest.setSite_id(StorageManager.getInstance().getSite_id());
|
||||
reportRequest.setSupervisorId(StorageManager.getInstance().getSupervisorId());
|
||||
reportRequest.setSupervisorName(StorageManager.getInstance().getSupervisorName());
|
||||
reportRequest.setShift(StorageManager.getInstance().getShift());
|
||||
reportRequest.setRecordTypeId(StorageManager.getInstance().getRecordTypeId());
|
||||
reportRequest.setReportData(reportList);
|
||||
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
String jsonRequest = gson.toJson(reportRequest);
|
||||
Log.e("RequestModel JSON", jsonRequest);
|
||||
|
||||
loginViewModel.saveHSEData(reportRequest);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
dialogCancelBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
alertDialog.dismiss();
|
||||
//Toast.makeText(con, "Cancel", Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
private void initializeLayouts() {
|
||||
|
||||
imgUpload = findViewById(R.id.img_upload);
|
||||
|
@ -269,6 +338,32 @@ public class ProgressiveActivity extends AppCompatActivity implements EasyPermis
|
|||
imagePaperAdapter = new PTWImageAdapter(PaperImageList, this, "");
|
||||
picturesRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
|
||||
picturesRecyclerView.setAdapter(imagePaperAdapter);
|
||||
|
||||
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(ProgressiveActivity.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")
|
||||
|
@ -593,4 +688,18 @@ public class ProgressiveActivity extends AppCompatActivity implements EasyPermis
|
|||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -62,6 +62,8 @@ import com.utopiaindustries.hseobservationsapp.models.DocumentTypeImageModel;
|
|||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseObservationClass;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.ProgressDialogFragment;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.HseReportRequest;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.ReportActivityModel;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.StorageManager;
|
||||
import com.utopiaindustries.hseobservationsapp.viewmodels.LoginViewModel;
|
||||
|
||||
|
@ -672,11 +674,22 @@ public class WeeklyFormOne extends AppCompatActivity implements EasyPermissions.
|
|||
|
||||
alertDialog.dismiss();
|
||||
|
||||
List<ReportActivityModel> reportList = StorageManager.getInstance().getReportActivityModel();
|
||||
HseReportRequest<ReportActivityModel> reportRequest = new HseReportRequest<>();
|
||||
reportRequest.setObservation_date(StorageManager.getInstance().getObservation_date());
|
||||
reportRequest.setUserId(StorageManager.getInstance().getUserId());
|
||||
reportRequest.setSite_id(StorageManager.getInstance().getSite_id());
|
||||
reportRequest.setSupervisorId(StorageManager.getInstance().getSupervisorId());
|
||||
reportRequest.setSupervisorName(StorageManager.getInstance().getSupervisorName());
|
||||
reportRequest.setShift(StorageManager.getInstance().getShift());
|
||||
reportRequest.setRecordTypeId(StorageManager.getInstance().getRecordTypeId());
|
||||
reportRequest.setReportData(reportList);
|
||||
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
String jsonRequest = gson.toJson(StorageManager.getInstance());
|
||||
String jsonRequest = gson.toJson(reportRequest);
|
||||
Log.e("RequestModel JSON", jsonRequest);
|
||||
|
||||
//loginViewModel.saveHSEData(requestModel);
|
||||
loginViewModel.saveHSEData(reportRequest);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package com.utopiaindustries.hseobservationsapp.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.utopiaindustries.hseobservationsapp.R;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseBuilding;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseSafetyTrainingTopic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SafetyTrainingAdapter extends ArrayAdapter<HseSafetyTrainingTopic> {
|
||||
|
||||
private final Context context;
|
||||
private final List<HseSafetyTrainingTopic> items;
|
||||
|
||||
public SafetyTrainingAdapter(Context context, List<HseSafetyTrainingTopic> items) {
|
||||
super(context, 0, items);
|
||||
this.context = context;
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
if (convertView == null) {
|
||||
convertView = LayoutInflater.from(context).inflate(R.layout.list_items, parent, false);
|
||||
}
|
||||
|
||||
HseSafetyTrainingTopic item = items.get(position);
|
||||
|
||||
TextView titleTextView = convertView.findViewById(R.id.item_text);
|
||||
|
||||
titleTextView.setText(item.getTitle());
|
||||
|
||||
return convertView;
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import com.utopiaindustries.hseobservationsapp.models.QualityControl;
|
|||
import com.utopiaindustries.hseobservationsapp.models.QualityControlResponse;
|
||||
import com.utopiaindustries.hseobservationsapp.models.QualitySaveResponse;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.HSERequestModel;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.HseReportRequest;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
|
@ -25,7 +26,7 @@ public interface ApiService {
|
|||
|
||||
@POST("rest/uic/hse/save-hse-report")
|
||||
Call<HseSaveResponse> saveHseReport(
|
||||
@Body HSERequestModel request
|
||||
@Body HseReportRequest request
|
||||
);
|
||||
|
||||
@POST("rest/authentication/authenticate-user")
|
||||
|
|
|
@ -29,4 +29,9 @@ public class HseSafetyTrainingTopic {
|
|||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return title;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
package com.utopiaindustries.hseobservationsapp.utils.StorageManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HseReportRequest<T> {
|
||||
|
||||
private String observation_date;
|
||||
private int userId;
|
||||
private int site_id;
|
||||
private int supervisorId;
|
||||
private String supervisorName;
|
||||
private String shift;
|
||||
private int recordTypeId;
|
||||
|
||||
private List<T> reportData;
|
||||
|
||||
public String getObservation_date() {
|
||||
return observation_date;
|
||||
}
|
||||
|
||||
public void setObservation_date(String observation_date) {
|
||||
this.observation_date = observation_date;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public int getSite_id() {
|
||||
return site_id;
|
||||
}
|
||||
|
||||
public void setSite_id(int site_id) {
|
||||
this.site_id = site_id;
|
||||
}
|
||||
|
||||
public int getSupervisorId() {
|
||||
return supervisorId;
|
||||
}
|
||||
|
||||
public void setSupervisorId(int supervisorId) {
|
||||
this.supervisorId = supervisorId;
|
||||
}
|
||||
|
||||
public String getSupervisorName() {
|
||||
return supervisorName;
|
||||
}
|
||||
|
||||
public void setSupervisorName(String supervisorName) {
|
||||
this.supervisorName = supervisorName;
|
||||
}
|
||||
|
||||
public String getShift() {
|
||||
return shift;
|
||||
}
|
||||
|
||||
public void setShift(String shift) {
|
||||
this.shift = shift;
|
||||
}
|
||||
|
||||
public int getRecordTypeId() {
|
||||
return recordTypeId;
|
||||
}
|
||||
|
||||
public void setRecordTypeId(int recordTypeId) {
|
||||
this.recordTypeId = recordTypeId;
|
||||
}
|
||||
|
||||
public List<T> getReportData() {
|
||||
return reportData;
|
||||
}
|
||||
|
||||
public void setReportData(List<T> reportData) {
|
||||
this.reportData = reportData;
|
||||
}
|
||||
|
||||
public HseReportRequest() {
|
||||
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) {
|
||||
this.observation_date = observation_date;
|
||||
this.userId = userId;
|
||||
this.site_id = site_id;
|
||||
this.supervisorId = supervisorId;
|
||||
this.supervisorName = supervisorName;
|
||||
this.shift = shift;
|
||||
this.recordTypeId = recordTypeId;
|
||||
this.reportData = reportData;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
package com.utopiaindustries.hseobservationsapp.utils.StorageManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class HseTrainingModel {
|
||||
|
||||
private int safetyTopicId;
|
||||
private String safetyTopicName;
|
||||
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 String description;
|
||||
private List<byte[]> pictures;
|
||||
|
||||
public int getSafetyTopicId() {
|
||||
return safetyTopicId;
|
||||
}
|
||||
|
||||
public void setSafetyTopicId(int safetyTopicId) {
|
||||
this.safetyTopicId = safetyTopicId;
|
||||
}
|
||||
|
||||
public int getEmployeeAttendance() {
|
||||
return employeeAttendance;
|
||||
}
|
||||
|
||||
public void setEmployeeAttendance(int employeeAttendance) {
|
||||
this.employeeAttendance = employeeAttendance;
|
||||
}
|
||||
|
||||
public int getTargetAudienceId() {
|
||||
return targetAudienceId;
|
||||
}
|
||||
|
||||
public void setTargetAudienceId(int targetAudienceId) {
|
||||
this.targetAudienceId = targetAudienceId;
|
||||
}
|
||||
|
||||
public double getTrainingMinutes() {
|
||||
return trainingMinutes;
|
||||
}
|
||||
|
||||
public void setTrainingMinutes(double trainingMinutes) {
|
||||
this.trainingMinutes = trainingMinutes;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public List<byte[]> getPictures() {
|
||||
return pictures;
|
||||
}
|
||||
|
||||
public void setPictures(List<byte[]> pictures) {
|
||||
this.pictures = pictures;
|
||||
}
|
||||
|
||||
public String getSafetyTopicName() {
|
||||
return safetyTopicName;
|
||||
}
|
||||
|
||||
public void setSafetyTopicName(String 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,6 +10,12 @@ public class ObservationModel {
|
|||
private int observationSubClassId;
|
||||
private String hseObservationSubClassName;
|
||||
|
||||
private int buildingId;
|
||||
private String buildingName;
|
||||
|
||||
private int floorId;
|
||||
private String floorName;
|
||||
|
||||
private int departmentId;
|
||||
private String departmentName;
|
||||
|
||||
|
@ -52,6 +58,38 @@ public class ObservationModel {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -4,11 +4,16 @@ import java.util.List;
|
|||
|
||||
public class PermitToWorkModel {
|
||||
|
||||
private int departmentId;
|
||||
private String departmentName;
|
||||
private int locationId;
|
||||
private String locationName;
|
||||
private int subLocationId;
|
||||
private int typeId;
|
||||
private int subTypeId;
|
||||
private String subLocationName;
|
||||
private String typeId;
|
||||
private String typeName;
|
||||
private int workingTeamId;
|
||||
private String workingTeamName;
|
||||
private String workingPartyType;
|
||||
|
||||
private String description;
|
||||
|
@ -31,22 +36,14 @@ public class PermitToWorkModel {
|
|||
this.subLocationId = subLocationId;
|
||||
}
|
||||
|
||||
public int getTypeId() {
|
||||
public String getTypeId() {
|
||||
return typeId;
|
||||
}
|
||||
|
||||
public void setTypeId(int typeId) {
|
||||
public void setTypeId(String typeId) {
|
||||
this.typeId = typeId;
|
||||
}
|
||||
|
||||
public int getSubTypeId() {
|
||||
return subTypeId;
|
||||
}
|
||||
|
||||
public void setSubTypeId(int subTypeId) {
|
||||
this.subTypeId = subTypeId;
|
||||
}
|
||||
|
||||
public int getWorkingTeamId() {
|
||||
return workingTeamId;
|
||||
}
|
||||
|
@ -78,4 +75,52 @@ public class PermitToWorkModel {
|
|||
public void setPictures(List<byte[]> 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() {
|
||||
return typeName;
|
||||
}
|
||||
|
||||
public void setTypeName(String typeName) {
|
||||
this.typeName = typeName;
|
||||
}
|
||||
|
||||
public String getWorkingTeamName() {
|
||||
return workingTeamName;
|
||||
}
|
||||
|
||||
public void setWorkingTeamName(String workingTeamName) {
|
||||
this.workingTeamName = workingTeamName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ public class StorageManager {
|
|||
private List<ReportActivityModel> reportActivityModel;
|
||||
private List<ReportActivityModel> progressiveActivityModel;
|
||||
private List<PermitToWorkModel> permitToWorkModel;
|
||||
private List<HseTrainingModel> hseTrainingModel;
|
||||
|
||||
|
||||
private StorageManager() {
|
||||
|
@ -48,6 +49,9 @@ public class StorageManager {
|
|||
|
||||
permitToWorkModel = new ArrayList<>();
|
||||
permitToWorkModel.add(new PermitToWorkModel());
|
||||
|
||||
hseTrainingModel = new ArrayList<>();
|
||||
hseTrainingModel.add(new HseTrainingModel());
|
||||
}
|
||||
|
||||
public String getObservation_date() {
|
||||
|
@ -146,6 +150,14 @@ public class StorageManager {
|
|||
this.permitToWorkModel = permitToWorkModel;
|
||||
}
|
||||
|
||||
public List<HseTrainingModel> getHseTrainingModel() {
|
||||
return hseTrainingModel;
|
||||
}
|
||||
|
||||
public void setHseTrainingModel(List<HseTrainingModel> hseTrainingModel) {
|
||||
this.hseTrainingModel = hseTrainingModel;
|
||||
}
|
||||
|
||||
public void clearAllData() {
|
||||
|
||||
observation_date = null;
|
||||
|
@ -161,5 +173,6 @@ public class StorageManager {
|
|||
reportActivityModel.clear();
|
||||
progressiveActivityModel.clear();
|
||||
permitToWorkModel.clear();
|
||||
hseTrainingModel.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.utopiaindustries.hseobservationsapp.apiservice.ApiServiceFactory;
|
|||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseResponse;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseSaveResponse;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.HSERequestModel;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.HseReportRequest;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
|
@ -98,7 +99,7 @@ public class LoginViewModel extends ViewModel {
|
|||
});
|
||||
}
|
||||
|
||||
public void saveHSEData(HSERequestModel hseRequestModel) {
|
||||
public void saveHSEData(HseReportRequest hseRequestModel) {
|
||||
isLoading.setValue(true);
|
||||
apiService.saveHseReport(hseRequestModel).enqueue(new Callback<HseSaveResponse>() {
|
||||
@Override
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
android:background="@drawable/et_border"
|
||||
android:hint="No Of Employees"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="text"
|
||||
android:inputType="number"
|
||||
android:padding="13dp"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
@ -118,7 +118,7 @@
|
|||
android:layout_marginTop="10dp"
|
||||
android:gravity="left"
|
||||
android:padding="5dp"
|
||||
android:text="Target Audience *"
|
||||
android:text="Department *"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:textStyle="bold" />
|
||||
|
@ -143,57 +143,67 @@
|
|||
android:textSize="16sp" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<RelativeLayout
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
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" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ptw_heading"
|
||||
android:layout_width="wrap_content"
|
||||
<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:layout_alignParentStart="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="left"
|
||||
android:padding="5dp"
|
||||
android:text="Training Pictures "
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_upload"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_toEndOf="@+id/ptw_heading"
|
||||
android:src="@drawable/img_upload" />
|
||||
</RelativeLayout>
|
||||
android:inputType="none"
|
||||
android:textSize="16sp" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:textSize="@dimen/_10sdp"
|
||||
android:text="Upload up to 5 supported files: PDF or image. Max 10 MB per file."/>
|
||||
android:layout_marginTop="15dp"
|
||||
android:gravity="left"
|
||||
android:padding="5dp"
|
||||
android:text="Floor *"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/tPicturesRecyclerView"
|
||||
<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_margin="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:fadeScrollbars="false"
|
||||
android:orientation="horizontal"
|
||||
android:overScrollMode="always"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingEnd="2dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:background="@color/grey_200"
|
||||
android:scrollbars="horizontal" />
|
||||
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>
|
||||
|
||||
|
|
|
@ -68,16 +68,16 @@
|
|||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_no_of_employees"
|
||||
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="No Of Employees"
|
||||
android:hint="Training Session"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="text"
|
||||
android:inputType="numberDecimal"
|
||||
android:padding="13dp"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
@ -115,6 +115,57 @@
|
|||
android:textSize="@dimen/_12sdp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/heading_description"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ptw_heading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="left"
|
||||
android:padding="5dp"
|
||||
android:text="Training Pictures "
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_upload"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_toEndOf="@+id/ptw_heading"
|
||||
android:src="@drawable/img_upload" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:textSize="@dimen/_10sdp"
|
||||
android:text="Upload up to 5 supported files: PDF or image. Max 10 MB per file."/>
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/tPicturesRecyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:fadeScrollbars="false"
|
||||
android:orientation="horizontal"
|
||||
android:overScrollMode="always"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingEnd="2dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:scrollbars="horizontal" />
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
|
|
@ -185,7 +185,7 @@
|
|||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="left"
|
||||
android:hint="MM-dd-yyyy"
|
||||
android:hint="yyyy-MM-dd"
|
||||
android:padding="5dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_13sdp" />
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
android:id="@+id/observation_heading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="left"
|
||||
android:padding="5dp"
|
||||
android:text="Observation Class *"
|
||||
|
@ -92,7 +92,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/observation_input"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:gravity="left"
|
||||
android:padding="5dp"
|
||||
android:text="Observation Sub Class *"
|
||||
|
@ -121,6 +121,74 @@
|
|||
android:textSize="16sp" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/building_heading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/observation_sub_input"
|
||||
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_below="@+id/building_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
|
||||
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:id="@+id/floor_heading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/building_input"
|
||||
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_below="@+id/floor_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
|
||||
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>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<Button
|
||||
|
|
|
@ -62,7 +62,38 @@
|
|||
android:layout_marginTop="15dp"
|
||||
android:gravity="left"
|
||||
android:padding="5dp"
|
||||
android:text="Location *"
|
||||
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" />
|
||||
|
@ -93,7 +124,7 @@
|
|||
android:layout_marginTop="15dp"
|
||||
android:gravity="left"
|
||||
android:padding="5dp"
|
||||
android:text="Sub Location *"
|
||||
android:text="Floor *"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_13sdp"
|
||||
android:textStyle="bold" />
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
android:background="@color/theme_color"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:theme="?attr/actionBarTheme"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
|
@ -25,10 +25,10 @@
|
|||
android:text="Permit To Work Second"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_15sdp"
|
||||
app:layout_constraintTop_toTopOf="@+id/toolbar"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/toolbar"
|
||||
app:layout_constraintEnd_toEndOf="@+id/toolbar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/toolbar" />
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_back"
|
||||
|
@ -36,20 +36,22 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:padding="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/toolbar"
|
||||
app:layout_constraintStart_toStartOf="@+id/toolbar"
|
||||
app:layout_constraintTop_toTopOf="@+id/toolbar"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/toolbar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:srcCompat="@drawable/arrow_back" />
|
||||
|
||||
<ScrollView
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/scrollView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:fillViewport="true"
|
||||
android:descendantFocusability="beforeDescendants"
|
||||
android:focusableInTouchMode="true"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toolbar"
|
||||
app:layout_constraintBottom_toTopOf="@+id/btn_submit"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toolbar">
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -71,7 +73,7 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
|
@ -86,7 +88,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Contractor" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
|
@ -116,15 +117,12 @@
|
|||
android:src="@drawable/img_upload" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/ptwRecyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:fadeScrollbars="false"
|
||||
android:isScrollContainer="false"
|
||||
android:orientation="horizontal"
|
||||
android:overScrollMode="always"
|
||||
android:paddingStart="2dp"
|
||||
|
@ -143,9 +141,7 @@
|
|||
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" />
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_description"
|
||||
|
@ -164,13 +160,9 @@
|
|||
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"/>
|
||||
|
||||
android:textSize="@dimen/_12sdp" />
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_submit"
|
||||
|
@ -181,5 +173,6 @@
|
|||
android:text="Submit"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:layout_editor_absoluteX="5dp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
<string name="select_observation_class">Select Observation Class</string>
|
||||
<string name="select_observation_sub_class">Select Observation Sub Class</string>
|
||||
|
||||
<string name="select_building">Select Building</string>
|
||||
<string name="select_floors">Select Floor</string>
|
||||
|
||||
<string name="select_department">Select Department</string>
|
||||
|
||||
<string name="select_risk">Select Risk Level</string>
|
||||
|
|
Loading…
Reference in New Issue