Complete app requirements for 5S application

master
saad.siddiq 2024-12-03 17:25:47 +05:00
parent 8934c58ba6
commit 0a79e0db64
37 changed files with 1126 additions and 201 deletions

View File

@ -26,6 +26,10 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {

View File

@ -12,7 +12,6 @@
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
@ -20,6 +19,7 @@
<application
android:allowBackup="true"
android:allowClearUserData="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@drawable/search"
@ -27,9 +27,11 @@
android:roundIcon="@drawable/search"
android:supportsRtl="true"
android:theme="@style/Theme.QualityControlApp"
android:allowClearUserData="true"
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity
android:name=".activities.LoginActivity"
android:exported="false" />
<activity
android:name=".activities.SummaryActivity"
android:exported="false" />
@ -45,7 +47,7 @@
</activity>
<activity
android:name=".activities.HomeActivity"
android:exported="true"/>
android:exported="true" />
<provider
android:name="androidx.core.content.FileProvider"

View File

@ -1,13 +1,22 @@
package com.utopiaindustries.qualitycontrol.activities;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
@ -24,6 +33,7 @@ import com.utopiaindustries.qualitycontrol.fragments.PackingFragment;
import com.utopiaindustries.qualitycontrol.fragments.StitchingFragment;
import com.utopiaindustries.qualitycontrol.fragments.SubStoreFragment;
import com.utopiaindustries.qualitycontrol.helper.Helper;
import com.utopiaindustries.qualitycontrol.helper.Preference;
import java.io.File;
import java.text.SimpleDateFormat;
@ -37,6 +47,7 @@ public class HomeActivity extends AppCompatActivity {
private int currentFragmentIndex = 0;
private final List<Fragment> fragmentList = new ArrayList<>();
//Button btnNext;
ImageView imgLogout;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -53,6 +64,14 @@ public class HomeActivity extends AppCompatActivity {
Toast.makeText( this, "No Internet Connection", Toast.LENGTH_LONG ).show();
}
imgLogout = findViewById(R.id.img_logout);
imgLogout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
alertLogOut(HomeActivity.this);
}
});
//btnNext = findViewById(R.id.btn_next);
// Initialize fragments
@ -87,6 +106,53 @@ public class HomeActivity extends AppCompatActivity {
transaction.commit();
}
public void alertLogOut(Context con) {
ViewGroup viewGroup = findViewById(android.R.id.content);
TextView dialogOkBtn, dialogCancelBtn;
AlertDialog.Builder builder = new AlertDialog.Builder(con);
View view1 = LayoutInflater.from(con).inflate(R.layout.custom_layout_for_logout, viewGroup, false);
builder.setCancelable(false);
builder.setView(view1);
dialogOkBtn = view1.findViewById(R.id.dialogOkBtn);
dialogCancelBtn = view1.findViewById(R.id.dialogCancelBtn);
AlertDialog alertDialog = builder.create();
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialogOkBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
alertDialog.dismiss();
Preference.setMyBooleanPref(Helper.project_file, "isLoggedIn", getApplicationContext(), false);
Preference.setMyStringPref(Helper.project_file, Helper.firstTimeApiCall, getApplicationContext(), "false");
finish();
Intent i = new Intent(HomeActivity.this, LoginActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
}
});
dialogCancelBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
alertDialog.dismiss();
//Toast.makeText(con, "Cancel", Toast.LENGTH_SHORT).show();
}
});
alertDialog.show();
}
// Method to navigate to a specific fragment
/*public void navigateToFragment(Fragment fragment, boolean addToBackStack) {
androidx.fragment.app.FragmentTransaction transaction = getSupportFragmentManager()

View File

@ -0,0 +1,154 @@
package com.utopiaindustries.qualitycontrol.activities;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.lifecycle.ViewModelProvider;
import com.utopiaindustries.qualitycontrol.R;
import com.utopiaindustries.qualitycontrol.apiservice.ApiService;
import com.utopiaindustries.qualitycontrol.apiservice.ApiServiceFactory;
import com.utopiaindustries.qualitycontrol.helper.Helper;
import com.utopiaindustries.qualitycontrol.helper.Preference;
import com.utopiaindustries.qualitycontrol.utils.ProgressDialogFragment;
import com.utopiaindustries.qualitycontrol.viewmodels.LoginViewModel;
public class LoginActivity extends AppCompatActivity {
EditText tfEmail, tfPassword;
Button btnLogin;
LoginViewModel loginViewModel;
ApiService apiService;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_login);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
if (!Helper.isNetworkConnected(this)) {
Toast.makeText(this, "No Internet Connection", Toast.LENGTH_LONG).show();
}
initializeLayout();
btnLogin.setOnClickListener(v -> {
if (isValidate()) {
loginViewModel.isUserAuthenticated(tfEmail.getText().toString(),
tfPassword.getText().toString(),
new String[]{"ROLE_UIM_QC_APP_ACCESS_YES"});
}
});
}
public void initializeLayout() {
tfEmail = findViewById(R.id.tf_email);
tfPassword = findViewById(R.id.tf_password);
btnLogin = findViewById(R.id.btn_login);
apiService = ApiServiceFactory.getApiService();
//tfEmail.setText("muhammad.mujtaba");
//tfPassword.setText("Utopia01");
loginViewModel = new ViewModelProvider(this).get(LoginViewModel.class);
loginViewModel.getLoadingState().observe(this, isLoading -> {
if (isLoading != null && isLoading) {
showProgressDialog();
} else {
dismissProgressDialog();
}
});
loginViewModel.getErrorMessage().observe(this, errorResponse -> {
if (errorResponse.isEmpty()) {
Toast.makeText(this, "Something went wrong", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, errorResponse, Toast.LENGTH_SHORT).show();
}
});
loginViewModel.getLoginUser().observe(this, loginUser -> {
if (loginUser) {
Preference.setMyBooleanPref(Helper.project_file, "isLoggedIn", getApplicationContext(), true);
Preference.setMyStringPref(Helper.project_file,Helper.logInUser,this,tfEmail.getText().toString());
Intent intent = new Intent(this, HomeActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
finish();
}
else {
Toast.makeText(this, "Login Failed", Toast.LENGTH_SHORT).show();
}
});
/*loginViewModel.getUserLiveData().observe(this, user -> {
if (user != null) {
Preference.setMyBooleanPref(Helper.project_file, "isLoggedIn", getApplicationContext(), true);
Helper.setPreferenceObject(getApplicationContext(), user, "DriverResponse");
//Toast.makeText(this, "Welcome " + user.getTruckerName(), Toast.LENGTH_SHORT).show();
Intent intent = new Intent(this, HomeActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
finish();
} else {
Toast.makeText(this, "Login Failed", Toast.LENGTH_SHORT).show();
}
});*/
}
public boolean isValidate() {
boolean returnValue = true;
String message = "";
if (tfPassword.getText().toString().isEmpty()) {
message = "Please enter password.";
returnValue = false;
}
/*if (!Helper.isValidEmail(tfEmail.getText().toString())) {
message = "Please enter valid email.";
returnValue = false;
}*/
if (tfEmail.getText().toString().isEmpty()) {
message = "Please enter user name.";
returnValue = false;
}
if (!returnValue) {
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
}
return returnValue;
}
public void showProgressDialog() {
ProgressDialogFragment progressDialog = new ProgressDialogFragment();
progressDialog.setCancelable(false);
progressDialog.show(getSupportFragmentManager(), "progressDialog");
}
public void dismissProgressDialog() {
ProgressDialogFragment progressDialog = (ProgressDialogFragment) getSupportFragmentManager().findFragmentByTag("progressDialog");
if (progressDialog != null) {
progressDialog.dismiss();
}
}
}

View File

@ -40,13 +40,13 @@ public class SplashActivity extends AppCompatActivity {
new Handler().postDelayed(new Runnable() {
public void run() {
Intent myIntent = new Intent(SplashActivity.this, HomeActivity.class);
/*Intent myIntent = new Intent(SplashActivity.this, HomeActivity.class);
startActivity(myIntent);
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
finish();
finish();*/
/* if (isLoggedIn) {
Intent myIntent = new Intent(SplashActivity.this, MainActivity.class);
if (isLoggedIn) {
Intent myIntent = new Intent(SplashActivity.this, HomeActivity.class);
startActivity(myIntent);
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
finish();
@ -55,7 +55,7 @@ public class SplashActivity extends AppCompatActivity {
startActivity(myIntent);
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
finish();
}*/
}
}
}, TIMER);
}

View File

@ -1,6 +1,11 @@
package com.utopiaindustries.qualitycontrol.activities;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
@ -9,9 +14,15 @@ import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.utopiaindustries.qualitycontrol.R;
import com.utopiaindustries.qualitycontrol.models.QualitySaveResponse;
public class SummaryActivity extends AppCompatActivity {
TextView txtPercentage, txtCutting, txtStitching, txtChecking, txtPacking, txtSubStore;
String overallPercentage;
ImageView img_back;
QualitySaveResponse qualitySaveResponse;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -22,5 +33,44 @@ public class SummaryActivity extends AppCompatActivity {
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
initialization();
txtPercentage.setText(overallPercentage);
txtCutting.setText(qualitySaveResponse.getCutting());
txtStitching.setText(qualitySaveResponse.getStiching());
txtChecking.setText(qualitySaveResponse.getChecking());
txtPacking.setText(qualitySaveResponse.getPacking());
txtSubStore.setText(qualitySaveResponse.getSub_Store());
img_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
Intent intent = new Intent(SummaryActivity.this, HomeActivity.class);
startActivity(intent);
}
});
}
public void initialization() {
qualitySaveResponse = (QualitySaveResponse) getIntent().getSerializableExtra("Summary");
overallPercentage = getIntent().getStringExtra("Percentage");
/*Log.e("Cutting: ",""+qualitySaveResponse.getCutting());
Log.e("Stitching: ",""+qualitySaveResponse.getStiching());
Log.e("Checking: ",""+qualitySaveResponse.getChecking());
Log.e("Packing: ",""+qualitySaveResponse.getPacking());
Log.e("Substore: ",""+qualitySaveResponse.getSub_Store());
Log.e("Overall: ",""+qualitySaveResponse.getOverAllPercentage());*/
img_back = findViewById(R.id.img_back);
txtPercentage = findViewById(R.id.txt_percentage);
txtCutting = findViewById(R.id.txt_cutting_percentage);
txtStitching = findViewById(R.id.txt_stitching_percentage);
txtChecking = findViewById(R.id.txt_checking_percentage);
txtPacking = findViewById(R.id.txt_packing_percentage);
txtSubStore = findViewById(R.id.txt_substore_percentage);
}
}

View File

@ -20,11 +20,18 @@ public interface ApiService {
);*/
@GET("rest/uic/quality-control/get-quality-control-data")
Call<QualityControlResponse> isUserAuthenticated();
Call<QualityControlResponse> getQualityControlData();
@POST("rest/uic/quality-control/save-quality-control")
Call<QualitySaveResponse> saveQualityControlReport(
@Body QualityControl request
);
@POST("rest/authentication/authenticate-user")
Call<Boolean> isUserAuthenticated(
@Query("username") String username,
@Query("password") String password,
@Query("roles") String[] roles
);
}

View File

@ -73,7 +73,6 @@ public class CheckingFragment extends Fragment implements EasyPermissions.Permis
Button nextButton;
ImageButton imagePicker, deleteImage;
EditText etPercentage, etRemarks;
QualityControlViewModel viewModel;
List<ItemModel> itemModelList = new ArrayList<>();
ItemStepsAdapter adapter;
private int selectedPosition = -1;
@ -85,7 +84,7 @@ public class CheckingFragment extends Fragment implements EasyPermissions.Permis
Uri selectedImage = result.getData().getData();
if (selectedPosition != -1 && selectedImage != null) {
//imageView.setImageURI(selectedImage);
Log.e("Selected-Image: ", "" + selectedImage);
//Log.e("Selected-Image: ", "" + selectedImage);
uriToByteArrayAsync(
getContext(),
@ -139,13 +138,13 @@ public class CheckingFragment extends Fragment implements EasyPermissions.Permis
}
);
Log.e("contentUri: ", "" + contentUri);
//Log.e("contentUri: ", "" + contentUri);
if (result.getResultCode() == requireActivity().RESULT_OK && result.getData() != null) {
Uri selectedImage = result.getData().getData();
if (selectedImage != null) {
//imageView.setImageURI(selectedImage);
Log.e("Selected-Image: ", "" + selectedImage);
//Log.e("Selected-Image: ", "" + selectedImage);
}
}
});
@ -167,9 +166,9 @@ public class CheckingFragment extends Fragment implements EasyPermissions.Permis
itemList.add(new Item("Safety", 0));*/
//New Implemented------------------
if (Helper.getArrayList("ListChecking", getActivity()) != null) {
if (Helper.getArrayList(Helper.listChecking, getActivity()) != null) {
itemModelList.clear();
itemModelList.addAll(Helper.getArrayList("ListChecking", getActivity()));
itemModelList.addAll(Helper.getArrayList(Helper.listChecking, getActivity()));
Log.e("itemModelList-size: ",""+itemModelList.size());
if (itemModelList != null) {
@ -206,7 +205,7 @@ public class CheckingFragment extends Fragment implements EasyPermissions.Permis
List<ItemModel> updatedItemList = itemModelList; // Or adapter.getItemList()
for (ItemModel item : updatedItemList) {
/*for (ItemModel item : updatedItemList) {
Log.e("AdapterData", "ProcessId: " + item.getProcessId() +
", StepId: " + item.getStepId() +
", SpinnerSelection: " + item.getSelectedOption() +
@ -214,12 +213,11 @@ public class CheckingFragment extends Fragment implements EasyPermissions.Permis
", Percentage: " + item.getPercentage() +
", Remarks: " + item.getRemarks() +
", ImageList: " + item.getImageArrayList());
}
}*/
Helper.saveArrayList(itemModelList, "ListChecking",getActivity());
viewModel.appendToQualityControlItemList(itemModelList);
Helper.saveArrayList(itemModelList, Helper.listChecking,getActivity());
List<ItemModel> updatedItemListP = new ArrayList<>(Helper.getArrayList("ListChecking", getActivity()));
//List<ItemModel> updatedItemListP = new ArrayList<>(Helper.getArrayList("ListChecking", getActivity()));
/* if (etRemarks.getText().toString().isEmpty()) {
Toast.makeText(getActivity(), "Please enter remarks", Toast.LENGTH_SHORT).show();
@ -258,8 +256,6 @@ public class CheckingFragment extends Fragment implements EasyPermissions.Permis
private void initializeLayout(View view) {
viewModel = new ViewModelProvider(requireActivity()).get(QualityControlViewModel.class);
etPercentage = view.findViewById(R.id.et_percentage);
etRemarks = view.findViewById(R.id.et_remarks);
imagePicker = view.findViewById(R.id.image_picker);

View File

@ -74,8 +74,6 @@ public class CuttingFragment extends Fragment implements EasyPermissions.Permiss
String filePath = "no_pic";
ArrayList<byte[]> imageList = new ArrayList<>();
ArrayList<QualityControlProcessStep> qualityControlProcessStepList = new ArrayList<>();
QualityControlResponse qualityControlResponse;
QualityControlViewModel viewModel;
EditText etPercentage, etRemarks;
List<ItemModel> itemModelList = new ArrayList<>();
ItemStepsAdapter adapter;
@ -88,7 +86,7 @@ public class CuttingFragment extends Fragment implements EasyPermissions.Permiss
Uri selectedImage = result.getData().getData();
if (selectedPosition != -1 && selectedImage != null) {
//imageView.setImageURI(selectedImage);
Log.e("Selected-Image: ", "" + selectedImage);
//Log.e("Selected-Image: ", "" + selectedImage);
uriToByteArrayAsync(
getContext(),
@ -142,13 +140,13 @@ public class CuttingFragment extends Fragment implements EasyPermissions.Permiss
}
);
Log.e("contentUri: ", "" + contentUri);
// Log.e("contentUri: ", "" + contentUri);
if (result.getResultCode() == requireActivity().RESULT_OK && result.getData() != null) {
Uri selectedImage = result.getData().getData();
if (selectedImage != null) {
//imageView.setImageURI(selectedImage);
Log.e("Selected-Image: ", "" + selectedImage);
//Log.e("Selected-Image: ", "" + selectedImage);
}
}
});
@ -175,11 +173,11 @@ public class CuttingFragment extends Fragment implements EasyPermissions.Permiss
//New Implemented------------------
Log.e("Check-Cut: ",""+Helper.getArrayList("ListCutting", getActivity()));
if (Helper.getArrayList("ListCutting", getActivity()) != null) {
//Log.e("Check-Cut: ",""+Helper.getArrayList("ListCutting", getActivity()));
if (Helper.getArrayList(Helper.listCutting, getActivity()) != null) {
itemModelList.clear();
itemModelList.addAll(Helper.getArrayList("ListCutting", getActivity()));
Log.e("itemModelList-size: ", "" + itemModelList.size());
itemModelList.addAll(Helper.getArrayList(Helper.listCutting, getActivity()));
//Log.e("itemModelList-size: ", "" + itemModelList.size());
if (itemModelList != null) {
adapter = new ItemStepsAdapter(getActivity(), itemModelList, this);
@ -213,7 +211,7 @@ public class CuttingFragment extends Fragment implements EasyPermissions.Permiss
List<ItemModel> updatedItemList = itemModelList; // Or adapter.getItemList()
for (ItemModel item : updatedItemList) {
/*for (ItemModel item : updatedItemList) {
Log.e("AdapterData", "ProcessId: " + item.getProcessId() +
", StepId: " + item.getStepId() +
", SpinnerSelection: " + item.getSelectedOption() +
@ -221,10 +219,9 @@ public class CuttingFragment extends Fragment implements EasyPermissions.Permiss
", Percentage: " + item.getPercentage() +
", Remarks: " + item.getRemarks() +
", ImageList: " + item.getImageArrayList());
}
}*/
Helper.saveArrayList(itemModelList, "ListCutting", getActivity());
viewModel.appendToQualityControlItemList(itemModelList);
Helper.saveArrayList(itemModelList, Helper.listCutting, getActivity());
/*Log.e("Cutting: ","----------------");
Log.e("Sort: ",""+sharedViewModel.getCuttingSort());
@ -309,8 +306,6 @@ public class CuttingFragment extends Fragment implements EasyPermissions.Permiss
private void initializeLayout(View view) {
viewModel = new ViewModelProvider(requireActivity()).get(QualityControlViewModel.class);
etPercentage = view.findViewById(R.id.et_percentage);
etRemarks = view.findViewById(R.id.et_remarks);
imagePicker = view.findViewById(R.id.image_picker);
@ -563,4 +558,40 @@ public class CuttingFragment extends Fragment implements EasyPermissions.Permiss
.show();
}
public boolean isValidate(int rateCutting, int rateStitching, int rateChecking, int ratePacking, int rateSub) {
boolean returnValue = true;
String message = "";
if (rateSub == 0) {
message = "Please rate SubStore Process.";
returnValue = false;
}
if (ratePacking == 0) {
message = "Please rate Packing Process.";
returnValue = false;
}
if (rateChecking == 0) {
message = "Please rate Checking Process.";
returnValue = false;
}
if (rateStitching == 0) {
message = "Please rate Stitching Process.";
returnValue = false;
}
if (rateCutting == 0) {
message = "Please rate Cutting Process.";
returnValue = false;
}
if (!returnValue) {
Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show();
}
return returnValue;
}
}

View File

@ -34,9 +34,7 @@ import com.utopiaindustries.qualitycontrol.models.Department;
import com.utopiaindustries.qualitycontrol.models.LocationFloor;
import com.utopiaindustries.qualitycontrol.models.LocationSite;
import com.utopiaindustries.qualitycontrol.models.LocationUnit;
import com.utopiaindustries.qualitycontrol.models.QualityControlProcess;
import com.utopiaindustries.qualitycontrol.utils.ProgressDialogFragment;
import com.utopiaindustries.qualitycontrol.utils.QualityControlViewModel;
import com.utopiaindustries.qualitycontrol.viewmodels.LoginViewModel;
import java.text.SimpleDateFormat;
@ -47,7 +45,7 @@ import java.util.Locale;
import java.util.Objects;
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;
TextView txtCurrentDate;
@ -71,7 +69,7 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
RecyclerView recyclerView;
List<Department> filteredList;
private DepartmentItemAdapter departmentItemAdapter;
QualityControlViewModel viewModel;
boolean isFromPrevious = false;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -90,9 +88,9 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
unitTextview.setText("Select Unit");
floorTextview.setText("Select Floor");
viewModel.setLocation(String.valueOf(clickedItem.getId()));
Preference.setMyStringPref(Helper.project_file,Helper.locationSiteId,getActivity(),String.valueOf(clickedItem.getId()));
Preference.setMyStringPref(Helper.project_file,Helper.locationSiteName,getActivity(),String.valueOf(clickedItem.getTitle()));
//viewModel.setLocation(String.valueOf(clickedItem.getId()));
Preference.setMyStringPref(Helper.project_file, Helper.locationSiteId, getActivity(), String.valueOf(clickedItem.getId()));
Preference.setMyStringPref(Helper.project_file, Helper.locationSiteName, getActivity(), String.valueOf(clickedItem.getTitle()));
if (!locationUnitList.isEmpty()) {
List<LocationUnit> filteredUnitItems = locationUnitList.stream()
@ -116,10 +114,10 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
LocationUnit clickedItem = locationUnitListFiltered.get(position);
viewModel.setUnit(String.valueOf(clickedItem.getId()));
Preference.setMyStringPref(Helper.project_file,Helper.unitId,getActivity(),String.valueOf(clickedItem.getId()));
Preference.setMyStringPref(Helper.project_file,Helper.unitName,getActivity(),String.valueOf(clickedItem.getTitle()));
int targetSiteId = Integer.parseInt(Preference.getMyStringPref(Helper.project_file,Helper.locationSiteId,getActivity()));
//viewModel.setUnit(String.valueOf(clickedItem.getId()));
Preference.setMyStringPref(Helper.project_file, Helper.unitId, getActivity(), String.valueOf(clickedItem.getId()));
Preference.setMyStringPref(Helper.project_file, Helper.unitName, getActivity(), String.valueOf(clickedItem.getTitle()));
int targetSiteId = Integer.parseInt(Preference.getMyStringPref(Helper.project_file, Helper.locationSiteId, getActivity()));
//Log.e("SiteId: ",""+targetSiteId);
//Log.e("UnitId: ",""+clickedItem.getId());
@ -144,26 +142,25 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
LocationFloor clickedItem = locationFloorListFiltered.get(position);
viewModel.setFloor(String.valueOf(clickedItem.getId()));
Preference.setMyStringPref(Helper.project_file,Helper.floorId,getActivity(),String.valueOf(clickedItem.getId()));
Preference.setMyStringPref(Helper.project_file,Helper.floorName,getActivity(),String.valueOf(clickedItem.getTitle()));
//viewModel.setFloor(String.valueOf(clickedItem.getId()));
Preference.setMyStringPref(Helper.project_file, Helper.floorId, getActivity(), String.valueOf(clickedItem.getId()));
Preference.setMyStringPref(Helper.project_file, Helper.floorName, getActivity(), String.valueOf(clickedItem.getTitle()));
}
});
nextButton.setOnClickListener(v -> {
if (getActivity() instanceof HomeActivity) {
viewModel.setFromViewModel(true);
String siteID = Preference.getMyStringPref(Helper.project_file,Helper.locationSiteId,getActivity());
String unitId = Preference.getMyStringPref(Helper.project_file,Helper.unitId,getActivity());
String departId = Preference.getMyStringPref(Helper.project_file,Helper.departmentId,getActivity());
String floorId = Preference.getMyStringPref(Helper.project_file,Helper.floorId,getActivity());
Log.e("AdapterData", "siteID: " + siteID +
", unitId: " + unitId +
", departId: " + departId +
", floorId: " + floorId );
//viewModel.setFromViewModel(true);
// Preference.setMyStringPref(Helper.project_file, Helper.InProcess, getActivity(), "true");
String siteID = Preference.getMyStringPref(Helper.project_file, Helper.locationSiteId, getActivity());
String unitId = Preference.getMyStringPref(Helper.project_file, Helper.unitId, getActivity());
String departId = Preference.getMyStringPref(Helper.project_file, Helper.departmentId, getActivity());
String floorId = Preference.getMyStringPref(Helper.project_file, Helper.floorId, getActivity());
Log.e("AdapterData", "siteID: " + siteID + ", unitId: " + unitId +
", departId: " + departId + ", floorId: " + floorId);
if (isValidate(departId,siteID,unitId,floorId)) {
if (isValidate(departId, siteID, unitId, floorId)) {
((HomeActivity) getActivity()).navigateToFragment(new CuttingFragment(), true);
}
@ -174,27 +171,20 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// Do nothing
Log.e("beforeTextChanged: ","------");
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
Log.e("onTextChanged: ","------");
filterList(s.toString());
if (s.length() > 0) {
if (viewModel.isFromViewModel()) {
recyclerView.setVisibility(View.GONE);
}
else {
recyclerView.setVisibility(View.VISIBLE); // Show the list when typing
}
} else {
recyclerView.setVisibility(View.GONE); // Hide when no text is entered
}
}
@Override
public void afterTextChanged(Editable s) {
// Do nothing
Log.e("afterTextChanged: ","------");
}
});
@ -208,7 +198,7 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
public void initializeLayout(View view) {
viewModel = new ViewModelProvider(requireActivity()).get(QualityControlViewModel.class);
//viewModel = new ViewModelProvider(requireActivity()).get(QualityControlViewModel.class);
txtCurrentDate = view.findViewById(R.id.txt_current_date);
locationSiteTextview = view.findViewById(R.id.location_textview);
@ -218,6 +208,7 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
nextButton = view.findViewById(R.id.btn_next);
searchEditText = view.findViewById(R.id.searchEditText);
recyclerView = view.findViewById(R.id.recyclerView);
recyclerView.setVisibility(View.GONE);
@ -225,9 +216,12 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
loginViewModel = new ViewModelProvider(getActivity()).get(LoginViewModel.class);
loginViewModel.getLoadingState().observe(getActivity(), isLoading -> {
//Log.e("HomeFragment: ", "isLoading: ");
if (isLoading != null && isLoading) {
//Log.e("HomeFragment: ", "isLoading:show ");
showProgressDialog();
} else {
//Log.e("HomeFragment: ", "isLoading: dismiss");
dismissProgressDialog();
}
});
@ -240,16 +234,11 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
if (qcResponse != null) {
Helper.setPreferenceObject(getActivity().getApplicationContext(), qcResponse, "qcResponse");
if (!Preference.getMyStringPref(Helper.project_file, Helper.departmentName, getActivity()).equalsIgnoreCase("default")) {
searchEditText.setText(Preference.getMyStringPref(Helper.project_file, Helper.departmentName, getActivity()));
locationSiteTextview.setText(Preference.getMyStringPref(Helper.project_file, Helper.locationSiteName,getActivity()));
unitTextview.setText(Preference.getMyStringPref(Helper.project_file, Helper.unitName, getActivity()));
floorTextview.setText(Preference.getMyStringPref(Helper.project_file, Helper.floorName, getActivity()));
}
if (!qcResponse.getLocationSites().isEmpty()) {
viewModel.setLocationSiteList(qcResponse.getLocationSites());
//viewModel.setLocationSiteList(qcResponse.getLocationSites());
Helper.saveList(qcResponse.getLocationSites(), Helper.homeSite, getActivity());
locationSiteList.addAll(qcResponse.getLocationSites());
@ -260,7 +249,9 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
if (!qcResponse.getDepartments().isEmpty()) {
viewModel.setDepartmentList(qcResponse.getDepartments());
// viewModel.setDepartmentList(qcResponse.getDepartments());
Helper.saveList(qcResponse.getDepartments(), Helper.homeDepartment, getActivity());
departmentList.addAll(qcResponse.getDepartments());
filteredList = new ArrayList<>(departmentList);
@ -271,35 +262,55 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
}
if (!qcResponse.getLocationFloors().isEmpty()) {
viewModel.setFloorList(qcResponse.getLocationFloors());
// viewModel.setFloorList(qcResponse.getLocationFloors());
Helper.saveList(qcResponse.getLocationFloors(), Helper.homeFloor, getActivity());
locationFloorList.addAll(qcResponse.getLocationFloors());
}
if (!qcResponse.getLocationUnits().isEmpty()) {
viewModel.setUnitList(qcResponse.getLocationUnits());
// viewModel.setUnitList(qcResponse.getLocationUnits());
Helper.saveList(qcResponse.getLocationUnits(), Helper.homeUnit, getActivity());
locationUnitList.addAll(qcResponse.getLocationUnits());
}
Preference.setMyStringPref(Helper.project_file, Helper.firstTimeApiCall, getActivity(), "true");
} else {
Toast.makeText(getActivity(), "Fetching Records Failed", Toast.LENGTH_SHORT).show();
}
});
/*if (viewModel.getLocationSiteList().isEmpty()) {
if (Preference.getMyStringPref(Helper.project_file, Helper.firstTimeApiCall, getActivity()).equalsIgnoreCase("false") ||
Preference.getMyStringPref(Helper.project_file, Helper.firstTimeApiCall, getActivity()).equalsIgnoreCase("default")) {
loginViewModel.getQualityControlData();
} else {
if (!Preference.getMyStringPref(Helper.project_file, Helper.departmentName, getActivity()).equalsIgnoreCase("default")) {
searchEditText.setText(Preference.getMyStringPref(Helper.project_file, Helper.departmentName, getActivity()));
isFromPrevious = true;
locationSiteTextview.setText(Preference.getMyStringPref(Helper.project_file, Helper.locationSiteName, getActivity()));
unitTextview.setText(Preference.getMyStringPref(Helper.project_file, Helper.unitName, getActivity()));
floorTextview.setText(Preference.getMyStringPref(Helper.project_file, Helper.floorName, getActivity()));
}
else {
departmentList.clear();
locationSiteList.clear();
locationUnitList.clear();
locationFloorList.clear();
//location list
locationSiteList.addAll(viewModel.getLocationSiteList());
Log.e("locationSiteList-size: ",""+locationSiteList.size());
//locationSiteList.addAll(viewModel.getLocationSiteList());
locationSiteList.addAll(Helper.getList(Helper.homeSite, getActivity(), LocationSite.class));
Log.e("locationSiteList-size: ", "" + locationSiteList.size());
locationSitesAdapter = new LocationSitesAdapter(getActivity(), locationSiteList);
locationSiteTextview.setAdapter(locationSitesAdapter);
//department list
departmentList.addAll(viewModel.getDepartmentList());
Log.e("departmentList-size: ",""+departmentList.size());
//departmentList.addAll(viewModel.getDepartmentList());
departmentList.addAll(Helper.getList(Helper.homeDepartment, getActivity(), Department.class));
Log.e("departmentList-size: ", "" + departmentList.size());
//filteredList = new ArrayList<>(departmentList);
filteredList = new ArrayList<>(departmentList);
// Set up RecyclerView
departmentItemAdapter = new DepartmentItemAdapter(filteredList, this, searchEditText, recyclerView);
@ -307,40 +318,35 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
recyclerView.setAdapter(departmentItemAdapter);
//unit list
locationUnitList.addAll(viewModel.getUnitList());
Log.e("locationUnitList-size: ",""+locationUnitList.size());
//locationUnitList.addAll(viewModel.getUnitList());
locationUnitList.addAll(Helper.getList(Helper.homeUnit, getActivity(), LocationUnit.class));
Log.e("locationUnitList-size: ", "" + locationUnitList.size());
//floor list
locationFloorList.addAll(viewModel.getFloorList());
Log.e("locationFloorList-size: ",""+locationFloorList.size());
//locationFloorList.addAll(viewModel.getFloorList());
locationFloorList.addAll(Helper.getList(Helper.homeFloor, getActivity(), LocationFloor.class));
Log.e("locationFloorList-size: ", "" + locationFloorList.size());
recyclerView.setVisibility(View.GONE);
}*/
}
}
@Override
public void onResume() {
super.onResume();
Log.e("onResume: ","HomeFragment");
departmentList.clear();
locationSiteList.clear();
locationUnitList.clear();
locationFloorList.clear();
loginViewModel.getQualityControlData();
}
public void showProgressDialog() {
ProgressDialogFragment progressDialog = new ProgressDialogFragment();
progressDialog.setCancelable(false);
progressDialog.show(getActivity().getSupportFragmentManager(), "progressDialog");
progressDialog.show(requireActivity().getSupportFragmentManager(), "progressDialog");
}
public void dismissProgressDialog() {
ProgressDialogFragment progressDialog = (ProgressDialogFragment)
getActivity().getSupportFragmentManager().findFragmentByTag("progressDialog");
requireActivity().getSupportFragmentManager().findFragmentByTag("progressDialog");
if (progressDialog != null) {
progressDialog.dismiss();
}
@ -353,7 +359,7 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
// Hide the RecyclerView when there's no query
recyclerView.setVisibility(View.GONE);
} else {
// Show RecyclerView when there's a query
recyclerView.setVisibility(View.VISIBLE);
for (Department item : departmentList) {
@ -363,16 +369,21 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
}
}
departmentItemAdapter.notifyDataSetChanged();
if (isFromPrevious) {
isFromPrevious = false;
recyclerView.setVisibility(View.GONE);
}
}
}
@Override
public void onItemClick(Department item) {
//Toast.makeText(getActivity(), "Selected: " + item.getTitle(), Toast.LENGTH_SHORT).show();
viewModel.setDepartmentId(item.getId());
Preference.setMyStringPref(Helper.project_file,Helper.departmentId,getActivity(),String.valueOf(item.getId()));
Preference.setMyStringPref(Helper.project_file,Helper.departmentName,getActivity(),String.valueOf(item.getTitle()));
//viewModel.setDepartmentId(item.getId());
Preference.setMyStringPref(Helper.project_file, Helper.departmentId, getActivity(), String.valueOf(item.getId()));
Preference.setMyStringPref(Helper.project_file, Helper.departmentName, getActivity(), String.valueOf(item.getTitle()));
}
public boolean isValidate(String departId, String siteId, String unitId, String floorId) {
@ -400,7 +411,7 @@ public class HomeFragment extends Fragment implements DepartmentItemAdapter.OnIt
}
if (!returnValue) {
Toast.makeText(getActivity(),message,Toast.LENGTH_SHORT).show();
Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show();
}
return returnValue;

View File

@ -74,7 +74,6 @@ public class PackingFragment extends Fragment implements EasyPermissions.Permiss
ArrayList<byte[]> imageList = new ArrayList<>();
EditText etPercentage, etRemarks;
QualityControlViewModel viewModel;
List<ItemModel> itemModelList = new ArrayList<>();
ItemStepsAdapter adapter;
private int selectedPosition = -1;
@ -86,7 +85,7 @@ public class PackingFragment extends Fragment implements EasyPermissions.Permiss
Uri selectedImage = result.getData().getData();
if (selectedPosition != -1 && selectedImage != null) {
//imageView.setImageURI(selectedImage);
Log.e("Selected-Image: ", "" + selectedImage);
//Log.e("Selected-Image: ", "" + selectedImage);
uriToByteArrayAsync(
getContext(),
@ -140,13 +139,13 @@ public class PackingFragment extends Fragment implements EasyPermissions.Permiss
}
);
Log.e("contentUri: ", "" + contentUri);
//Log.e("contentUri: ", "" + contentUri);
if (result.getResultCode() == requireActivity().RESULT_OK && result.getData() != null) {
Uri selectedImage = result.getData().getData();
if (selectedImage != null) {
//imageView.setImageURI(selectedImage);
Log.e("Selected-Image: ", "" + selectedImage);
//Log.e("Selected-Image: ", "" + selectedImage);
}
}
});
@ -168,10 +167,10 @@ public class PackingFragment extends Fragment implements EasyPermissions.Permiss
itemList.add(new Item("Safety", 0));*/
//New Implemented------------------
if (Helper.getArrayList("ListPacking", getActivity()) != null) {
if (Helper.getArrayList(Helper.listPacking, getActivity()) != null) {
itemModelList.clear();
itemModelList.addAll(Helper.getArrayList("ListPacking", getActivity()));
Log.e("itemModelList-size: ",""+itemModelList.size());
itemModelList.addAll(Helper.getArrayList(Helper.listPacking, getActivity()));
//Log.e("itemModelList-size: ",""+itemModelList.size());
if (itemModelList != null) {
adapter = new ItemStepsAdapter(getActivity(), itemModelList,this);
@ -220,7 +219,7 @@ public class PackingFragment extends Fragment implements EasyPermissions.Permiss
List<ItemModel> updatedItemList = itemModelList; // Or adapter.getItemList()
for (ItemModel item : updatedItemList) {
/*for (ItemModel item : updatedItemList) {
Log.e("AdapterData", "ProcessId: " + item.getProcessId() +
", StepId: " + item.getStepId() +
", SpinnerSelection: " + item.getSelectedOption() +
@ -228,12 +227,11 @@ public class PackingFragment extends Fragment implements EasyPermissions.Permiss
", Percentage: " + item.getPercentage() +
", Remarks: " + item.getRemarks() +
", ImageList: " + item.getImageArrayList());
}
}*/
Helper.saveArrayList(itemModelList, "ListPacking",getActivity());
viewModel.appendToQualityControlItemList(itemModelList);
Helper.saveArrayList(itemModelList, Helper.listPacking,getActivity());
List<ItemModel> updatedItemListP = new ArrayList<>(Helper.getArrayList("ListPacking", getActivity()));
//List<ItemModel> updatedItemListP = new ArrayList<>(Helper.getArrayList("ListPacking", getActivity()));
/*if (etRemarks.getText().toString().isEmpty()) {
Toast.makeText(getActivity(), "Please enter remarks", Toast.LENGTH_SHORT).show();
@ -259,8 +257,6 @@ public class PackingFragment extends Fragment implements EasyPermissions.Permiss
private void initializeLayout(View view) {
viewModel = new ViewModelProvider(requireActivity()).get(QualityControlViewModel.class);
etPercentage = view.findViewById(R.id.et_percentage);
etRemarks = view.findViewById(R.id.et_remarks);
imagePicker = view.findViewById(R.id.image_picker);

View File

@ -76,7 +76,6 @@ public class StitchingFragment extends Fragment implements EasyPermissions.Permi
ArrayList<byte[]> imageList = new ArrayList<>();
EditText etPercentage, etRemarks;
QualityControlViewModel viewModel;
List<ItemModel> itemModelList = new ArrayList<>();
ItemStepsAdapter adapter;
private int selectedPosition = -1;
@ -88,7 +87,7 @@ public class StitchingFragment extends Fragment implements EasyPermissions.Permi
Uri selectedImage = result.getData().getData();
if (selectedPosition != -1 && selectedImage != null) {
//imageView.setImageURI(selectedImage);
Log.e("Selected-Image: ", "" + selectedImage);
//Log.e("Selected-Image: ", "" + selectedImage);
uriToByteArrayAsync(
getContext(),
@ -142,13 +141,13 @@ public class StitchingFragment extends Fragment implements EasyPermissions.Permi
}
);
Log.e("contentUri: ", "" + contentUri);
//Log.e("contentUri: ", "" + contentUri);
if (result.getResultCode() == requireActivity().RESULT_OK && result.getData() != null) {
Uri selectedImage = result.getData().getData();
if (selectedImage != null) {
//imageView.setImageURI(selectedImage);
Log.e("Selected-Image: ", "" + selectedImage);
//Log.e("Selected-Image: ", "" + selectedImage);
}
}
});
@ -167,10 +166,10 @@ public class StitchingFragment extends Fragment implements EasyPermissions.Permi
recyclerView.setAdapter(adapter);*/
//New Implemented------------------
if (Helper.getArrayList("ListStitching", getActivity()) != null) {
if (Helper.getArrayList(Helper.listStitching, getActivity()) != null) {
itemModelList.clear();
itemModelList.addAll(Helper.getArrayList("ListStitching", getActivity()));
Log.e("itemModelList-size: ",""+itemModelList.size());
itemModelList.addAll(Helper.getArrayList(Helper.listStitching, getActivity()));
//Log.e("itemModelList-size: ",""+itemModelList.size());
if (itemModelList != null) {
adapter = new ItemStepsAdapter(getActivity(), itemModelList, this);
@ -219,7 +218,7 @@ public class StitchingFragment extends Fragment implements EasyPermissions.Permi
List<ItemModel> updatedItemList = itemModelList; // Or adapter.getItemList()
for (ItemModel item : updatedItemList) {
/*for (ItemModel item : updatedItemList) {
Log.e("AdapterData", "ProcessId: " + item.getProcessId() +
", StepId: " + item.getStepId() +
", SpinnerSelection: " + item.getSelectedOption() +
@ -227,12 +226,11 @@ public class StitchingFragment extends Fragment implements EasyPermissions.Permi
", Percentage: " + item.getPercentage() +
", Remarks: " + item.getRemarks() +
", ImageList: " + item.getImageArrayList());
}
}*/
Helper.saveArrayList(itemModelList, "ListStitching",getActivity());
viewModel.appendToQualityControlItemList(itemModelList);
Helper.saveArrayList(itemModelList, Helper.listStitching,getActivity());
List<ItemModel> updatedItemListP = new ArrayList<>(Helper.getArrayList("ListStitching", getActivity()));
//List<ItemModel> updatedItemListP = new ArrayList<>(Helper.getArrayList("ListStitching", getActivity()));
/*if (etRemarks.getText().toString().isEmpty()) {
@ -259,7 +257,7 @@ public class StitchingFragment extends Fragment implements EasyPermissions.Permi
private void initializeLayout(View view) {
viewModel = new ViewModelProvider(requireActivity()).get(QualityControlViewModel.class);
//viewModel = new ViewModelProvider(requireActivity()).get(QualityControlViewModel.class);
etPercentage = view.findViewById(R.id.et_percentage);
etRemarks = view.findViewById(R.id.et_remarks);

View File

@ -43,10 +43,8 @@ import com.utopiaindustries.qualitycontrol.helper.Helper;
import com.utopiaindustries.qualitycontrol.helper.Preference;
import com.utopiaindustries.qualitycontrol.utils.ImageSelectionListener;
import com.utopiaindustries.qualitycontrol.utils.ProgressDialogFragment;
import com.utopiaindustries.qualitycontrol.utils.QualityControlViewModel;
import com.utopiaindustries.qualitycontrol.viewmodels.HomeViewModel;
import com.utopiaindustries.qualitycontrol.viewmodels.ItemModel;
import com.utopiaindustries.qualitycontrol.viewmodels.LoginViewModel;
import com.utopiaindustries.qualitycontrol.viewmodels.QualityControl;
import java.io.ByteArrayOutputStream;
@ -55,7 +53,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@ -80,7 +77,7 @@ public class SubStoreFragment extends Fragment implements EasyPermissions.Permis
ArrayList<byte[]> imageList = new ArrayList<>();
EditText etPercentage, etRemarks;
QualityControlViewModel viewModel;
//QualityControlViewModel viewModel;
List<ItemModel> itemModelList = new ArrayList<>();
ItemStepsAdapter adapter;
private int selectedPosition = -1;
@ -151,7 +148,7 @@ public class SubStoreFragment extends Fragment implements EasyPermissions.Permis
Uri selectedImage = result.getData().getData();
if (selectedImage != null) {
//imageView.setImageURI(selectedImage);
Log.e("Selected-Image: ", "" + selectedImage);
// Log.e("Selected-Image: ", "" + selectedImage);
}
}
});
@ -173,29 +170,27 @@ public class SubStoreFragment extends Fragment implements EasyPermissions.Permis
itemList.add(new Item("Safety", 0));*/
//New Implemented------------------
if (Helper.getArrayList("ListSubStore", getActivity()) != null) {
if (Helper.getArrayList(Helper.listSubStore, getActivity()) != null) {
itemModelList.clear();
itemModelList.addAll(Helper.getArrayList("ListSubStore", getActivity()));
Log.e("itemModelList-size: ",""+itemModelList.size());
itemModelList.addAll(Helper.getArrayList(Helper.listSubStore, getActivity()));
//Log.e("itemModelList-size: ",""+itemModelList.size());
if (itemModelList != null) {
adapter = new ItemStepsAdapter(getActivity(), itemModelList, this);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setAdapter(adapter);
}
else {
} else {
for (int i = 1; i < 7; i++) {
itemModelList.add(new ItemModel(5,i,0,"0","",0, null, null));
itemModelList.add(new ItemModel(5, i, 0, "0", "", 0, null, null));
}
adapter = new ItemStepsAdapter(getActivity(), itemModelList, this);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setAdapter(adapter);
}
}
else {
} else {
for (int i = 1; i < 7; i++) {
itemModelList.add(new ItemModel(5,i,0,"0","",0, null, null));
itemModelList.add(new ItemModel(5, i, 0, "0", "", 0, null, null));
}
adapter = new ItemStepsAdapter(getActivity(), itemModelList, this);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
@ -225,35 +220,6 @@ public class SubStoreFragment extends Fragment implements EasyPermissions.Permis
startActivity(intent);
getActivity().finish();*/
List<ItemModel> updatedItemList = itemModelList; // Or adapter.getItemList()
for (ItemModel item : updatedItemList) {
Log.e("AdapterData", "ProcessId: " + item.getProcessId() +
", StepId: " + item.getStepId() +
", SpinnerSelection: " + item.getSelectedOption() +
", Rating: " + item.getRating() +
", Percentage: " + item.getPercentage() +
", Remarks: " + item.getRemarks() +
", ImageList: " + item.getImageArrayList());
}
Helper.saveArrayList(itemModelList, "ListSubStore",getActivity());
viewModel.appendToQualityControlItemList(itemModelList);
int siteID = Integer.parseInt(Preference.getMyStringPref(Helper.project_file,Helper.locationSiteId,getActivity()));
int unitId = Integer.parseInt(Preference.getMyStringPref(Helper.project_file,Helper.unitId,getActivity()));
int departId = Integer.parseInt(Preference.getMyStringPref(Helper.project_file,Helper.departmentId,getActivity()));
int floorId = Integer.parseInt(Preference.getMyStringPref(Helper.project_file,Helper.floorId,getActivity()));
List<ItemModel> tempList = new ArrayList<>();
tempList.addAll(Helper.getArrayList("ListCutting",getActivity()));
tempList.addAll(Helper.getArrayList("ListStitching",getActivity()));
tempList.addAll(Helper.getArrayList("ListChecking",getActivity()));
tempList.addAll(Helper.getArrayList("ListPacking",getActivity()));
tempList.addAll(Helper.getArrayList("ListSubStore",getActivity()));
QualityControl qualityControl = new QualityControl(siteID,unitId,departId,floorId,tempList);
/*Log.e("AdapterData", "siteID: " + siteID +
", unitId: " + unitId +
", departId: " + departId +
@ -272,7 +238,47 @@ public class SubStoreFragment extends Fragment implements EasyPermissions.Permis
", Image: " + Arrays.toString(item.getImageUri()));
}*/
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
builder.setTitle("Are you sure to save Report?")
.setItems(new String[]{"Yes", "Cancel"}, (dialog, which) -> {
if (which == 0) {
List<ItemModel> updatedItemList = itemModelList; // Or adapter.getItemList()
/*for (ItemModel item : updatedItemList) {
Log.e("AdapterData", "ProcessId: " + item.getProcessId() +
", StepId: " + item.getStepId() +
", SpinnerSelection: " + item.getSelectedOption() +
", Rating: " + item.getRating() +
", Percentage: " + item.getPercentage() +
", Remarks: " + item.getRemarks() +
", ImageList: " + item.getImageArrayList());
}*/
Helper.saveArrayList(itemModelList, Helper.listSubStore, getActivity());
//viewModel.appendToQualityControlItemList(itemModelList);
int siteID = Integer.parseInt(Preference.getMyStringPref(Helper.project_file, Helper.locationSiteId, getActivity()));
int unitId = Integer.parseInt(Preference.getMyStringPref(Helper.project_file, Helper.unitId, getActivity()));
int departId = Integer.parseInt(Preference.getMyStringPref(Helper.project_file, Helper.departmentId, getActivity()));
int floorId = Integer.parseInt(Preference.getMyStringPref(Helper.project_file, Helper.floorId, getActivity()));
List<ItemModel> tempList = new ArrayList<>();
tempList.addAll(Helper.getArrayList(Helper.listCutting, getActivity()));
tempList.addAll(Helper.getArrayList(Helper.listStitching, getActivity()));
tempList.addAll(Helper.getArrayList(Helper.listChecking, getActivity()));
tempList.addAll(Helper.getArrayList(Helper.listPacking, getActivity()));
tempList.addAll(Helper.getArrayList(Helper.listSubStore, getActivity()));
String generatedBy = Preference.getMyStringPref(Helper.project_file,Helper.logInUser,getActivity());
QualityControl qualityControl = new QualityControl(generatedBy, siteID, unitId, departId, floorId, tempList);
homeViewModel.saveQualityControlData(qualityControl);
} else {
dialog.dismiss();
}
})
.show();
});
@ -286,7 +292,7 @@ public class SubStoreFragment extends Fragment implements EasyPermissions.Permis
private void initializeLayout(View view) {
viewModel = new ViewModelProvider(requireActivity()).get(QualityControlViewModel.class);
//viewModel = new ViewModelProvider(requireActivity()).get(QualityControlViewModel.class);
homeViewModel = new ViewModelProvider(requireActivity()).get(HomeViewModel.class);
etPercentage = view.findViewById(R.id.et_percentage);
@ -317,11 +323,35 @@ public class SubStoreFragment extends Fragment implements EasyPermissions.Permis
homeViewModel.getUserLiveData().observe(getActivity(), qcResponse -> {
if (qcResponse != null) {
Log.e("qcResponse: ",""+qcResponse);
Log.e("","Status: " + qcResponse.getStatus() + "Message: " + qcResponse.getMessage() + "Percentage: " + qcResponse.getOverAllPercentage());
/*getActivity().finish();
/*Log.e("qcResponse: ", "" + qcResponse);
Log.e("","Status: " + qcResponse.getStatus() + " Message: " + qcResponse.getMessage() + " Percentage: " + qcResponse.getOverAllPercentage());
Log.e("","Cut: " + qcResponse.getCutting() + " Stitch: " + qcResponse.getStiching() + " Check: " + qcResponse.getChecking());
Log.e("","Pack: " + qcResponse.getPacking() + " Substore: " + qcResponse.getSub_Store());*/
Preference.remove(Helper.project_file, Helper.departmentId, getActivity());
Preference.remove(Helper.project_file, Helper.departmentName, getActivity());
Preference.remove(Helper.project_file, Helper.locationSiteId, getActivity());
Preference.remove(Helper.project_file, Helper.locationSiteName, getActivity());
Preference.remove(Helper.project_file, Helper.unitId, getActivity());
Preference.remove(Helper.project_file, Helper.unitName, getActivity());
Preference.remove(Helper.project_file, Helper.floorId, getActivity());
Preference.remove(Helper.project_file, Helper.floorName, getActivity());
Helper.RemoveArrayList(Helper.listCutting,getActivity());
Helper.RemoveArrayList(Helper.listStitching,getActivity());
Helper.RemoveArrayList(Helper.listChecking,getActivity());
Helper.RemoveArrayList(Helper.listPacking,getActivity());
Helper.RemoveArrayList(Helper.listSubStore,getActivity());
//Preference.setMyStringPref(Helper.project_file, Helper.InProcess, getActivity(), "false");
getActivity().finish();
Intent intent = new Intent(getActivity(), SummaryActivity.class);
startActivity(intent);*/
intent.putExtra("Percentage", qcResponse.getOverAllPercentage());
intent.putExtra("Summary", qcResponse);
startActivity(intent);
}
});
}
@ -560,11 +590,11 @@ public class SubStoreFragment extends Fragment implements EasyPermissions.Permis
public void showProgressDialog() {
ProgressDialogFragment progressDialog = new ProgressDialogFragment();
progressDialog.setCancelable(false);
progressDialog.show(getActivity().getSupportFragmentManager(), "progressDialog");
progressDialog.show(requireActivity().getSupportFragmentManager(), "progressDialog");
}
public void dismissProgressDialog() {
ProgressDialogFragment progressDialog = (ProgressDialogFragment) getActivity().getSupportFragmentManager().findFragmentByTag("progressDialog");
ProgressDialogFragment progressDialog = (ProgressDialogFragment) requireActivity().getSupportFragmentManager().findFragmentByTag("progressDialog");
if (progressDialog != null) {
progressDialog.dismiss();
}

View File

@ -6,6 +6,7 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import androidx.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@ -29,6 +30,22 @@ public class Helper {
public static final String floorId = "floorId";
public static final String floorName = "floorName";
public static final String listCutting = "ListCutting";
public static final String listStitching = "ListStitching";
public static final String listChecking = "ListChecking";
public static final String listPacking = "ListPacking";
public static final String listSubStore = "ListSubStore";
public static final String homeSite = "Sites";
public static final String homeDepartment = "Departments";
public static final String homeUnit = "Units";
public static final String homeFloor = "Floors";
public static final String firstTimeApiCall = "isFirstTimeApiCall";
public static final String InProcess = "InProcess";
public static final String logInUser = "LogInUser";
public static boolean isValidEmail(CharSequence target) {
return !TextUtils.isEmpty(target) && android.util.Patterns.EMAIL_ADDRESS.matcher(target).matches();
}
@ -83,4 +100,40 @@ public class Helper {
Type type = new TypeToken<ArrayList<ItemModel>>() {}.getType();
return gson.fromJson(json, type);
}
static public void RemoveArrayList(String key, Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (prefs.contains(key)) { // Check if the key exists
SharedPreferences.Editor editor = prefs.edit();
editor.remove(key); // Remove the key-value pair
editor.apply(); // Apply changes
Log.e("SharedPreferences", "Key '" + key + "' removed successfully.");
} else {
Log.e("SharedPreferences", "Key '" + key + "' does not exist.");
}
}
//for department, site, unit, floor
public static <T> void saveList(List<T> list, String key, Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = prefs.edit();
Gson gson = new Gson();
String json = gson.toJson(list); // Convert the list to JSON
editor.putString(key, json);
editor.apply(); // Save to SharedPreferences
}
public static <T> List<T> getList(String key, Context context, Class<T> clazz) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
// Check if the key exists
if (!prefs.contains(key)) {
return new ArrayList<>(); // Return an empty list if the key doesn't exist
}
Gson gson = new Gson();
String json = prefs.getString(key, null);
Type type = TypeToken.getParameterized(ArrayList.class, clazz).getType(); // Use the provided class type
return gson.fromJson(json, type); // Convert JSON back to the list
}
}

View File

@ -3,9 +3,10 @@ package com.utopiaindustries.qualitycontrol.models;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.List;
public class QualitySaveResponse {
public class QualitySaveResponse implements Serializable {
@SerializedName("overAllPercentage")
@Expose
@ -19,6 +20,26 @@ public class QualitySaveResponse {
@Expose
private String message;
@SerializedName("Cutting")
@Expose
private String Cutting;
@SerializedName("Stiching")
@Expose
private String Stiching;
@SerializedName("Checking")
@Expose
private String Checking;
@SerializedName("Packing")
@Expose
private String Packing;
@SerializedName("Sub Store")
@Expose
private String Sub_Store;
public String getOverAllPercentage() {
return overAllPercentage;
}
@ -42,4 +63,44 @@ public class QualitySaveResponse {
public void setMessage(String message) {
this.message = message;
}
public String getCutting() {
return Cutting;
}
public void setCutting(String cutting) {
Cutting = cutting;
}
public String getStiching() {
return Stiching;
}
public void setStiching(String stiching) {
Stiching = stiching;
}
public String getChecking() {
return Checking;
}
public void setChecking(String checking) {
Checking = checking;
}
public String getPacking() {
return Packing;
}
public void setPacking(String packing) {
Packing = packing;
}
public String getSub_Store() {
return Sub_Store;
}
public void setSub_Store(String sub_Store) {
Sub_Store = sub_Store;
}
}

View File

@ -47,10 +47,10 @@ public class HomeViewModel extends ViewModel {
apiService.saveQualityControlReport(qualityControl).enqueue(new Callback<QualitySaveResponse>() {
@Override
public void onResponse(Call<QualitySaveResponse> call, Response<QualitySaveResponse> response) {
Log.e("onResponse: ",""+response);
//Log.e("onResponse: ",""+response);
isLoading.setValue(false);
if (response.isSuccessful() && response.body() != null) {
Log.e("onResponse-success: ",""+response);
//Log.e("onResponse-success: ",""+response);
userLiveData.setValue(response.body());
} else {
errorLiveData.setValue(response.message());
@ -59,7 +59,7 @@ public class HomeViewModel extends ViewModel {
@Override
public void onFailure(Call<QualitySaveResponse> call, Throwable t) {
Log.e("onResponse-fail: ",""+t.getMessage());
//Log.e("onResponse-fail: ",""+t.getMessage());
isLoading.setValue(false);
errorLiveData.setValue(t.getMessage());
}

View File

@ -1,5 +1,8 @@
package com.utopiaindustries.qualitycontrol.viewmodels;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
@ -15,6 +18,7 @@ import retrofit2.Response;
public class LoginViewModel extends ViewModel {
private MutableLiveData<QualityControlResponse> userLiveData;
private MutableLiveData<Boolean> userLoginLiveData;
private MutableLiveData<String> errorLiveData;
private MutableLiveData<Boolean> isLoading;
private ApiService apiService;
@ -22,6 +26,7 @@ public class LoginViewModel extends ViewModel {
public LoginViewModel() {
apiService = ApiServiceFactory.getApiService();
userLiveData = new MutableLiveData<>();
userLoginLiveData = new MutableLiveData<>();
errorLiveData = new MutableLiveData<>();
isLoading = new MutableLiveData<>();
}
@ -41,11 +46,13 @@ public class LoginViewModel extends ViewModel {
public void getQualityControlData() {
isLoading.setValue(true);
apiService.isUserAuthenticated().enqueue(new Callback<QualityControlResponse>() {
apiService.getQualityControlData().enqueue(new Callback<QualityControlResponse>() {
@Override
public void onResponse(Call<QualityControlResponse> call, Response<QualityControlResponse> response) {
isLoading.setValue(false);
if (response.isSuccessful() && response.body() != null) {
Log.e("onResponse: ", "Successful");
userLiveData.setValue(response.body());
} else {
errorLiveData.setValue(response.message());
@ -54,12 +61,41 @@ public class LoginViewModel extends ViewModel {
@Override
public void onFailure(Call<QualityControlResponse> call, Throwable t) {
Log.e("onResponse: ", "Fail");
isLoading.setValue(false);
errorLiveData.setValue(t.getMessage());
}
});
}
public void isUserAuthenticated(String username, String password, String[] roles) {
isLoading.setValue(true);
apiService.isUserAuthenticated(username, password, roles).enqueue(new Callback<Boolean>() {
@Override
public void onResponse(@NonNull Call<Boolean> call, @NonNull Response<Boolean> response) {
isLoading.setValue(false);
Log.e("onResponse-1: ", "Successful: "+response);
if (response.isSuccessful() && response.body() != null) {
Log.e("onResponse-2: ", "Successful: "+response);
userLoginLiveData.setValue(response.body());
} else {
userLoginLiveData.setValue(false);
}
}
@Override
public void onFailure(@NonNull Call<Boolean> call, @NonNull Throwable t) {
Log.e("onResponse-2: ", "failed"+t.getMessage());
isLoading.setValue(false);
errorLiveData.setValue(t.getMessage());
}
});
}
public LiveData<Boolean> getLoginUser() {
return userLoginLiveData;
}
public LiveData<QualityControlResponse> getUser() {
return userLiveData;
}

View File

@ -4,13 +4,15 @@ import java.util.List;
public class QualityControl {
private String generatedBy;
private int siteId;
private int unitId;
private int departmentId;
private int floorId;
private List<ItemModel> qualityControlItemList;
public QualityControl(int siteId, int floorId, int departmentId, int unitId, List<ItemModel> qualityControlItemList) {
public QualityControl(String generatedBy, int siteId, int floorId, int departmentId, int unitId, List<ItemModel> qualityControlItemList) {
this.generatedBy = generatedBy;
this.siteId = siteId;
this.qualityControlItemList = qualityControlItemList;
this.floorId = floorId;
@ -21,6 +23,14 @@ public class QualityControl {
public QualityControl() {
}
public String getGeneratedBy() {
return generatedBy;
}
public void setGeneratedBy(String generatedBy) {
this.generatedBy = generatedBy;
}
public int getSiteId() {
return siteId;
}

View File

@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#D3D3D3" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<path android:fillColor="@android:color/white" android:pathData="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM20,8l-8,5 -8,-5L4,6l8,5 8,-5v2z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:autoMirrored="true" android:height="24dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<path android:fillColor="@android:color/white" android:pathData="M17,7l-1.41,1.41L18.17,11H8v2h10.17l-2.58,2.58L17,17l5,-5zM4,5h8V3H4c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h8v-2H4V5z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<path android:fillColor="@android:color/white" android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM15.1,8L8.9,8L8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2z"/>
</vector>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white" />
<stroke
android:width="2dp"
android:color="@color/white" />
<corners android:radius="10dp" />
<padding
android:bottom="0dp"
android:left="0dp"
android:right="0dp"
android:top="0dp" />
</shape>

View File

@ -5,6 +5,7 @@
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".activities.HomeActivity">
<androidx.appcompat.widget.Toolbar
@ -22,7 +23,7 @@
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Quality Control"
android:text="5S App"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp"
app:layout_constraintBottom_toBottomOf="@+id/toolbar"
@ -60,4 +61,14 @@
android:text="Next" />-->
</LinearLayout>
<ImageView
android:id="@+id/img_logout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
app:layout_constraintBottom_toBottomOf="@+id/toolbar"
app:layout_constraintEnd_toEndOf="@+id/toolbar"
app:layout_constraintTop_toTopOf="@+id/toolbar"
app:srcCompat="@drawable/ic_logout" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:background="@color/white"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.LoginActivity">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:layout_marginTop="50dp"
android:layout_marginEnd="1dp"
android:background="@color/grey_100"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="150dp"
android:layout_height="100dp"
android:layout_marginBottom="20dp"
android:src="@drawable/search" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginBottom="20dp"
android:padding="5dp"
android:text="Login Now to Continue"
android:textSize="@dimen/_17sdp" />
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<EditText
android:id="@+id/tf_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:drawableStart="@drawable/ic_email"
android:drawablePadding="5dp"
android:drawableTint="@color/grey_700"
android:hint="User"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp">
<EditText
android:id="@+id/tf_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:drawableStart="@drawable/ic_password"
android:drawablePadding="5dp"
android:drawableTint="@color/grey_700"
android:hint="Password"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/btn_login"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="@drawable/rounded_btn_login"
android:padding="10dp"
android:text="Login"
android:textSize="@dimen/_15sdp"
android:textColor="@color/white"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -5,6 +5,7 @@
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".activities.SplashActivity">
<ImageView

View File

@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:background="@color/white"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.SummaryActivity">
@ -41,4 +42,158 @@
app:layout_constraintTop_toTopOf="@+id/toolbar"
app:srcCompat="@drawable/arrow_back" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="30dp"
android:padding="5dp"
android:text="Overall Percentage"
android:textSize="@dimen/_13sdp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView12" />
<TextView
android:id="@+id/txt_percentage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginEnd="16dp"
android:padding="5dp"
android:text="TextView"
android:textSize="@dimen/_13sdp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txt_substore_percentage" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:text="Cutting %"
android:textSize="@dimen/_13sdp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
<TextView
android:id="@+id/txt_cutting_percentage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="15dp"
android:text="TextView"
android:textSize="@dimen/_13sdp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:textSize="@dimen/_13sdp"
android:textStyle="bold"
android:layout_marginTop="15dp"
android:text="Stitching %"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView3" />
<TextView
android:id="@+id/txt_stitching_percentage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginEnd="15dp"
android:textSize="@dimen/_13sdp"
android:text="TextView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txt_cutting_percentage" />
<TextView
android:id="@+id/txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:textSize="@dimen/_13sdp"
android:textStyle="bold"
android:layout_marginTop="15dp"
android:text="Checking %"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView5" />
<TextView
android:id="@+id/txt_checking_percentage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginEnd="15dp"
android:textSize="@dimen/_13sdp"
android:text="TextView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txt_stitching_percentage" />
<TextView
android:id="@+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:textSize="@dimen/_13sdp"
android:textStyle="bold"
android:layout_marginTop="15dp"
android:text="Packing %"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txt" />
<TextView
android:id="@+id/txt_packing_percentage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginEnd="15dp"
android:textSize="@dimen/_13sdp"
android:text="TextView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txt_checking_percentage" />
<TextView
android:id="@+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="15dp"
android:textSize="@dimen/_13sdp"
android:textStyle="bold"
android:text="SubStore %"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView10" />
<TextView
android:id="@+id/txt_substore_percentage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:textSize="@dimen/_13sdp"
android:layout_marginEnd="15dp"
android:text="TextView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txt_packing_percentage" />
<View
android:id="@+id/divider"
android:layout_width="409dp"
android:layout_height="1dp"
android:layout_marginTop="21dp"
android:layout_marginBottom="8dp"
android:background="?android:attr/listDivider"
app:layout_constraintBottom_toTopOf="@+id/textView2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView12" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:layout_gravity="center">
<LinearLayout

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/rounded_white"
android:orientation="vertical"
android:paddingTop="15dp">
<TextView
android:id="@+id/message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:gravity="center_horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="Are you sure you want to sign out?"
android:textAllCaps="false"
android:textColor="@color/black"
android:textSize="15sp"
android:textStyle="normal" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginTop="7dp"
android:background="@color/grey_400" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<TextView
android:id="@+id/dialogCancelBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.495"
android:gravity="center"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:text="No"
android:textAllCaps="false"
android:textColor="@color/theme_color"
android:textSize="16sp"
android:textStyle="normal" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.009"
android:background="@color/grey_400"
android:paddingTop="15dp"
android:paddingBottom="15dp" />
<TextView
android:id="@+id/dialogOkBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.495"
android:gravity="center"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:text="Yes"
android:textAllCaps="false"
android:textColor="@color/theme_color"
android:textSize="16sp"
android:textStyle="normal" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".fragments.CheckingFragment">
<ScrollView
@ -133,6 +134,7 @@
android:layout_marginEnd="15dp"
android:layout_marginBottom="5dp"
android:layout_gravity="bottom"
android:textColor="@color/white"
android:background="@drawable/rounded_btn_login"
android:text="Next"/>

View File

@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".fragments.CuttingFragment">
<ScrollView
@ -135,6 +136,7 @@
android:layout_marginEnd="15dp"
android:layout_marginBottom="5dp"
android:layout_gravity="bottom"
android:textColor="@color/white"
android:background="@drawable/rounded_btn_login"
android:text="Next"/>
</FrameLayout>

View File

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".fragments.HomeFragment">
<LinearLayout
@ -161,6 +162,7 @@
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="5dp"
android:textColor="@color/white"
android:background="@drawable/rounded_btn_login"
android:text="Next" />
</FrameLayout>

View File

@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".fragments.PackingFragment">
<ScrollView
@ -133,6 +134,7 @@
android:layout_marginEnd="15dp"
android:layout_marginBottom="5dp"
android:layout_gravity="bottom"
android:textColor="@color/white"
android:background="@drawable/rounded_btn_login"
android:text="Next"/>

View File

@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".fragments.StitchingFragment">
<ScrollView
@ -133,6 +134,7 @@
android:layout_marginEnd="15dp"
android:layout_marginBottom="5dp"
android:layout_gravity="bottom"
android:textColor="@color/white"
android:background="@drawable/rounded_btn_login"
android:text="Next"/>

View File

@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".fragments.SubStoreFragment">
<ScrollView
@ -133,6 +134,7 @@
android:layout_marginEnd="15dp"
android:layout_marginBottom="5dp"
android:layout_gravity="bottom"
android:textColor="@color/white"
android:background="@drawable/rounded_btn_login"
android:text="Finish"/>

View File

@ -1,7 +1,27 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.QualityControlApp" parent="Theme.Material3.DayNight.NoActionBar">
<style name="Base.Theme.QualityControlApp" parent="Theme.Material3.Light.NoActionBar">
<!-- Customize your dark theme here. -->
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
<!-- Primary brand color. -->
<item name="colorPrimary">@color/theme_color</item>
<item name="colorPrimaryVariant">@color/theme_color</item>
<item name="colorOnPrimary">@color/theme_color</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/theme_color</item>
<item name="colorSecondaryVariant">@color/theme_color</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
<!--<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>-->
</style>
<style name="Theme.QualityControlApp" parent="Base.Theme.QualityControlApp" />
</resources>

View File

@ -1,5 +1,5 @@
<resources>
<string name="app_name">QualityControl</string>
<string name="app_name">5S App</string>
<string name="app_version">Version 1.0</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>

View File

@ -1,8 +1,25 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.QualityControlApp" parent="Theme.Material3.DayNight.NoActionBar">
<style name="Base.Theme.QualityControlApp" parent="Theme.Material3.Light.NoActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
<!-- Primary brand color. -->
<item name="colorPrimary">@color/theme_color</item>
<item name="colorPrimaryVariant">@color/theme_color</item>
<item name="colorOnPrimary">@color/theme_color</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/theme_color</item>
<item name="colorSecondaryVariant">@color/theme_color</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
<!--<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>-->
</style>
<style name="Theme.QualityControlApp" parent="Base.Theme.QualityControlApp" />