- minor changes
parent
7ed84d1bf4
commit
1b1f9f711e
|
@ -1,6 +1,7 @@
|
|||
package com.utopiaindustries.qualitychecker.models;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
public class InspectionItemCheckPoint {
|
||||
|
||||
|
@ -17,6 +18,12 @@ public class InspectionItemCheckPoint {
|
|||
|
||||
private String defectTitle;
|
||||
|
||||
private UUID uuid;
|
||||
|
||||
public InspectionItemCheckPoint(){
|
||||
this.uuid = UUID.randomUUID(); // Generate a random UUID
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
@ -93,6 +100,10 @@ public class InspectionItemCheckPoint {
|
|||
this.imagePath = imagePath;
|
||||
}
|
||||
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InspectionItemCheckPoint{" +
|
||||
|
@ -108,4 +119,6 @@ public class InspectionItemCheckPoint {
|
|||
", defectTitle='" + defectTitle + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.utopiaindustries.qualitychecker.models.InspectionDefect;
|
|||
import com.utopiaindustries.qualitychecker.models.InspectionItemCheckPoint;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CheckPointAdapter extends
|
||||
|
@ -60,10 +61,16 @@ public class CheckPointAdapter extends
|
|||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return checkPointList.get( position ).getUuid().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
InspectionItemCheckPoint checkPoint = checkPointList.get( position );
|
||||
holder.bind(checkPoints, defects, defectTypes, checkPoint);
|
||||
holder.setIsRecyclable(false);
|
||||
// spinner on change
|
||||
{
|
||||
holder.checkpointSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
|
@ -123,22 +130,7 @@ public class CheckPointAdapter extends
|
|||
}
|
||||
// remarks on change
|
||||
{
|
||||
holder.remarks.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) {
|
||||
checkPoint.setRemarks( s.toString() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
});
|
||||
holder.setupRemarksListener( checkPoint );
|
||||
}
|
||||
|
||||
holder.imagePicker.setOnClickListener( v -> {
|
||||
|
@ -173,10 +165,10 @@ public class CheckPointAdapter extends
|
|||
|
||||
public ViewHolder( @NonNull View itemView) {
|
||||
super(itemView);
|
||||
remarks = itemView.findViewById(R.id.check_point_remarks);
|
||||
checkpointSpinner = itemView.findViewById(R.id.check_point_spinner);
|
||||
okCheckBox = itemView.findViewById(R.id.check_point_ok);
|
||||
noCheckBox = itemView.findViewById(R.id.check_point_no);
|
||||
remarks = itemView.findViewById(R.id.check_point_remarks);
|
||||
imagePicker = itemView.findViewById(R.id.image_picker );
|
||||
selectedImage = itemView.findViewById( R.id.selected_image );
|
||||
defectsSpinner = itemView.findViewById(R.id.defect_spinner);
|
||||
|
@ -244,5 +236,23 @@ public class CheckPointAdapter extends
|
|||
int defaultSelectedDefectPosition = defectList.indexOf(defaultDefectSelectedItem);
|
||||
defectsSpinner.setSelection(defaultSelectedDefectPosition);
|
||||
}
|
||||
|
||||
public void setupRemarksListener(InspectionItemCheckPoint checkPoint) {
|
||||
// Remarks EditText listener
|
||||
remarks.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) {
|
||||
checkPoint.setRemarks(s.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue