Feedback implemented
parent
3d276199f4
commit
f82d10ddea
|
@ -48,6 +48,7 @@ public class HomeActivity extends AppCompatActivity {
|
||||||
private final List<Fragment> fragmentList = new ArrayList<>();
|
private final List<Fragment> fragmentList = new ArrayList<>();
|
||||||
//Button btnNext;
|
//Button btnNext;
|
||||||
ImageView imgLogout;
|
ImageView imgLogout;
|
||||||
|
ImageView img_back;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -64,6 +65,7 @@ public class HomeActivity extends AppCompatActivity {
|
||||||
Toast.makeText( this, "No Internet Connection", Toast.LENGTH_LONG ).show();
|
Toast.makeText( this, "No Internet Connection", Toast.LENGTH_LONG ).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img_back = findViewById(R.id.img_back);
|
||||||
imgLogout = findViewById(R.id.img_logout);
|
imgLogout = findViewById(R.id.img_logout);
|
||||||
|
|
||||||
imgLogout.setOnClickListener(new View.OnClickListener() {
|
imgLogout.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -72,6 +74,18 @@ public class HomeActivity extends AppCompatActivity {
|
||||||
alertLogOut(HomeActivity.this);
|
alertLogOut(HomeActivity.this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
img_back.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
|
||||||
|
getSupportFragmentManager().popBackStack(); // Go back to the previous fragment
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//btnNext = findViewById(R.id.btn_next);
|
//btnNext = findViewById(R.id.btn_next);
|
||||||
|
|
||||||
// Initialize fragments
|
// Initialize fragments
|
||||||
|
|
|
@ -18,6 +18,7 @@ import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AutoCompleteTextView;
|
import android.widget.AutoCompleteTextView;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
@ -86,6 +87,9 @@ public class ItemStepsAdapter extends RecyclerView.Adapter<ItemStepsAdapter.Item
|
||||||
.into(holder.imageView);
|
.into(holder.imageView);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
holder.imageView.setImageResource(R.drawable.image_picker);
|
||||||
|
}
|
||||||
|
|
||||||
currentItem.setStepId(position + 1);
|
currentItem.setStepId(position + 1);
|
||||||
switch (position) {
|
switch (position) {
|
||||||
|
@ -141,6 +145,15 @@ public class ItemStepsAdapter extends RecyclerView.Adapter<ItemStepsAdapter.Item
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
holder.deleteImage.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (imageSelectionListener != null) {
|
||||||
|
imageSelectionListener.onDeleteImage(holder.getAdapterPosition()); // Notify the fragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ScoreSpinnerAdapter scoreSpinnerAdapter = new ScoreSpinnerAdapter(context, dropdownOptions);
|
ScoreSpinnerAdapter scoreSpinnerAdapter = new ScoreSpinnerAdapter(context, dropdownOptions);
|
||||||
holder.scoreTextview.setAdapter(scoreSpinnerAdapter);
|
holder.scoreTextview.setAdapter(scoreSpinnerAdapter);
|
||||||
|
|
||||||
|
@ -169,6 +182,7 @@ public class ItemStepsAdapter extends RecyclerView.Adapter<ItemStepsAdapter.Item
|
||||||
AutoCompleteTextView scoreTextview;
|
AutoCompleteTextView scoreTextview;
|
||||||
EditText et_remarks;
|
EditText et_remarks;
|
||||||
ImageView imageView;
|
ImageView imageView;
|
||||||
|
ImageButton deleteImage;
|
||||||
|
|
||||||
public ItemViewHolder(@NonNull View itemView) {
|
public ItemViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
@ -177,7 +191,7 @@ public class ItemStepsAdapter extends RecyclerView.Adapter<ItemStepsAdapter.Item
|
||||||
tvPercentage = itemView.findViewById(R.id.tv_percentage);
|
tvPercentage = itemView.findViewById(R.id.tv_percentage);
|
||||||
et_remarks = itemView.findViewById(R.id.et_remarks);
|
et_remarks = itemView.findViewById(R.id.et_remarks);
|
||||||
imageView = itemView.findViewById(R.id.img1);
|
imageView = itemView.findViewById(R.id.img1);
|
||||||
|
deleteImage = itemView.findViewById(R.id.delete_image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ public class CheckingFragment extends Fragment implements EasyPermissions.Permis
|
||||||
List<ItemModel> itemModelList = new ArrayList<>();
|
List<ItemModel> itemModelList = new ArrayList<>();
|
||||||
ItemStepsAdapter adapter;
|
ItemStepsAdapter adapter;
|
||||||
private int selectedPosition = -1;
|
private int selectedPosition = -1;
|
||||||
|
private int deletePosition = -1;
|
||||||
|
|
||||||
// Activity Result Launcher for Gallery
|
// Activity Result Launcher for Gallery
|
||||||
private final ActivityResultLauncher<Intent> imagePickerLauncher =
|
private final ActivityResultLauncher<Intent> imagePickerLauncher =
|
||||||
|
@ -496,4 +497,16 @@ public class CheckingFragment extends Fragment implements EasyPermissions.Permis
|
||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDeleteImage(int position) {
|
||||||
|
deletePosition = position;
|
||||||
|
|
||||||
|
if (itemModelList.get(deletePosition).getImageArrayList() != null && !itemModelList.get(deletePosition).getImageArrayList().isEmpty()) {
|
||||||
|
itemModelList.get(deletePosition).setImageArrayList(null);
|
||||||
|
itemModelList.get(deletePosition).setImageUri(null);
|
||||||
|
adapter.notifyItemChanged(deletePosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -78,6 +78,7 @@ public class CuttingFragment extends Fragment implements EasyPermissions.Permiss
|
||||||
List<ItemModel> itemModelList = new ArrayList<>();
|
List<ItemModel> itemModelList = new ArrayList<>();
|
||||||
ItemStepsAdapter adapter;
|
ItemStepsAdapter adapter;
|
||||||
private int selectedPosition = -1;
|
private int selectedPosition = -1;
|
||||||
|
private int deletePosition = -1;
|
||||||
|
|
||||||
// Activity Result Launcher for Gallery
|
// Activity Result Launcher for Gallery
|
||||||
private final ActivityResultLauncher<Intent> imagePickerLauncher =
|
private final ActivityResultLauncher<Intent> imagePickerLauncher =
|
||||||
|
@ -559,6 +560,19 @@ public class CuttingFragment extends Fragment implements EasyPermissions.Permiss
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDeleteImage(int position) {
|
||||||
|
deletePosition = position;
|
||||||
|
Log.e("delete-position: ",""+deletePosition);
|
||||||
|
|
||||||
|
if (itemModelList.get(deletePosition).getImageArrayList() != null && !itemModelList.get(deletePosition).getImageArrayList().isEmpty()) {
|
||||||
|
itemModelList.get(deletePosition).setImageArrayList(null);
|
||||||
|
itemModelList.get(deletePosition).setImageUri(null);
|
||||||
|
adapter.notifyItemChanged(deletePosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isValidate(int rateCutting, int rateStitching, int rateChecking, int ratePacking, int rateSub) {
|
public boolean isValidate(int rateCutting, int rateStitching, int rateChecking, int ratePacking, int rateSub) {
|
||||||
boolean returnValue = true;
|
boolean returnValue = true;
|
||||||
String message = "";
|
String message = "";
|
||||||
|
|
|
@ -22,6 +22,7 @@ import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
import com.utopiaindustries.qualitycontrol.R;
|
import com.utopiaindustries.qualitycontrol.R;
|
||||||
import com.utopiaindustries.qualitycontrol.activities.HomeActivity;
|
import com.utopiaindustries.qualitycontrol.activities.HomeActivity;
|
||||||
import com.utopiaindustries.qualitycontrol.adapters.DepartmentItemAdapter;
|
import com.utopiaindustries.qualitycontrol.adapters.DepartmentItemAdapter;
|
||||||
|
@ -48,6 +49,7 @@ import java.util.stream.Collectors;
|
||||||
public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnItemClickListener {
|
public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnItemClickListener {
|
||||||
|
|
||||||
AutoCompleteTextView locationSiteTextview, unitTextview, floorTextview;
|
AutoCompleteTextView locationSiteTextview, unitTextview, floorTextview;
|
||||||
|
TextInputLayout loc_input;
|
||||||
TextView txtCurrentDate;
|
TextView txtCurrentDate;
|
||||||
LoginViewModel loginViewModel;
|
LoginViewModel loginViewModel;
|
||||||
Button nextButton;
|
Button nextButton;
|
||||||
|
@ -84,9 +86,10 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
|
||||||
locationSiteTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
locationSiteTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
|
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
|
||||||
|
Log.e("locationSiteTextview: ","onItemClick: ");
|
||||||
LocationSite clickedItem = locationSiteList.get(position);
|
LocationSite clickedItem = locationSiteList.get(position);
|
||||||
unitTextview.setText("Select Unit");
|
//unitTextview.setText("Select Unit");
|
||||||
floorTextview.setText("Select Floor");
|
//floorTextview.setText("Select Floor");
|
||||||
|
|
||||||
//viewModel.setLocation(String.valueOf(clickedItem.getId()));
|
//viewModel.setLocation(String.valueOf(clickedItem.getId()));
|
||||||
Preference.setMyStringPref(Helper.project_file, Helper.locationSiteId, getActivity(), String.valueOf(clickedItem.getId()));
|
Preference.setMyStringPref(Helper.project_file, Helper.locationSiteId, getActivity(), String.valueOf(clickedItem.getId()));
|
||||||
|
@ -152,7 +155,7 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
|
||||||
nextButton.setOnClickListener(v -> {
|
nextButton.setOnClickListener(v -> {
|
||||||
if (getActivity() instanceof HomeActivity) {
|
if (getActivity() instanceof HomeActivity) {
|
||||||
//viewModel.setFromViewModel(true);
|
//viewModel.setFromViewModel(true);
|
||||||
// Preference.setMyStringPref(Helper.project_file, Helper.InProcess, getActivity(), "true");
|
// Preference.setMyStringPref(Helper.project_file, Helper.InProcess, getActivity(), "true");
|
||||||
String siteID = Preference.getMyStringPref(Helper.project_file, Helper.locationSiteId, getActivity());
|
String siteID = Preference.getMyStringPref(Helper.project_file, Helper.locationSiteId, getActivity());
|
||||||
String unitId = Preference.getMyStringPref(Helper.project_file, Helper.unitId, getActivity());
|
String unitId = Preference.getMyStringPref(Helper.project_file, Helper.unitId, getActivity());
|
||||||
String departId = Preference.getMyStringPref(Helper.project_file, Helper.departmentId, getActivity());
|
String departId = Preference.getMyStringPref(Helper.project_file, Helper.departmentId, getActivity());
|
||||||
|
@ -171,19 +174,19 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
Log.e("beforeTextChanged: ","------");
|
//Log.e("beforeTextChanged: ", "------");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
Log.e("onTextChanged: ","------");
|
//Log.e("onTextChanged: ", "------");
|
||||||
filterList(s.toString());
|
filterList(s.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
Log.e("afterTextChanged: ","------");
|
//Log.e("afterTextChanged: ", "------");
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -203,6 +206,8 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
|
||||||
txtCurrentDate = view.findViewById(R.id.txt_current_date);
|
txtCurrentDate = view.findViewById(R.id.txt_current_date);
|
||||||
locationSiteTextview = view.findViewById(R.id.location_textview);
|
locationSiteTextview = view.findViewById(R.id.location_textview);
|
||||||
|
|
||||||
|
loc_input = view.findViewById(R.id.loc_input);
|
||||||
|
|
||||||
unitTextview = view.findViewById(R.id.unit_textview);
|
unitTextview = view.findViewById(R.id.unit_textview);
|
||||||
floorTextview = view.findViewById(R.id.floor_textview);
|
floorTextview = view.findViewById(R.id.floor_textview);
|
||||||
nextButton = view.findViewById(R.id.btn_next);
|
nextButton = view.findViewById(R.id.btn_next);
|
||||||
|
@ -215,6 +220,9 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
|
||||||
|
|
||||||
loginViewModel = new ViewModelProvider(getActivity()).get(LoginViewModel.class);
|
loginViewModel = new ViewModelProvider(getActivity()).get(LoginViewModel.class);
|
||||||
|
|
||||||
|
locationSitesAdapter = new LocationSitesAdapter(getActivity(), locationSiteList);
|
||||||
|
locationSiteTextview.setAdapter(locationSitesAdapter);
|
||||||
|
|
||||||
loginViewModel.getLoadingState().observe(getActivity(), isLoading -> {
|
loginViewModel.getLoadingState().observe(getActivity(), isLoading -> {
|
||||||
//Log.e("HomeFragment: ", "isLoading: ");
|
//Log.e("HomeFragment: ", "isLoading: ");
|
||||||
if (isLoading != null && isLoading) {
|
if (isLoading != null && isLoading) {
|
||||||
|
@ -272,6 +280,7 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
|
||||||
Helper.saveList(qcResponse.getLocationUnits(), Helper.homeUnit, getActivity());
|
Helper.saveList(qcResponse.getLocationUnits(), Helper.homeUnit, getActivity());
|
||||||
locationUnitList.addAll(qcResponse.getLocationUnits());
|
locationUnitList.addAll(qcResponse.getLocationUnits());
|
||||||
}
|
}
|
||||||
|
Log.e("From-Service: ","****");
|
||||||
|
|
||||||
Preference.setMyStringPref(Helper.project_file, Helper.firstTimeApiCall, getActivity(), "true");
|
Preference.setMyStringPref(Helper.project_file, Helper.firstTimeApiCall, getActivity(), "true");
|
||||||
|
|
||||||
|
@ -285,13 +294,15 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
|
||||||
|
|
||||||
loginViewModel.getQualityControlData();
|
loginViewModel.getQualityControlData();
|
||||||
} else {
|
} else {
|
||||||
if (!Preference.getMyStringPref(Helper.project_file, Helper.departmentName, getActivity()).equalsIgnoreCase("default")) {
|
Log.e("From-Preference: ","****");
|
||||||
|
isFromPrevious = true;
|
||||||
|
/*if (!Preference.getMyStringPref(Helper.project_file, Helper.departmentName, getActivity()).equalsIgnoreCase("default")) {
|
||||||
searchEditText.setText(Preference.getMyStringPref(Helper.project_file, Helper.departmentName, getActivity()));
|
searchEditText.setText(Preference.getMyStringPref(Helper.project_file, Helper.departmentName, getActivity()));
|
||||||
isFromPrevious = true;
|
isFromPrevious = true;
|
||||||
locationSiteTextview.setText(Preference.getMyStringPref(Helper.project_file, Helper.locationSiteName, getActivity()));
|
locationSiteTextview.setText(Preference.getMyStringPref(Helper.project_file, Helper.locationSiteName, getActivity()));
|
||||||
unitTextview.setText(Preference.getMyStringPref(Helper.project_file, Helper.unitName, getActivity()));
|
unitTextview.setText(Preference.getMyStringPref(Helper.project_file, Helper.unitName, getActivity()));
|
||||||
floorTextview.setText(Preference.getMyStringPref(Helper.project_file, Helper.floorName, getActivity()));
|
floorTextview.setText(Preference.getMyStringPref(Helper.project_file, Helper.floorName, getActivity()));
|
||||||
}
|
}*/
|
||||||
|
|
||||||
departmentList.clear();
|
departmentList.clear();
|
||||||
locationSiteList.clear();
|
locationSiteList.clear();
|
||||||
|
@ -301,9 +312,7 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
|
||||||
//locationSiteList.addAll(viewModel.getLocationSiteList());
|
//locationSiteList.addAll(viewModel.getLocationSiteList());
|
||||||
locationSiteList.addAll(Helper.getList(Helper.homeSite, getActivity(), LocationSite.class));
|
locationSiteList.addAll(Helper.getList(Helper.homeSite, getActivity(), LocationSite.class));
|
||||||
Log.e("locationSiteList-size: ", "" + locationSiteList.size());
|
Log.e("locationSiteList-size: ", "" + locationSiteList.size());
|
||||||
|
locationSitesAdapter.notifyDataSetChanged();
|
||||||
locationSitesAdapter = new LocationSitesAdapter(getActivity(), locationSiteList);
|
|
||||||
locationSiteTextview.setAdapter(locationSitesAdapter);
|
|
||||||
|
|
||||||
//department list
|
//department list
|
||||||
//departmentList.addAll(viewModel.getDepartmentList());
|
//departmentList.addAll(viewModel.getDepartmentList());
|
||||||
|
@ -390,23 +399,30 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
|
||||||
boolean returnValue = true;
|
boolean returnValue = true;
|
||||||
String message = "";
|
String message = "";
|
||||||
|
|
||||||
if (departId.isEmpty() || departId.equalsIgnoreCase("default")) {
|
if (floorId.isEmpty() || floorId.equalsIgnoreCase("default")
|
||||||
message = "Please select Department";
|
|| floorTextview.getText().toString().equalsIgnoreCase("Select Floor")
|
||||||
|
|| floorTextview.getText().toString().isEmpty()) {
|
||||||
|
message = "Please select Floor.";
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (siteId.isEmpty() || siteId.equalsIgnoreCase("default")) {
|
if (unitId.isEmpty() || unitId.equalsIgnoreCase("default")
|
||||||
message = "Please select Location Site";
|
|| unitTextview.getText().toString().equalsIgnoreCase("Select Unit")
|
||||||
returnValue = false;
|
|| unitTextview.getText().toString().isEmpty()) {
|
||||||
}
|
|
||||||
|
|
||||||
if (unitId.isEmpty() || unitId.equalsIgnoreCase("default")) {
|
|
||||||
message = "Please select Unit.";
|
message = "Please select Unit.";
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (floorId.isEmpty() || floorId.equalsIgnoreCase("default")) {
|
if (siteId.isEmpty() || siteId.equalsIgnoreCase("default")
|
||||||
message = "Please select Floor.";
|
|| locationSiteTextview.getText().toString().equalsIgnoreCase("")
|
||||||
|
|| locationSiteTextview.getText().toString().isEmpty()) {
|
||||||
|
message = "Please select Location Site";
|
||||||
|
returnValue = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (departId.isEmpty() || departId.equalsIgnoreCase("default")
|
||||||
|
|| searchEditText.getText().toString().isEmpty()) {
|
||||||
|
message = "Please select Department";
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ public class PackingFragment extends Fragment implements EasyPermissions.Permiss
|
||||||
List<ItemModel> itemModelList = new ArrayList<>();
|
List<ItemModel> itemModelList = new ArrayList<>();
|
||||||
ItemStepsAdapter adapter;
|
ItemStepsAdapter adapter;
|
||||||
private int selectedPosition = -1;
|
private int selectedPosition = -1;
|
||||||
|
private int deletePosition = -1;
|
||||||
|
|
||||||
// Activity Result Launcher for Gallery
|
// Activity Result Launcher for Gallery
|
||||||
private final ActivityResultLauncher<Intent> imagePickerLauncher =
|
private final ActivityResultLauncher<Intent> imagePickerLauncher =
|
||||||
|
@ -497,4 +498,16 @@ public class PackingFragment extends Fragment implements EasyPermissions.Permiss
|
||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDeleteImage(int position) {
|
||||||
|
deletePosition = position;
|
||||||
|
|
||||||
|
if (itemModelList.get(deletePosition).getImageArrayList() != null && !itemModelList.get(deletePosition).getImageArrayList().isEmpty()) {
|
||||||
|
itemModelList.get(deletePosition).setImageArrayList(null);
|
||||||
|
itemModelList.get(deletePosition).setImageUri(null);
|
||||||
|
adapter.notifyItemChanged(deletePosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -79,6 +79,7 @@ public class StitchingFragment extends Fragment implements EasyPermissions.Permi
|
||||||
List<ItemModel> itemModelList = new ArrayList<>();
|
List<ItemModel> itemModelList = new ArrayList<>();
|
||||||
ItemStepsAdapter adapter;
|
ItemStepsAdapter adapter;
|
||||||
private int selectedPosition = -1;
|
private int selectedPosition = -1;
|
||||||
|
private int deletePosition = -1;
|
||||||
|
|
||||||
// Activity Result Launcher for Gallery
|
// Activity Result Launcher for Gallery
|
||||||
private final ActivityResultLauncher<Intent> imagePickerLauncher =
|
private final ActivityResultLauncher<Intent> imagePickerLauncher =
|
||||||
|
@ -499,4 +500,16 @@ public class StitchingFragment extends Fragment implements EasyPermissions.Permi
|
||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDeleteImage(int position) {
|
||||||
|
deletePosition = position;
|
||||||
|
|
||||||
|
if (itemModelList.get(deletePosition).getImageArrayList() != null && !itemModelList.get(deletePosition).getImageArrayList().isEmpty()) {
|
||||||
|
itemModelList.get(deletePosition).setImageArrayList(null);
|
||||||
|
itemModelList.get(deletePosition).setImageUri(null);
|
||||||
|
adapter.notifyItemChanged(deletePosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -82,6 +82,7 @@ public class SubStoreFragment extends Fragment implements EasyPermissions.Permis
|
||||||
ItemStepsAdapter adapter;
|
ItemStepsAdapter adapter;
|
||||||
private int selectedPosition = -1;
|
private int selectedPosition = -1;
|
||||||
HomeViewModel homeViewModel;
|
HomeViewModel homeViewModel;
|
||||||
|
private int deletePosition = -1;
|
||||||
|
|
||||||
// Activity Result Launcher for Gallery
|
// Activity Result Launcher for Gallery
|
||||||
private final ActivityResultLauncher<Intent> imagePickerLauncher =
|
private final ActivityResultLauncher<Intent> imagePickerLauncher =
|
||||||
|
@ -271,7 +272,20 @@ public class SubStoreFragment extends Fragment implements EasyPermissions.Permis
|
||||||
tempList.addAll(Helper.getArrayList(Helper.listSubStore, getActivity()));
|
tempList.addAll(Helper.getArrayList(Helper.listSubStore, getActivity()));
|
||||||
String generatedBy = Preference.getMyStringPref(Helper.project_file,Helper.logInUser,getActivity());
|
String generatedBy = Preference.getMyStringPref(Helper.project_file,Helper.logInUser,getActivity());
|
||||||
|
|
||||||
QualityControl qualityControl = new QualityControl(generatedBy, siteID, unitId, departId, floorId, tempList);
|
/*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);
|
homeViewModel.saveQualityControlData(qualityControl);
|
||||||
} else {
|
} else {
|
||||||
|
@ -587,6 +601,18 @@ public class SubStoreFragment extends Fragment implements EasyPermissions.Permis
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDeleteImage(int position) {
|
||||||
|
deletePosition = position;
|
||||||
|
|
||||||
|
if (itemModelList.get(deletePosition).getImageArrayList() != null && !itemModelList.get(deletePosition).getImageArrayList().isEmpty()) {
|
||||||
|
itemModelList.get(deletePosition).setImageArrayList(null);
|
||||||
|
itemModelList.get(deletePosition).setImageUri(null);
|
||||||
|
adapter.notifyItemChanged(deletePosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void showProgressDialog() {
|
public void showProgressDialog() {
|
||||||
ProgressDialogFragment progressDialog = new ProgressDialogFragment();
|
ProgressDialogFragment progressDialog = new ProgressDialogFragment();
|
||||||
progressDialog.setCancelable(false);
|
progressDialog.setCancelable(false);
|
||||||
|
|
|
@ -107,9 +107,9 @@ public class Helper {
|
||||||
SharedPreferences.Editor editor = prefs.edit();
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
editor.remove(key); // Remove the key-value pair
|
editor.remove(key); // Remove the key-value pair
|
||||||
editor.apply(); // Apply changes
|
editor.apply(); // Apply changes
|
||||||
Log.e("SharedPreferences", "Key '" + key + "' removed successfully.");
|
///Log.e("SharedPreferences", "Key '" + key + "' removed successfully.");
|
||||||
} else {
|
} else {
|
||||||
Log.e("SharedPreferences", "Key '" + key + "' does not exist.");
|
//Log.e("SharedPreferences", "Key '" + key + "' does not exist.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,4 +3,6 @@ package com.utopiaindustries.qualitycontrol.utils;
|
||||||
public interface ImageSelectionListener {
|
public interface ImageSelectionListener {
|
||||||
|
|
||||||
void onSelectImage(int position);
|
void onSelectImage(int position);
|
||||||
|
|
||||||
|
void onDeleteImage(int position);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,9 +74,9 @@ public class LoginViewModel extends ViewModel {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(@NonNull Call<Boolean> call, @NonNull Response<Boolean> response) {
|
public void onResponse(@NonNull Call<Boolean> call, @NonNull Response<Boolean> response) {
|
||||||
isLoading.setValue(false);
|
isLoading.setValue(false);
|
||||||
Log.e("onResponse-1: ", "Successful: "+response);
|
//Log.e("onResponse-1: ", "Successful: "+response);
|
||||||
if (response.isSuccessful() && response.body() != null) {
|
if (response.isSuccessful() && response.body() != null) {
|
||||||
Log.e("onResponse-2: ", "Successful: "+response);
|
//Log.e("onResponse-2: ", "Successful: "+response);
|
||||||
userLoginLiveData.setValue(response.body());
|
userLoginLiveData.setValue(response.body());
|
||||||
} else {
|
} else {
|
||||||
userLoginLiveData.setValue(false);
|
userLoginLiveData.setValue(false);
|
||||||
|
|
|
@ -11,16 +11,13 @@ public class QualityControl {
|
||||||
private int floorId;
|
private int floorId;
|
||||||
private List<ItemModel> qualityControlItemList;
|
private List<ItemModel> qualityControlItemList;
|
||||||
|
|
||||||
public QualityControl(String generatedBy, int siteId, int floorId, int departmentId, int unitId, List<ItemModel> qualityControlItemList) {
|
public QualityControl(String generatedBy, int siteId, int unitId, int departmentId, int floorId, List<ItemModel> qualityControlItemList) {
|
||||||
this.generatedBy = generatedBy;
|
this.generatedBy = generatedBy;
|
||||||
this.siteId = siteId;
|
this.siteId = siteId;
|
||||||
this.qualityControlItemList = qualityControlItemList;
|
|
||||||
this.floorId = floorId;
|
|
||||||
this.departmentId = departmentId;
|
|
||||||
this.unitId = unitId;
|
this.unitId = unitId;
|
||||||
}
|
this.departmentId = departmentId;
|
||||||
|
this.floorId = floorId;
|
||||||
public QualityControl() {
|
this.qualityControlItemList = qualityControlItemList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGeneratedBy() {
|
public String getGeneratedBy() {
|
||||||
|
@ -70,21 +67,4 @@ public class QualityControl {
|
||||||
public void setQualityControlItemList(List<ItemModel> qualityControlItemList) {
|
public void setQualityControlItemList(List<ItemModel> qualityControlItemList) {
|
||||||
this.qualityControlItemList = qualityControlItemList;
|
this.qualityControlItemList = qualityControlItemList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void appendToQualityControlItemList(List<ItemModel> items) {
|
|
||||||
if (items != null) {
|
|
||||||
qualityControlItemList.addAll(items);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "QualityControl{" +
|
|
||||||
"siteId=" + siteId +
|
|
||||||
", unitId=" + unitId +
|
|
||||||
", departmentId=" + departmentId +
|
|
||||||
", floorId=" + floorId +
|
|
||||||
", qualityControlItemList=" + qualityControlItemList +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
android:id="@+id/textView"
|
android:id="@+id/textView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="5S Application"
|
android:text="5S App"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="@dimen/_15sdp"
|
android:textSize="@dimen/_15sdp"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/toolbar"
|
app:layout_constraintBottom_toBottomOf="@+id/toolbar"
|
||||||
|
@ -61,6 +61,17 @@
|
||||||
android:text="Next" />-->
|
android:text="Next" />-->
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img_back"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/toolbar"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/toolbar"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/toolbar"
|
||||||
|
app:srcCompat="@drawable/arrow_back" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img_logout"
|
android:id="@+id/img_logout"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
android:layout_width="300dp"
|
android:layout_width="300dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
|
app:passwordToggleEnabled="true"
|
||||||
android:layout_marginTop="5dp">
|
android:layout_marginTop="5dp">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
|
|
|
@ -48,13 +48,16 @@
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView6"
|
android:id="@+id/textView6"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="5S Application"
|
android:layout_marginStart="30dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:gravity="center"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
|
android:text="5S App"
|
||||||
android:textColor="@color/theme_color"
|
android:textColor="@color/theme_color"
|
||||||
android:textStyle="bold"
|
|
||||||
android:textSize="@dimen/_30sdp"
|
android:textSize="@dimen/_30sdp"
|
||||||
|
android:textStyle="bold"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/imageView"
|
app:layout_constraintBottom_toTopOf="@+id/imageView"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
android:hint="Search Department"
|
android:hint="Search Department"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
|
android:imeOptions="actionDone"
|
||||||
android:background="@drawable/et_border"
|
android:background="@drawable/et_border"
|
||||||
android:inputType="text" />
|
android:inputType="text" />
|
||||||
|
|
||||||
|
@ -80,6 +81,7 @@
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/loc_input"
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -78,6 +78,7 @@
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:hint="Remarks"
|
android:hint="Remarks"
|
||||||
|
android:imeOptions="actionDone"
|
||||||
android:layout_toEndOf="@+id/tv_percentage"
|
android:layout_toEndOf="@+id/tv_percentage"
|
||||||
android:background="@drawable/et_border"
|
android:background="@drawable/et_border"
|
||||||
android:padding="5dp" />
|
android:padding="5dp" />
|
||||||
|
@ -91,6 +92,17 @@
|
||||||
android:layout_toEndOf="@+id/et_remarks"
|
android:layout_toEndOf="@+id/et_remarks"
|
||||||
android:src="@drawable/image_picker" />
|
android:src="@drawable/image_picker" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/delete_image"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_toEndOf="@+id/img1"
|
||||||
|
android:contentDescription="delete"
|
||||||
|
android:src="@drawable/ic_delete"
|
||||||
|
android:background="@null"
|
||||||
|
android:padding="5dp"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</HorizontalScrollView>
|
</HorizontalScrollView>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">5S Application</string>
|
<string name="app_name">5S App</string>
|
||||||
<string name="app_version">Version 1.0</string>
|
<string name="app_version">Version 1.0</string>
|
||||||
<!-- TODO: Remove or change this placeholder text -->
|
<!-- TODO: Remove or change this placeholder text -->
|
||||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||||
|
|
Loading…
Reference in New Issue