Feedback:

1- Draft Report Presented carton correction
2- Section correction
3- Add Hand Feel Not OK fields
main
saad.siddiq 2025-04-19 12:39:05 +05:00
parent 938794cb7d
commit 53f3380d93
5 changed files with 331 additions and 179 deletions

View File

@ -45,6 +45,8 @@ public class InspectionReportItem implements Serializable {
private double minorQualityLevel; private double minorQualityLevel;
private double majorQualityLevel; private double majorQualityLevel;
private long handFeelNotOkay;
private int levelMajorDefects; private int levelMajorDefects;
private int levelMinorDefects; private int levelMinorDefects;
@ -65,6 +67,7 @@ public class InspectionReportItem implements Serializable {
private String fnsku; private String fnsku;
private String section; private String section;
private String sectionForDraft;
public long getId() { public long getId() {
return id; return id;
@ -266,6 +269,14 @@ public class InspectionReportItem implements Serializable {
this.sampleSize = sampleSize; this.sampleSize = sampleSize;
} }
public long getHandFeelNotOkay() {
return handFeelNotOkay;
}
public void setHandFeelNotOkay(long handFeelNotOkay) {
this.handFeelNotOkay = handFeelNotOkay;
}
public String getDateAdded() { public String getDateAdded() {
return dateAdded; return dateAdded;
} }
@ -426,6 +437,14 @@ public void setLevelMinorDefects(int levelMinorDefects) {
this.section = section; this.section = section;
} }
public String getSectionForDraft() {
return sectionForDraft;
}
public void setSectionForDraft(String sectionForDraft) {
this.sectionForDraft = sectionForDraft;
}
public List<byte[]> getDimensionImages() { public List<byte[]> getDimensionImages() {
return dimensionImages; return dimensionImages;
} }

View File

@ -75,18 +75,16 @@ public class NetworkService extends Service {
private void pushDataToInternet() { private void pushDataToInternet() {
ReportRepository repository = new ReportRepository( this ); ReportRepository repository = new ReportRepository( this );
List<InspectionReportWrapper> reportWrappers = repository.findAllUnsynced(); List<InspectionReportWrapper> reportWrappers = repository.findAllUnsynced();
Log.e("ReportWrappers-Size: ",""+reportWrappers.size());
InspectionReportService service = InspectionReportService.getInstance(); InspectionReportService service = InspectionReportService.getInstance();
try { try {
List<InspectionReport> reports = getReports( reportWrappers ); List<InspectionReport> reports = getReports( reportWrappers );
Log.e("Reports.size(): ",""+reports.size());
int size = reports.size(); int size = reports.size();
if( size > 0 ){ if( size > 0 ){
NotificationHelper.showNotification( /*NotificationHelper.showNotification(
this, this,
"Uploading Reports", "Uploading Reports",
String.format(" %d report(s) uploading..", reports.size() ) String.format(" %d report(s) uploading..", reports.size() )
); );*/
for ( InspectionReport report : reports ){ for ( InspectionReport report : reports ){
service.saveReport(report, new SaveReportCallback() { service.saveReport(report, new SaveReportCallback() {
@Override @Override
@ -95,6 +93,10 @@ public class NetworkService extends Service {
repository.updateSyncStatus( report.getWrapperId() ); repository.updateSyncStatus( report.getWrapperId() );
// remove file // remove file
FileUtils.deleteFile( report.getFilePath() ); FileUtils.deleteFile( report.getFilePath() );
NotificationHelper.showNotification(
NetworkService.this,
"Report Status", "1 Report uploaded successfully");
} }
@Override @Override
public void onFailure(Throwable throwable) { public void onFailure(Throwable throwable) {
@ -102,11 +104,11 @@ public class NetworkService extends Service {
} }
}); });
} }
NotificationHelper.showNotification( /*NotificationHelper.showNotification(
this, this,
"Uploading Reports", "Uploading Reports",
String.format(" %d report(s) uploaded successfully..", reports.size() ) String.format(" %d report(s) uploaded successfully..", reports.size() )
); );*/
} }
} catch ( Exception e ) { } catch ( Exception e ) {
e.printStackTrace(); e.printStackTrace();

View File

@ -85,6 +85,7 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
private InspectionReportService inspectionReportService; private InspectionReportService inspectionReportService;
private EditText aqlSampleSize, cartonWeight, cartonLength, cartonWidth, cartonHeight; private EditText aqlSampleSize, cartonWeight, cartonLength, cartonWidth, cartonHeight;
private EditText packWeight, packLength, packWidth, packHeight; private EditText packWeight, packLength, packWidth, packHeight;
private EditText etHandFeelNotOk, etHandFeelOk, etHandFeelPercent;
TextView txtTesting; TextView txtTesting;
List<String> sizes = Collections.singletonList("[Size]"); List<String> sizes = Collections.singletonList("[Size]");
@ -120,6 +121,10 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
//System.out.println(inspectionReport); //System.out.println(inspectionReport);
store.setReport(inspectionReport); store.setReport(inspectionReport);
//System.out.println("Report-SKU: " + store.getReport().getItems().get(0).getFnsku()); //System.out.println("Report-SKU: " + store.getReport().getItems().get(0).getFnsku());
inspectionLevel = String.valueOf(store.getReport().getItems().get(0).getInspectionLevel());
qualityLevelMajor = String.valueOf(store.getReport().getItems().get(0).getMajorQualityLevel());
qualityLevelMinor = String.valueOf(store.getReport().getItems().get(0).getMinorQualityLevel());
} }
initializeViews(view); initializeViews(view);
@ -340,7 +345,7 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
}); });
//onTextChanges logic implementation //onTextChanges logic implementation
//box = 1, itemPerBox, pieces //box = 1, itemPerBox, pieces // Item Selected Details
boxCartonSelected.addTextChangedListener(new TextWatcher() { boxCartonSelected.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -351,7 +356,7 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
try { try {
int packsCount = 0, piecesCount = 0; int packsCount = 0, piecesCount = 0;
int boxCount = Integer.parseInt(s.toString()); int boxCount = (int) Double.parseDouble(s.toString());
if (itemPerBox.getText().toString().isEmpty() || pieces.getText().toString().isEmpty()) { if (itemPerBox.getText().toString().isEmpty() || pieces.getText().toString().isEmpty()) {
Toast.makeText(getContext(), "Enter Item/Pieces Per box", Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "Enter Item/Pieces Per box", Toast.LENGTH_SHORT).show();
} else { } else {
@ -360,17 +365,16 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
int totalPacks = boxCount * packsCount; int totalPacks = boxCount * packsCount;
int totalPieces = totalPacks * piecesCount; int totalPieces = totalPacks * piecesCount;
Log.e("totalPacks: ",""+totalPacks);
Log.e("totalPieces: ",""+totalPieces);
itemPerBoxSelected.setText(String.valueOf(totalPacks)); itemPerBoxSelected.setText(String.valueOf(totalPacks));
store.getReport().getItems().get(0).setPacksSelected(Long.parseLong(String.valueOf(totalPacks))); //store.getReport().getItems().get(0).setPacksSelected(Long.parseLong(String.valueOf(totalPacks)));
piecesSelected.setText(String.valueOf(totalPieces)); piecesSelected.setText(String.valueOf(totalPieces));
store.getReport().getItems().get(0).setPiecesSelected(Long.parseLong(String.valueOf(totalPieces))); //store.getReport().getItems().get(0).setPiecesSelected(Long.parseLong(String.valueOf(totalPieces)));
} }
store.getReport().getItems().get(0).setCartonsSelected(Long.parseLong(s.toString())); store.getReport().getItems().get(0).setCartonsSelected(Float.parseFloat(s.toString()));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
store.getReport().getItems().get(0).setCartonsSelected(0); store.getReport().getItems().get(0).setCartonsSelected(0);
} }
} }
@ -499,9 +503,9 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
try { try {
//calculate aql sample size //calculate aql sample size
//Log.e("ItemPresentedDetails-pieces: ", "" + s.toString()); Log.e("ItemPresentedDetails-pieces: ", "" + s.toString());
//Log.e("ItemPresentedDetails-inspectionLevel: ", "" + inspectionLevel); Log.e("ItemPresentedDetails-inspectionLevel: ", "" + inspectionLevel);
if (!s.toString().isEmpty()) { if (!s.toString().isEmpty() && s.toString() != null) {
trackSampleCode(Integer.parseInt(s.toString()), (int) Double.parseDouble(inspectionLevel), Double.parseDouble(qualityLevelMajor), Double.parseDouble(qualityLevelMinor)); trackSampleCode(Integer.parseInt(s.toString()), (int) Double.parseDouble(inspectionLevel), Double.parseDouble(qualityLevelMajor), Double.parseDouble(qualityLevelMinor));
} }
} }
@ -713,6 +717,33 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
} }
}); });
etHandFeelNotOk.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) {
try {
int sampleSize = Integer.parseInt(aqlSampleSize.getText().toString());
int handFeelNotOk = Integer.parseInt(s.toString());
int handFeelOk = sampleSize - handFeelNotOk;
etHandFeelOk.setText(String.valueOf(handFeelOk));
double percent = (double) handFeelNotOk / sampleSize * 100;
etHandFeelPercent.setText(String.format("%s%%", percent));
store.getReport().getItems().get(0).setHandFeelNotOkay(Long.parseLong(s.toString()));
} catch (Exception e) {
store.getReport().getItems().get(0).setHandFeelNotOkay(0);
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
// generalRemarks.addTextChangedListener(new TextWatcher() { // generalRemarks.addTextChangedListener(new TextWatcher() {
// @Override // @Override
@ -931,9 +962,11 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
boxCarton.setText(boxCartonText); boxCarton.setText(boxCartonText);
packagingDetails.setText(packagingDetailsText); packagingDetails.setText(packagingDetailsText);
Log.e("Carton: ",""+String.valueOf(store.getReport().getItems().get(0).getCartonsSelected()));
boxCartonSelected.setText(String.valueOf(store.getReport().getItems().get(0).getCartonsSelected())); boxCartonSelected.setText(String.valueOf(store.getReport().getItems().get(0).getCartonsSelected()));
itemPerBoxSelected.setText(String.valueOf(store.getReport().getItems().get(0).getPacksSelected())); //itemPerBoxSelected.setText(String.valueOf(store.getReport().getItems().get(0).getPacksSelected()));
piecesSelected.setText(String.valueOf(store.getReport().getItems().get(0).getPiecesSelected())); //piecesSelected.setText(String.valueOf(store.getReport().getItems().get(0).getPiecesSelected()));
checkedBoxCartonSelected.setText(String.valueOf(store.getReport().getItems().get(0).getCheckedCartonsSelected())); checkedBoxCartonSelected.setText(String.valueOf(store.getReport().getItems().get(0).getCheckedCartonsSelected()));
//checkedItemPerBoxSelected.setText(String.valueOf(store.getReport().getItems().get(0).getCheckedPacksSelected())); //checkedItemPerBoxSelected.setText(String.valueOf(store.getReport().getItems().get(0).getCheckedPacksSelected()));
@ -1080,6 +1113,9 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
boxCartonSelected = view.findViewById(R.id.box_carton_selected); boxCartonSelected = view.findViewById(R.id.box_carton_selected);
itemPerBoxSelected = view.findViewById(R.id.item_per_box_selected); itemPerBoxSelected = view.findViewById(R.id.item_per_box_selected);
piecesSelected = view.findViewById(R.id.pieces_selected); piecesSelected = view.findViewById(R.id.pieces_selected);
etHandFeelNotOk = view.findViewById(R.id.et_hand_feel_not_ok);
etHandFeelOk = view.findViewById(R.id.et_hand_feel_ok);
etHandFeelPercent = view.findViewById(R.id.et_not_ok_percent);
txtTesting = view.findViewById(R.id.txtTesting); txtTesting = view.findViewById(R.id.txtTesting);

View File

@ -68,6 +68,7 @@ import com.utopiaindustries.qualitychecker.utils.ImageUriHolder;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@ -78,16 +79,16 @@ import retrofit2.Response;
public class ThirdStepFragment extends Fragment implements View.OnClickListener { public class ThirdStepFragment extends Fragment implements View.OnClickListener {
private NavController navController; private NavController navController;
private Button backBtn,nextBtn,openDimensionDialog, btnDraft; private Button backBtn, nextBtn, openDimensionDialog, btnDraft;
private ImageButton imagePicker, deleteImage ; private ImageButton imagePicker, deleteImage;
private TextView profileName; private TextView profileName;
private ImageView profileImage; private ImageView profileImage;
private InspectionReportService inspectionReportService; private InspectionReportService inspectionReportService;
private RecyclerView vocRecyclerView,itemDimensionsRecyclerView; private RecyclerView vocRecyclerView, itemDimensionsRecyclerView;
private Store store; private Store store;
private Spinner resultSpinner, sectionSpinner; private Spinner resultSpinner, sectionSpinner;
private ApiService apiService; private ApiService apiService;
private EditText generalRemarks, etQualityAuditor, etProdRepresentative, etQcRepresentative,etFloor; private EditText generalRemarks, etQualityAuditor, etProdRepresentative, etQcRepresentative, etFloor;
private static final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 100; private static final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 100;
private static final int MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 101; private static final int MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 101;
private static final int MY_PERMISSIONS_REQUEST_CAMERA = 102; private static final int MY_PERMISSIONS_REQUEST_CAMERA = 102;
@ -98,51 +99,48 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
private ImageAdapter imageAdapter; private ImageAdapter imageAdapter;
private RecyclerView imageRecyclerView; private RecyclerView imageRecyclerView;
private TextView minorCountTv,majorCountTv,criticalCountTv, txtMajor, txtMinor; private TextView minorCountTv, majorCountTv, criticalCountTv, txtMajor, txtMinor;
String[] sectionArray = {"Comforter & Mattress Pad",
"Bedding", ArrayList<String> sectionArrayList = new ArrayList<>();
"Blanket & Table Linen",
"Pillow",
"Terry Towel",
"Garments & Mattress Protector"};
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_third_step , container, false ); View view = inflater.inflate(R.layout.fragment_third_step, container, false);
inspectionReportService = InspectionReportService.getInstance(); inspectionReportService = InspectionReportService.getInstance();
store = Store.getInstance(); store = Store.getInstance();
apiService = ApiServiceFactory.getApiService(); apiService = ApiServiceFactory.getApiService();
initializeViews( view ); initializeViews(view);
checkPermissions(); checkPermissions();
populateViews(); populateViews();
setOnClickListeners(); setOnClickListeners();
updateProfileViews(); updateProfileViews();
vocRecyclerView.setLayoutManager( new LinearLayoutManager( getContext() ) ); vocRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
itemDimensionsRecyclerView.setLayoutManager( new LinearLayoutManager( getContext() ) ); itemDimensionsRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
String asin = store.getReport().getItems().get(0).getAsin(); String asin = store.getReport().getItems().get(0).getAsin();
apiService.fetchVocs( asin ).enqueue( apiService.fetchVocs(asin).enqueue(
new Callback<List<VoiceOfCustomer>>() { new Callback<List<VoiceOfCustomer>>() {
@Override @Override
public void onResponse(Call<List<VoiceOfCustomer>> call, public void onResponse(Call<List<VoiceOfCustomer>> call,
Response<List<VoiceOfCustomer>> response) { Response<List<VoiceOfCustomer>> response) {
if( response.isSuccessful() && response.body() != null ){ if (response.isSuccessful() && response.body() != null) {
VocAdapter adapter = new VocAdapter( response.body(), getContext() ); VocAdapter adapter = new VocAdapter(response.body(), getContext());
vocRecyclerView.setAdapter( adapter ); vocRecyclerView.setAdapter(adapter);
} }
} }
@Override @Override
public void onFailure(Call<List<VoiceOfCustomer>> call, Throwable t) { public void onFailure(Call<List<VoiceOfCustomer>> call, Throwable t) {
System.out.println( t.getMessage() ); System.out.println(t.getMessage());
} }
} }
); );
ItemDimensionAdapter adapter = new ItemDimensionAdapter( store.getReport().getItems().get(0).getDimensions() ); ItemDimensionAdapter adapter = new ItemDimensionAdapter(store.getReport().getItems().get(0).getDimensions());
itemDimensionsRecyclerView.setAdapter( adapter ); itemDimensionsRecyclerView.setAdapter(adapter);
etQcRepresentative.addTextChangedListener(new TextWatcher() { etQcRepresentative.addTextChangedListener(new TextWatcher() {
@Override @Override
@ -153,9 +151,9 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
try { try {
store.getReport().setQcRepresentative( s.toString() ); store.getReport().setQcRepresentative(s.toString());
} catch ( Exception e ){ } catch (Exception e) {
store.getReport().setQcRepresentative( ""); store.getReport().setQcRepresentative("");
} }
} }
@ -174,9 +172,9 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
try { try {
store.getReport().setFloor( s.toString() ); store.getReport().setFloor(s.toString());
} catch ( Exception e ){ } catch (Exception e) {
store.getReport().setFloor( ""); store.getReport().setFloor("");
} }
} }
@ -195,9 +193,9 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
try { try {
store.getReport().setProductionRepresentative( s.toString() ); store.getReport().setProductionRepresentative(s.toString());
} catch ( Exception e ){ } catch (Exception e) {
store.getReport().setProductionRepresentative( ""); store.getReport().setProductionRepresentative("");
} }
} }
@ -216,9 +214,9 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
try { try {
store.getReport().setQualityAuditor( s.toString() ); store.getReport().setQualityAuditor(s.toString());
} catch ( Exception e ){ } catch (Exception e) {
store.getReport().setQualityAuditor( ""); store.getReport().setQualityAuditor("");
} }
} }
@ -237,9 +235,9 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
try { try {
store.getReport().setGeneralRemarks( s.toString() ); store.getReport().setGeneralRemarks(s.toString());
} catch ( Exception e ){ } catch (Exception e) {
store.getReport().setGeneralRemarks( ""); store.getReport().setGeneralRemarks("");
} }
} }
@ -249,7 +247,7 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
} }
}); });
imagePicker.setOnClickListener( new View.OnClickListener() { imagePicker.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -260,15 +258,15 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
builder.setItems(options, (dialog, which) -> { builder.setItems(options, (dialog, which) -> {
switch (which) { switch (which) {
case 0: case 0:
Log.e("Gallery","**********"); Log.e("Gallery", "**********");
Intent intent = new Intent( Intent.ACTION_GET_CONTENT ); Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory( Intent.CATEGORY_OPENABLE ); intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType( "image/*" ); intent.setType("image/*");
//startActivityForResult( intent, GALLERY_REQUEST ); //startActivityForResult( intent, GALLERY_REQUEST );
( ( Activity ) getContext() ).startActivityForResult( intent, GALLERY_REQUEST ); ((Activity) getContext()).startActivityForResult(intent, GALLERY_REQUEST);
break; break;
case 1: case 1:
Log.e("Camera: ","***********"); Log.e("Camera: ", "***********");
Intent camera_intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); Intent camera_intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File imageFile = new File(getContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES), "captured_image.jpg"); File imageFile = new File(getContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES), "captured_image.jpg");
Uri imageUri = FileProvider.getUriForFile(getContext(), getContext().getPackageName() + ".fileprovider", imageFile); Uri imageUri = FileProvider.getUriForFile(getContext(), getContext().getPackageName() + ".fileprovider", imageFile);
@ -276,7 +274,7 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
ImageUriHolder.getInstance().setImageUri(imageUri); ImageUriHolder.getInstance().setImageUri(imageUri);
camera_intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); camera_intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
//startActivityForResult(camera_intent, CAMERA_REQUEST); //startActivityForResult(camera_intent, CAMERA_REQUEST);
( ( Activity ) getContext() ).startActivityForResult( camera_intent, CAMERA_REQUEST ); ((Activity) getContext()).startActivityForResult(camera_intent, CAMERA_REQUEST);
break; break;
} }
}); });
@ -289,15 +287,14 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
} }
}); });
deleteImage.setOnClickListener( new View.OnClickListener() { deleteImage.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (!store.getReport().getItems().get(0).getDimensionImages().isEmpty()) { if (!store.getReport().getItems().get(0).getDimensionImages().isEmpty()) {
store.getReport().getItems().get(0).getDimensionImages().remove(store.getReport().getItems().get(0).getDimensionImages().size() - 1); store.getReport().getItems().get(0).getDimensionImages().remove(store.getReport().getItems().get(0).getDimensionImages().size() - 1);
updateImageAdapter(store.getReport().getItems().get(0).getDimensionImages()); updateImageAdapter(store.getReport().getItems().get(0).getDimensionImages());
} } else {
else {
System.out.println("The list is empty"); System.out.println("The list is empty");
} }
} }
@ -310,8 +307,7 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
if (requestCode == CAMERA_REQUEST) { if (requestCode == CAMERA_REQUEST) {
Uri selectedImageUri = ImageUriHolder.getInstance().getImageUri(); Uri selectedImageUri = ImageUriHolder.getInstance().getImageUri();
saveImage(selectedImageUri); saveImage(selectedImageUri);
} } else if (requestCode == GALLERY_REQUEST) {
else if (requestCode == GALLERY_REQUEST) {
Uri selectedImageUri = data.getData(); Uri selectedImageUri = data.getData();
assert selectedImageUri != null; assert selectedImageUri != null;
saveImage(selectedImageUri); saveImage(selectedImageUri);
@ -354,14 +350,14 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
@Override @Override
public void onClick(View v) { public void onClick(View v) {
navController = Navigation.findNavController( requireView() ); navController = Navigation.findNavController(requireView());
if( v.getId() == R.id.button_left_frag_3 ){ if (v.getId() == R.id.button_left_frag_3) {
navController.navigate( R.id.action_thirdStepFragment_to_secondStepFragment ); navController.navigate(R.id.action_thirdStepFragment_to_secondStepFragment);
} }
if (v.getId() == R.id.button_draft_third) { if (v.getId() == R.id.button_draft_third) {
//-- //--
if (store.getReport() != null) { if (store.getReport() != null) {
inspectionReportService.saveDraftInLocalDb( getContext(), store.getReport(), new SaveDraftReportCallback() { inspectionReportService.saveDraftInLocalDb(getContext(), store.getReport(), new SaveDraftReportCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
Handler handler = new Handler(Looper.getMainLooper()); Handler handler = new Handler(Looper.getMainLooper());
@ -397,35 +393,35 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
//--- //---
} }
if( v.getId() == R.id.button_right_frag_3 ){ if (v.getId() == R.id.button_right_frag_3) {
saveReportDialog(); saveReportDialog();
} }
if( v.getId() == R.id.button_open_dimension ){ if (v.getId() == R.id.button_open_dimension) {
openDimensionDialog(); openDimensionDialog();
} }
} }
private void saveReportDialog(){ private void saveReportDialog() {
LayoutInflater inflater = LayoutInflater.from( getContext() ); LayoutInflater inflater = LayoutInflater.from(getContext());
View dialogView = inflater.inflate( R.layout.save_report_dialog, null); View dialogView = inflater.inflate(R.layout.save_report_dialog, null);
// progress bar // progress bar
ProgressBar progressBar = dialogView.findViewById( R.id.save_report_progress ); ProgressBar progressBar = dialogView.findViewById(R.id.save_report_progress);
AlertDialog.Builder builder = new AlertDialog.Builder( Objects.requireNonNull(getContext()) ); AlertDialog.Builder builder = new AlertDialog.Builder(Objects.requireNonNull(getContext()));
builder.setView( dialogView ) builder.setView(dialogView)
.setTitle("So you want to save report?") .setTitle("So you want to save report?")
.setPositiveButton( "Save",(dialog, which) -> { .setPositiveButton("Save", (dialog, which) -> {
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
NotificationHelper.showNotification(Objects.requireNonNull(getContext()), NotificationHelper.showNotification(Objects.requireNonNull(getContext()),
"Utopia QA App", "Utopia QA App",
"Report is saving keep patience..."); "Report is saving keep patience...");
inspectionReportService.saveInLocalDb( getContext(), store.getReport(), new SaveReportCallback() { inspectionReportService.saveInLocalDb(getContext(), store.getReport(), new SaveReportCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
Handler handler = new Handler(Looper.getMainLooper()); Handler handler = new Handler(Looper.getMainLooper());
handler.post(() -> { handler.post(() -> {
Log.e("Report-ToString: ",""+store.getReport().toString()); Log.e("Report-ToString: ", "" + store.getReport().toString());
SharedPreferences sharedPreferences = getContext().getSharedPreferences("login_prefs", Context.MODE_PRIVATE); SharedPreferences sharedPreferences = getContext().getSharedPreferences("login_prefs", Context.MODE_PRIVATE);
long draftReportId = Long.parseLong(sharedPreferences.getString("draftReportId", null)); long draftReportId = Long.parseLong(sharedPreferences.getString("draftReportId", null));
@ -458,41 +454,41 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
}); });
// Show the dialog // Show the dialog
AlertDialog dialog = builder.create(); AlertDialog dialog = builder.create();
progressBar.setVisibility( View.GONE ); progressBar.setVisibility(View.GONE);
dialog.show(); dialog.show();
} }
private void openDimensionDialog() { private void openDimensionDialog() {
LayoutInflater inflater = LayoutInflater.from( getContext() ); LayoutInflater inflater = LayoutInflater.from(getContext());
View dialogView = inflater.inflate( R.layout.dimension_dialog, null); View dialogView = inflater.inflate(R.layout.dimension_dialog, null);
// recycler view // recycler view
RecyclerView dimensionRecyclerView = dialogView.findViewById( R.id.dimension_recycler_view ); RecyclerView dimensionRecyclerView = dialogView.findViewById(R.id.dimension_recycler_view);
LinearLayoutManager layoutManager = new LinearLayoutManager( getContext() ); LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
dimensionRecyclerView.setLayoutManager( layoutManager ); dimensionRecyclerView.setLayoutManager(layoutManager);
// set adapter // set adapter
DimensionAdapter dimensionAdapter = new DimensionAdapter( store.getDimensions(), DimensionAdapter dimensionAdapter = new DimensionAdapter(store.getDimensions(),
store.getDimensionList(), store.getDimensionList(),
store.getItemUnits() ); store.getItemUnits());
dimensionRecyclerView.setAdapter( dimensionAdapter ); dimensionRecyclerView.setAdapter(dimensionAdapter);
AlertDialog.Builder builder = new AlertDialog.Builder( Objects.requireNonNull( getContext() )); AlertDialog.Builder builder = new AlertDialog.Builder(Objects.requireNonNull(getContext()));
builder.setView(dialogView) builder.setView(dialogView)
.setTitle("Select Dimensions") .setTitle("Select Dimensions")
.setPositiveButton( "Save",(dialog, which) -> { .setPositiveButton("Save", (dialog, which) -> {
calculateDimensions(); calculateDimensions();
dialog.dismiss(); dialog.dismiss();
} ) })
.setNegativeButton("Cancel", (dialog, which) -> { .setNegativeButton("Cancel", (dialog, which) -> {
// Handle Cancel button click // Handle Cancel button click
dialog.dismiss(); dialog.dismiss();
}); });
Button addItemBtn = dialogView.findViewById( R.id.add_dimension_item ); Button addItemBtn = dialogView.findViewById(R.id.add_dimension_item);
addItemBtn.setOnClickListener(v -> { addItemBtn.setOnClickListener(v -> {
int position = store.getDimensions().size(); int position = store.getDimensions().size();
store.getDimensions().add( new InspectionItemDimension() ); store.getDimensions().add(new InspectionItemDimension());
dimensionAdapter.notifyItemInserted( position ); dimensionAdapter.notifyItemInserted(position);
dimensionRecyclerView.smoothScrollToPosition( position ); dimensionRecyclerView.smoothScrollToPosition(position);
}); });
@ -500,35 +496,35 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
AlertDialog dialog = builder.create(); AlertDialog dialog = builder.create();
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(); WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
layoutParams.copyFrom( dialog.getWindow().getAttributes() ); layoutParams.copyFrom(dialog.getWindow().getAttributes());
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
dialog.getWindow().setAttributes(layoutParams); dialog.getWindow().setAttributes(layoutParams);
dialog.show(); dialog.show();
// After show, clear the flags and set the soft input mode // After show, clear the flags and set the soft input mode
Objects.requireNonNull(dialog.getWindow()).clearFlags( WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM ); Objects.requireNonNull(dialog.getWindow()).clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
dialog.getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE ); dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
} }
@SuppressLint("DefaultLocale") @SuppressLint("DefaultLocale")
private void populateViews(){ private void populateViews() {
generalRemarks.setText( store.getReport().getGeneralRemarks() ); generalRemarks.setText(store.getReport().getGeneralRemarks());
etQualityAuditor.setText(store.getReport().getQualityAuditor()); etQualityAuditor.setText(store.getReport().getQualityAuditor());
etProdRepresentative.setText(store.getReport().getProductionRepresentative()); etProdRepresentative.setText(store.getReport().getProductionRepresentative());
etQcRepresentative.setText(store.getReport().getQcRepresentative()); etQcRepresentative.setText(store.getReport().getQcRepresentative());
etFloor.setText(store.getReport().getFloor()); etFloor.setText(store.getReport().getFloor());
ArrayAdapter<String> adapter = new ArrayAdapter<>( getContext(), ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(),
android.R.layout.simple_spinner_item, android.R.layout.simple_spinner_item,
inspectionReportService.getReportResult() ); inspectionReportService.getReportResult());
resultSpinner.setAdapter( adapter ); resultSpinner.setAdapter(adapter);
resultSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { resultSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String result = parent.getItemAtPosition( position ).toString(); String result = parent.getItemAtPosition(position).toString();
store.getReport().setReportResult( result ); store.getReport().setReportResult(result);
} }
@Override @Override
@ -537,17 +533,18 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
} }
}); });
ArrayAdapter<String> adapter2 = new ArrayAdapter<>( getContext(), ArrayAdapter<String> adapter2 = new ArrayAdapter<>(getContext(),
android.R.layout.simple_spinner_item, android.R.layout.simple_spinner_item,
sectionArray ); sectionArrayList);
sectionSpinner.setAdapter( adapter2 ); sectionSpinner.setAdapter(adapter2);
sectionSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { sectionSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String result = parent.getItemAtPosition( position ).toString().trim().replace(" ", ""); String result = parent.getItemAtPosition(position).toString().trim().replace(" ", "");
store.getReport().getItems().get(0).setSection( result.trim() ); store.getReport().getItems().get(0).setSection(result.trim());
Log.e("Section: ",""+result); store.getReport().getItems().get(0).setSectionForDraft(parent.getItemAtPosition(position).toString());
Log.e("Section: ", "" + result);
} }
@Override @Override
@ -556,81 +553,92 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
} }
}); });
minorCountTv.setText( String.valueOf(0) ); minorCountTv.setText(String.valueOf(0));
majorCountTv.setText( String.valueOf(0) ) ; majorCountTv.setText(String.valueOf(0));
criticalCountTv.setText( String.valueOf(0) ); criticalCountTv.setText(String.valueOf(0));
InspectionReport inspectionReport = store.getReport(); InspectionReport inspectionReport = store.getReport();
if( Objects.nonNull( inspectionReport ) && inspectionReport.getItems() != null && if (Objects.nonNull(inspectionReport) && inspectionReport.getItems() != null &&
! inspectionReport.getItems().isEmpty() && !inspectionReport.getItems().isEmpty() &&
! inspectionReport.getItems().get(0).getCheckPoints().isEmpty() ) { !inspectionReport.getItems().get(0).getCheckPoints().isEmpty()) {
int minor = 0; int minor = 0;
int major = 0; int major = 0;
int crirical = 0; int crirical = 0;
for (InspectionItemCheckPoint itemCp : inspectionReport.getItems().get(0).getCheckPoints()) { for (InspectionItemCheckPoint itemCp : inspectionReport.getItems().get(0).getCheckPoints()) {
for( int i = 0 ; i< itemCp.getDefectSeverites().size() ; i++ ){ for (int i = 0; i < itemCp.getDefectSeverites().size(); i++) {
String status = itemCp.getDefectSeverites().get( i ); String status = itemCp.getDefectSeverites().get(i);
System.out.println( status); System.out.println(status);
float quantity = itemCp.getQuantities().get(i); float quantity = itemCp.getQuantities().get(i);
if( status.equalsIgnoreCase("minor") ){ if (status.equalsIgnoreCase("minor")) {
minor += (int) quantity; minor += (int) quantity;
} ; }
if( status.equalsIgnoreCase("major") ){ ;
if (status.equalsIgnoreCase("major")) {
major += (int) quantity; major += (int) quantity;
} }
if( status.equalsIgnoreCase("critical") ) { if (status.equalsIgnoreCase("critical")) {
crirical += (int) quantity; crirical += (int) quantity;
} }
} }
} }
minorCountTv.setText( String.format("Minor : %d", minor ) ); minorCountTv.setText(String.format("Minor : %d", minor));
majorCountTv.setText( String.format("Major : %d", major ) ) ; majorCountTv.setText(String.format("Major : %d", major));
criticalCountTv.setText( String.format("Critical : %d", crirical ) ); criticalCountTv.setText(String.format("Critical : %d", crirical));
double majorInspection = store.getReport().getItems().get(0).getLevelMajorDefects(); double majorInspection = store.getReport().getItems().get(0).getLevelMajorDefects();
double minorInspection = store.getReport().getItems().get(0).getLevelMinorDefects(); double minorInspection = store.getReport().getItems().get(0).getLevelMinorDefects();
if((double) minor <= minorInspection if ((double) minor <= minorInspection
&& (double) major <= majorInspection && (double) major <= majorInspection
&& (double) crirical == 0) { && (double) crirical == 0) {
//resultStatus.setText("PASSED"); //resultStatus.setText("PASSED");
String defaultSelection = "PASSED"; String defaultSelection = "PASSED";
int defaultIndexResultIndex = inspectionReportService.getReportResult().indexOf( defaultSelection ); int defaultIndexResultIndex = inspectionReportService.getReportResult().indexOf(defaultSelection);
resultSpinner.setSelection( defaultIndexResultIndex ); resultSpinner.setSelection(defaultIndexResultIndex);
store.getReport().setReportResult("PASSED"); store.getReport().setReportResult("PASSED");
//resultStatus.setTextColor(ContextCompat.getColor(requireContext(),R.color.success)); //resultStatus.setTextColor(ContextCompat.getColor(requireContext(),R.color.success));
//resultStatus.setBackgroundResource( R.drawable.passed_bg ); //resultStatus.setBackgroundResource( R.drawable.passed_bg );
} } else {
else{
//resultStatus.setText("FAILED"); //resultStatus.setText("FAILED");
//resultStatus.setTextColor(ContextCompat.getColor(requireContext(),R.color.red)); //resultStatus.setTextColor(ContextCompat.getColor(requireContext(),R.color.red));
String defaultSelection = "FAILED"; String defaultSelection = "FAILED";
int defaultIndexResultIndex = inspectionReportService.getReportResult().indexOf( defaultSelection ); int defaultIndexResultIndex = inspectionReportService.getReportResult().indexOf(defaultSelection);
resultSpinner.setSelection( defaultIndexResultIndex ); resultSpinner.setSelection(defaultIndexResultIndex);
store.getReport().setReportResult("FAILED"); store.getReport().setReportResult("FAILED");
//resultStatus.setBackgroundResource( R.drawable.failed_bg ); //resultStatus.setBackgroundResource( R.drawable.failed_bg );
} }
//Log.e("majorCount: ",""+majorInspection); //Log.e("majorCount: ",""+majorInspection);
//Log.e("minorCount: ",""+minorInspection); //Log.e("minorCount: ",""+minorInspection);
txtMajor.setText(String.format("Major : %s/%d", (int)majorInspection, (int)(majorInspection + 1))); txtMajor.setText(String.format("Major : %s/%d", (int) majorInspection, (int) (majorInspection + 1)));
txtMinor.setText(String.format("Minor : %s/%d", (int)minorInspection, (int)(minorInspection + 1))); txtMinor.setText(String.format("Minor : %s/%d", (int) minorInspection, (int) (minorInspection + 1)));
} }
if (!store.getReport().getItems().get(0).getDimensionImages().isEmpty()) { if (!store.getReport().getItems().get(0).getDimensionImages().isEmpty()) {
updateImageAdapter(store.getReport().getItems().get(0).getDimensionImages()); updateImageAdapter(store.getReport().getItems().get(0).getDimensionImages());
} }
SharedPreferences sharedPreferences = getContext().getSharedPreferences("login_prefs", Context.MODE_PRIVATE);
long draftReportId = Long.parseLong(sharedPreferences.getString("draftReportId", null));
if (draftReportId > 0) {
Log.e("draft-Report-ID: ",""+draftReportId);
String selectedString = store.getReport().getItems().get(0).getSectionForDraft();
Log.e("draft-Report-selected: ",""+selectedString);
int index = sectionArrayList.indexOf(selectedString);
Log.e("draft-index: ",""+index);
sectionSpinner.setSelection(index);
}
} }
private void calculateDimensions(){ private void calculateDimensions() {
List<InspectionItemDimension> dimensions = store.getDimensions(); List<InspectionItemDimension> dimensions = store.getDimensions();
System.out.println( dimensions ); System.out.println(dimensions);
// List<InspectionItemDimension> newDimensions = new ArrayList<>(); // List<InspectionItemDimension> newDimensions = new ArrayList<>();
try { try {
// if(! dimensions.isEmpty() ){ // if(! dimensions.isEmpty() ){
// calculations for averaging // calculations for averaging
// Map<String,List<InspectionItemDimension>> typeToDimensionsMap = // Map<String,List<InspectionItemDimension>> typeToDimensionsMap =
// dimensions.stream().collect(Collectors.groupingBy( InspectionItemDimension::getType) ); // dimensions.stream().collect(Collectors.groupingBy( InspectionItemDimension::getType) );
@ -638,27 +646,27 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
// InspectionItemDimension newDimen = getInspectionItemDimension( entry ); // InspectionItemDimension newDimen = getInspectionItemDimension( entry );
// newDimensions.add( newDimen ); // newDimensions.add( newDimen );
// } // }
store.getReport().getItems().get(0).setDimensions( dimensions ); store.getReport().getItems().get(0).setDimensions(dimensions);
ItemDimensionAdapter adapter = new ItemDimensionAdapter( dimensions ); ItemDimensionAdapter adapter = new ItemDimensionAdapter(dimensions);
itemDimensionsRecyclerView.setAdapter( adapter ); itemDimensionsRecyclerView.setAdapter(adapter);
} catch ( NullPointerException ex ){ } catch (NullPointerException ex) {
Toast.makeText( getContext() , "Please fill the required Fields", Toast.LENGTH_LONG ).show(); Toast.makeText(getContext(), "Please fill the required Fields", Toast.LENGTH_LONG).show();
} }
} }
@NonNull @NonNull
private static InspectionItemDimension getInspectionItemDimension( Map.Entry<String, List<InspectionItemDimension>> entry ) { private static InspectionItemDimension getInspectionItemDimension(Map.Entry<String, List<InspectionItemDimension>> entry) {
float required = 0f; float required = 0f;
float actual = 0f; float actual = 0f;
float difference = 0f; float difference = 0f;
String unit = null; String unit = null;
float size = entry.getValue().size(); float size = entry.getValue().size();
for( InspectionItemDimension dimen : entry.getValue() ){ for (InspectionItemDimension dimen : entry.getValue()) {
required += dimen.getRequired(); required += dimen.getRequired();
actual += dimen.getActual(); actual += dimen.getActual();
difference += dimen.getDifference(); difference += dimen.getDifference();
if( unit == null ){ if (unit == null) {
unit = dimen.getUnit(); unit = dimen.getUnit();
} }
} }
@ -676,25 +684,25 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
); );
} }
private void initializeViews( View view ){ private void initializeViews(View view) {
backBtn = view.findViewById( R.id.button_left_frag_3 ); backBtn = view.findViewById(R.id.button_left_frag_3);
nextBtn = view.findViewById( R.id.button_right_frag_3 ); nextBtn = view.findViewById(R.id.button_right_frag_3);
btnDraft = view.findViewById(R.id.button_draft_third); btnDraft = view.findViewById(R.id.button_draft_third);
imagePicker = view.findViewById(R.id.image_picker); imagePicker = view.findViewById(R.id.image_picker);
deleteImage = view.findViewById(R.id.delete_image); deleteImage = view.findViewById(R.id.delete_image);
imageRecyclerView = view.findViewById(R.id.imageRecyclerView); imageRecyclerView = view.findViewById(R.id.imageRecyclerView);
openDimensionDialog = view.findViewById( R.id.button_open_dimension ); openDimensionDialog = view.findViewById(R.id.button_open_dimension);
profileImage = view.findViewById( R.id.third_step_profile_image ); profileImage = view.findViewById(R.id.third_step_profile_image);
profileName = view.findViewById( R.id.third_profile_name ); profileName = view.findViewById(R.id.third_profile_name);
vocRecyclerView = view.findViewById( R.id.voc_recyclerview ); vocRecyclerView = view.findViewById(R.id.voc_recyclerview);
resultSpinner = view.findViewById( R.id.result_spinner ); resultSpinner = view.findViewById(R.id.result_spinner);
sectionSpinner = view.findViewById(R.id.section_spinner); sectionSpinner = view.findViewById(R.id.section_spinner);
//resultStatus = view.findViewById( R.id.result_status); //resultStatus = view.findViewById( R.id.result_status);
generalRemarks = view.findViewById( R.id.general_remarks ); generalRemarks = view.findViewById(R.id.general_remarks);
itemDimensionsRecyclerView = view.findViewById( R.id.item_dimensions_recyclerview ); itemDimensionsRecyclerView = view.findViewById(R.id.item_dimensions_recyclerview);
minorCountTv = view.findViewById( R.id.minor_count ); minorCountTv = view.findViewById(R.id.minor_count);
majorCountTv = view.findViewById( R.id.major_count ); majorCountTv = view.findViewById(R.id.major_count);
criticalCountTv = view.findViewById( R.id.critical_count ); criticalCountTv = view.findViewById(R.id.critical_count);
etQualityAuditor = view.findViewById(R.id.et_quality_auditor); etQualityAuditor = view.findViewById(R.id.et_quality_auditor);
etProdRepresentative = view.findViewById(R.id.et_prod_represent); etProdRepresentative = view.findViewById(R.id.et_prod_represent);
etQcRepresentative = view.findViewById(R.id.et_qc_represent); etQcRepresentative = view.findViewById(R.id.et_qc_represent);
@ -702,20 +710,28 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
txtMinor = view.findViewById(R.id.txt_minor); txtMinor = view.findViewById(R.id.txt_minor);
etFloor = view.findViewById(R.id.et_floor); etFloor = view.findViewById(R.id.et_floor);
} sectionArrayList.add("Comforter & Mattress Pad");
private void setOnClickListeners(){ sectionArrayList.add("Bedding");
nextBtn.setOnClickListener( this ); sectionArrayList.add("Blanket & Table Linen");
backBtn.setOnClickListener( this ); sectionArrayList.add("Pillow");
btnDraft.setOnClickListener( this); sectionArrayList.add("Terry Towel");
openDimensionDialog.setOnClickListener( this); sectionArrayList.add("Garments & Mattress Protector");
} }
private void updateProfileViews( ) throws NullPointerException{ private void setOnClickListeners() {
nextBtn.setOnClickListener(this);
backBtn.setOnClickListener(this);
btnDraft.setOnClickListener(this);
openDimensionDialog.setOnClickListener(this);
}
private void updateProfileViews() throws NullPointerException {
SharedPreferences sharedPreferences = getActivity().getSharedPreferences("login_prefs", Context.MODE_PRIVATE); SharedPreferences sharedPreferences = getActivity().getSharedPreferences("login_prefs", Context.MODE_PRIVATE);
profileName.setText( sharedPreferences.getString("name", null ) ); profileName.setText(sharedPreferences.getString("name", null));
Glide.with( getContext() ) Glide.with(getContext())
.load( store.getProfileImage( ) ) .load(store.getProfileImage())
.into( profileImage ); .into(profileImage);
} }
// PERMISSIONS // PERMISSIONS

View File

@ -515,6 +515,85 @@
android:visibility="gone" android:visibility="gone"
android:layout_margin="5dp"/> android:layout_margin="5dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:layout_marginTop="6dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@drawable/box_border"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="11dp"
android:padding="5dp"
android:orientation="horizontal">
<TextView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="Hand Feel Not OK"
android:textColor="@color/black"
android:textStyle="bold" />
<TextView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="Hand Feel OK"
android:textColor="@color/black"
android:textStyle="bold" />
<TextView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="Hand Feel Not OK %"
android:textColor="@color/black"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:orientation="horizontal"
android:paddingBottom="5dp">
<EditText
android:id="@+id/et_hand_feel_not_ok"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:hint="Hand Feel Not OK"
android:imeOptions="actionDone"
android:inputType="numberDecimal" />
<EditText
android:id="@+id/et_hand_feel_ok"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:hint="Hand Feel OK"
android:enabled="false"
android:imeOptions="actionNext"
android:inputType="numberDecimal" />
<EditText
android:id="@+id/et_not_ok_percent"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:hint="Not OK %"
android:enabled="false"
android:imeOptions="actionNext"
android:inputType="numberDecimal" />
</LinearLayout>
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"