Feedback implemented

master
saad.siddiq 2024-12-07 11:23:47 +05:00
parent 3becd62c12
commit f986f0a821
11 changed files with 425 additions and 90 deletions

View File

@ -486,7 +486,7 @@ public class CheckingFragment extends Fragment implements EasyPermissions.Permis
selectedPosition = position;
// Show dialog to choose between camera and gallery
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
/*AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
builder.setTitle("Select Image")
.setItems(new String[]{"Camera", "Gallery"}, (dialog, which) -> {
if (which == 0) { // Camera
@ -495,7 +495,8 @@ public class CheckingFragment extends Fragment implements EasyPermissions.Permis
openGallery();
}
})
.show();
.show();*/
showImageDialog();
}
@Override
@ -507,6 +508,30 @@ public class CheckingFragment extends Fragment implements EasyPermissions.Permis
itemModelList.get(deletePosition).setImageUri(null);
adapter.notifyItemChanged(deletePosition);
}
}
public void showImageDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
LayoutInflater inflater = requireActivity().getLayoutInflater();
View dialogView = inflater.inflate(R.layout.dialog_select_image, null);
builder.setView(dialogView);
AlertDialog dialog = builder.create();
dialog.show();
// Handle button clicks
Button btnCamera = dialogView.findViewById(R.id.btnCamera);
Button btnGallery = dialogView.findViewById(R.id.btnGallery);
btnCamera.setOnClickListener(v -> {
openCamera();
dialog.dismiss();
});
btnGallery.setOnClickListener(v -> {
openGallery();
dialog.dismiss();
});
}
}

View File

@ -547,7 +547,7 @@ public class CuttingFragment extends Fragment implements EasyPermissions.Permiss
selectedPosition = position;
// Show dialog to choose between camera and gallery
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
/*AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
builder.setTitle("Select Image")
.setItems(new String[]{"Camera", "Gallery"}, (dialog, which) -> {
if (which == 0) {
@ -556,7 +556,9 @@ public class CuttingFragment extends Fragment implements EasyPermissions.Permiss
openGallery();
}
})
.show();
.show();*/
showImageDialog();
}
@ -608,4 +610,29 @@ public class CuttingFragment extends Fragment implements EasyPermissions.Permiss
return returnValue;
}
public void showImageDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
LayoutInflater inflater = requireActivity().getLayoutInflater();
View dialogView = inflater.inflate(R.layout.dialog_select_image, null);
builder.setView(dialogView);
AlertDialog dialog = builder.create();
dialog.show();
// Handle button clicks
Button btnCamera = dialogView.findViewById(R.id.btnCamera);
Button btnGallery = dialogView.findViewById(R.id.btnGallery);
btnCamera.setOnClickListener(v -> {
openCamera();
dialog.dismiss();
});
btnGallery.setOnClickListener(v -> {
openGallery();
dialog.dismiss();
});
}
}

View File

@ -487,7 +487,7 @@ public class PackingFragment extends Fragment implements EasyPermissions.Permiss
selectedPosition = position;
// Show dialog to choose between camera and gallery
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
/*AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
builder.setTitle("Select Image")
.setItems(new String[]{"Camera", "Gallery"}, (dialog, which) -> {
if (which == 0) { // Camera
@ -496,7 +496,8 @@ public class PackingFragment extends Fragment implements EasyPermissions.Permiss
openGallery();
}
})
.show();
.show();*/
showImageDialog();
}
@Override
@ -508,6 +509,30 @@ public class PackingFragment extends Fragment implements EasyPermissions.Permiss
itemModelList.get(deletePosition).setImageUri(null);
adapter.notifyItemChanged(deletePosition);
}
}
public void showImageDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
LayoutInflater inflater = requireActivity().getLayoutInflater();
View dialogView = inflater.inflate(R.layout.dialog_select_image, null);
builder.setView(dialogView);
AlertDialog dialog = builder.create();
dialog.show();
// Handle button clicks
Button btnCamera = dialogView.findViewById(R.id.btnCamera);
Button btnGallery = dialogView.findViewById(R.id.btnGallery);
btnCamera.setOnClickListener(v -> {
openCamera();
dialog.dismiss();
});
btnGallery.setOnClickListener(v -> {
openGallery();
dialog.dismiss();
});
}
}

View File

@ -489,7 +489,7 @@ public class StitchingFragment extends Fragment implements EasyPermissions.Permi
selectedPosition = position;
// Show dialog to choose between camera and gallery
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
/* AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
builder.setTitle("Select Image")
.setItems(new String[]{"Camera", "Gallery"}, (dialog, which) -> {
if (which == 0) { // Camera
@ -498,7 +498,8 @@ public class StitchingFragment extends Fragment implements EasyPermissions.Permi
openGallery();
}
})
.show();
.show();*/
showImageDialog();
}
@Override
@ -510,6 +511,30 @@ public class StitchingFragment extends Fragment implements EasyPermissions.Permi
itemModelList.get(deletePosition).setImageUri(null);
adapter.notifyItemChanged(deletePosition);
}
}
public void showImageDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
LayoutInflater inflater = requireActivity().getLayoutInflater();
View dialogView = inflater.inflate(R.layout.dialog_select_image, null);
builder.setView(dialogView);
AlertDialog dialog = builder.create();
dialog.show();
// Handle button clicks
Button btnCamera = dialogView.findViewById(R.id.btnCamera);
Button btnGallery = dialogView.findViewById(R.id.btnGallery);
btnCamera.setOnClickListener(v -> {
openCamera();
dialog.dismiss();
});
btnGallery.setOnClickListener(v -> {
openGallery();
dialog.dismiss();
});
}
}

View File

@ -217,83 +217,18 @@ public class SubStoreFragment extends Fragment implements EasyPermissions.Permis
});
nextButton.setOnClickListener(v -> {
/*Intent intent = new Intent(getActivity(), SummaryActivity.class);
startActivity(intent);
getActivity().finish();*/
/*Log.e("AdapterData", "siteID: " + siteID +
", unitId: " + unitId +
", departId: " + departId +
", floorId: " + floorId );
Log.e("------------------","------------");*/
/*for (ItemModel item : tempList) {
Log.e("AdapterData", "ProcessId: " + item.getProcessId() +
", StepId: " + item.getStepId() +
", SpinnerSelection: " + item.getSelectedOption() +
", Rating: " + item.getRating() +
", Percentage: " + item.getPercentage() +
", Remarks: " + item.getRemarks() +
", ImageList: " + item.getImageArrayList() +
", Image: " + Arrays.toString(item.getImageUri()));
}*/
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
/*AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
builder.setTitle("Are you sure to save Report?")
.setItems(new String[]{"Yes", "Cancel"}, (dialog, which) -> {
if (which == 0) {
List<ItemModel> updatedItemList = itemModelList; // Or adapter.getItemList()
/*for (ItemModel item : updatedItemList) {
Log.e("AdapterData", "ProcessId: " + item.getProcessId() +
", StepId: " + item.getStepId() +
", SpinnerSelection: " + item.getSelectedOption() +
", Rating: " + item.getRating() +
", Percentage: " + item.getPercentage() +
", Remarks: " + item.getRemarks() +
", ImageList: " + item.getImageArrayList());
}*/
Helper.saveArrayList(itemModelList, Helper.listSubStore, getActivity());
//viewModel.appendToQualityControlItemList(itemModelList);
int siteID = Integer.parseInt(Preference.getMyStringPref(Helper.project_file, Helper.locationSiteId, getActivity()));
int unitId = Integer.parseInt(Preference.getMyStringPref(Helper.project_file, Helper.unitId, getActivity()));
int departId = Integer.parseInt(Preference.getMyStringPref(Helper.project_file, Helper.departmentId, getActivity()));
int floorId = Integer.parseInt(Preference.getMyStringPref(Helper.project_file, Helper.floorId, getActivity()));
List<ItemModel> tempList = new ArrayList<>();
tempList.addAll(Helper.getArrayList(Helper.listCutting, getActivity()));
tempList.addAll(Helper.getArrayList(Helper.listStitching, getActivity()));
tempList.addAll(Helper.getArrayList(Helper.listChecking, getActivity()));
tempList.addAll(Helper.getArrayList(Helper.listPacking, getActivity()));
tempList.addAll(Helper.getArrayList(Helper.listSubStore, getActivity()));
String generatedBy = Preference.getMyStringPref(Helper.project_file, Helper.logInUser, getActivity());
/*Log.e("AdapterData-1", "siteID: " + siteID +
", unitId: " + unitId +
", departId: " + departId +
", floorId: " + floorId);*/
QualityControl qualityControl = new QualityControl(generatedBy, siteID, unitId, departId, floorId, tempList);
/*Log.e("---------------","-----------------");
Log.e("AdapterData-2", "Generated-By: " + qualityControl.getGeneratedBy() +
", siteID: " + qualityControl.getSiteId() +
", unitId: " + qualityControl.getUnitId() +
", departId: " + qualityControl.getDepartmentId() +
", floorId: " + qualityControl.getFloorId());*/
homeViewModel.saveQualityControlData(qualityControl);
} else {
dialog.dismiss();
}
})
.show();
.show();*/
showSubmitDialog();
});
@ -590,7 +525,7 @@ public class SubStoreFragment extends Fragment implements EasyPermissions.Permis
selectedPosition = position;
// Show dialog to choose between camera and gallery
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
/*AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
builder.setTitle("Select Image")
.setItems(new String[]{"Camera", "Gallery"}, (dialog, which) -> {
if (which == 0) { // Camera
@ -599,7 +534,10 @@ public class SubStoreFragment extends Fragment implements EasyPermissions.Permis
openGallery();
}
})
.show();
.show();*/
showImageDialog();
}
@Override
@ -626,4 +564,99 @@ public class SubStoreFragment extends Fragment implements EasyPermissions.Permis
progressDialog.dismiss();
}
}
public void showImageDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
LayoutInflater inflater = requireActivity().getLayoutInflater();
View dialogView = inflater.inflate(R.layout.dialog_select_image, null);
builder.setView(dialogView);
AlertDialog dialog = builder.create();
dialog.show();
// Handle button clicks
Button btnCamera = dialogView.findViewById(R.id.btnCamera);
Button btnGallery = dialogView.findViewById(R.id.btnGallery);
btnCamera.setOnClickListener(v -> {
openCamera();
dialog.dismiss();
});
btnGallery.setOnClickListener(v -> {
openGallery();
dialog.dismiss();
});
}
//dialog save report
public void showSubmitDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
LayoutInflater inflater = requireActivity().getLayoutInflater();
View dialogView = inflater.inflate(R.layout.custom_layout_for_submit, null);
builder.setView(dialogView);
AlertDialog dialog = builder.create();
dialog.show();
// Handle button clicks
Button btnNo = dialogView.findViewById(R.id.btnNo);
Button btnYes = dialogView.findViewById(R.id.btnYes);
btnNo.setOnClickListener(v -> {
dialog.dismiss();
});
btnYes.setOnClickListener(v -> {
List<ItemModel> updatedItemList = itemModelList; // Or adapter.getItemList()
/*for (ItemModel item : updatedItemList) {
Log.e("AdapterData", "ProcessId: " + item.getProcessId() +
", StepId: " + item.getStepId() +
", SpinnerSelection: " + item.getSelectedOption() +
", Rating: " + item.getRating() +
", Percentage: " + item.getPercentage() +
", Remarks: " + item.getRemarks() +
", ImageList: " + item.getImageArrayList());
}*/
Helper.saveArrayList(itemModelList, Helper.listSubStore, getActivity());
//viewModel.appendToQualityControlItemList(itemModelList);
int siteID = Integer.parseInt(Preference.getMyStringPref(Helper.project_file, Helper.locationSiteId, getActivity()));
int unitId = Integer.parseInt(Preference.getMyStringPref(Helper.project_file, Helper.unitId, getActivity()));
int departId = Integer.parseInt(Preference.getMyStringPref(Helper.project_file, Helper.departmentId, getActivity()));
int floorId = Integer.parseInt(Preference.getMyStringPref(Helper.project_file, Helper.floorId, getActivity()));
List<ItemModel> tempList = new ArrayList<>();
tempList.addAll(Helper.getArrayList(Helper.listCutting, getActivity()));
tempList.addAll(Helper.getArrayList(Helper.listStitching, getActivity()));
tempList.addAll(Helper.getArrayList(Helper.listChecking, getActivity()));
tempList.addAll(Helper.getArrayList(Helper.listPacking, getActivity()));
tempList.addAll(Helper.getArrayList(Helper.listSubStore, getActivity()));
String generatedBy = Preference.getMyStringPref(Helper.project_file, Helper.logInUser, getActivity());
/*Log.e("AdapterData-1", "siteID: " + siteID +
", unitId: " + unitId +
", departId: " + departId +
", floorId: " + floorId);*/
QualityControl qualityControl = new QualityControl(generatedBy, siteID, unitId, departId, floorId, tempList);
/*Log.e("---------------","-----------------");
Log.e("AdapterData-2", "Generated-By: " + qualityControl.getGeneratedBy() +
", siteID: " + qualityControl.getSiteId() +
", unitId: " + qualityControl.getUnitId() +
", departId: " + qualityControl.getDepartmentId() +
", floorId: " + qualityControl.getFloorId());*/
homeViewModel.saveQualityControlData(qualityControl);
dialog.dismiss();
});
}
}

View File

@ -0,0 +1,9 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="8dp" />
<solid android:color="@color/theme_color" />
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
</shape>

View File

@ -3,7 +3,7 @@
<solid android:color="@color/white" />
<stroke
android:width="2dp"
android:color="@color/white" />
android:color="@color/grey_400" />
<corners android:radius="10dp" />
<padding
android:bottom="0dp"

View File

@ -8,11 +8,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/rounded_white"
android:orientation="vertical"
android:paddingTop="15dp">
android:padding="15dp">
<TextView
android:id="@+id/message"
@ -27,14 +27,14 @@
android:text="Are you sure you want to sign out?"
android:textAllCaps="false"
android:textColor="@color/black"
android:textSize="15sp"
android:textSize="@dimen/_15sdp"
android:textStyle="normal" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginTop="7dp"
android:background="@color/grey_400" />
android:background="@color/white" />
<LinearLayout
android:layout_width="match_parent"
@ -50,17 +50,18 @@
android:gravity="center"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:background="@drawable/custom_button"
android:text="No"
android:textAllCaps="false"
android:textColor="@color/theme_color"
android:textSize="16sp"
android:textColor="@color/white"
android:textSize="@dimen/_14sdp"
android:textStyle="normal" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.009"
android:background="@color/grey_400"
android:layout_weight="0.05"
android:background="@color/white"
android:paddingTop="15dp"
android:paddingBottom="15dp" />
@ -74,8 +75,9 @@
android:paddingBottom="15dp"
android:text="Yes"
android:textAllCaps="false"
android:textColor="@color/theme_color"
android:textSize="16sp"
android:background="@drawable/custom_button"
android:textColor="@color/white"
android:textSize="@dimen/_14sdp"
android:textStyle="normal" />
</LinearLayout>

View File

@ -0,0 +1,54 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:layout_margin="2dp"
android:padding="20dp">
<TextView
android:id="@+id/dialogTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Are you sure to save Report?"
android:textSize="@dimen/_15sdp"
android:gravity="center"
android:textColor="@color/black"
android:padding="10dp"
android:layout_margin="5dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_margin="2dp"
style="?android:attr/buttonBarButtonStyle"
android:weightSum="3">
<Button
android:id="@+id/btnNo"
android:layout_width="0dp"
android:layout_weight="1.5"
android:layout_height="wrap_content"
android:text="No"
android:background="@drawable/custom_button"
android:textColor="@android:color/white"
android:padding="12dp"
android:layout_marginRight="5dp"
android:textSize="@dimen/_13sdp" />
<Button
android:id="@+id/btnYes"
android:layout_width="0dp"
android:layout_weight="1.5"
android:layout_height="wrap_content"
android:text="Yes"
android:textSize="@dimen/_13sdp"
android:background="@drawable/custom_button"
android:textColor="@android:color/white"
android:padding="12dp" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,54 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:layout_margin="2dp"
android:padding="20dp">
<TextView
android:id="@+id/dialogTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Select Image"
android:textSize="@dimen/_15sdp"
android:gravity="center"
android:textColor="@color/black"
android:padding="10dp"
android:layout_margin="5dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_margin="2dp"
style="?android:attr/buttonBarButtonStyle"
android:weightSum="3">
<Button
android:id="@+id/btnCamera"
android:layout_width="0dp"
android:layout_weight="1.5"
android:layout_height="wrap_content"
android:text="Camera"
android:background="@drawable/custom_button"
android:textColor="@android:color/white"
android:padding="12dp"
android:layout_marginRight="5dp"
android:textSize="@dimen/_13sdp" />
<Button
android:id="@+id/btnGallery"
android:layout_width="0dp"
android:layout_weight="1.5"
android:layout_height="wrap_content"
android:text="Gallery"
android:textSize="@dimen/_13sdp"
android:background="@drawable/custom_button"
android:textColor="@android:color/white"
android:padding="12dp" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/rounded_white"
android:orientation="vertical"
android:padding="15dp">
<TextView
android:id="@+id/message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:gravity="center_horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="Select Image From"
android:textAllCaps="false"
android:textColor="@color/theme_color"
android:textSize="@dimen/_15sdp"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginTop="7dp"
android:background="@color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<Button
android:id="@+id/btnCamera"
android:layout_width="0dp"
android:layout_weight="1.495"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="@drawable/custom_button"
android:padding="12dp"
android:text="Camera"
android:textColor="@android:color/white"
android:textSize="@dimen/_13sdp" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.05"
android:background="@color/white"
android:paddingTop="15dp"
android:paddingBottom="15dp" />
<Button
android:id="@+id/btnGallery"
android:layout_width="0dp"
android:layout_weight="1.495"
android:layout_height="wrap_content"
android:background="@drawable/custom_button"
android:padding="12dp"
android:text="Gallery"
android:textColor="@android:color/white"
android:textSize="@dimen/_13sdp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>