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