From 688165eaad6a359ea83d415181e352bd6a31d7ef Mon Sep 17 00:00:00 2001 From: Mariya Date: Wed, 20 Mar 2024 17:46:07 +0530 Subject: [PATCH] changes made for dropdownlist for pq , for iocl 122 version added, for E command , RS AND RC changed to ES and EC --- app/build.gradle | 6 +- .../assurance/AssuranceControlsFragment.kt | 66 +++++++++++++------ .../presentation/hemocube/HemoCubeFragment.kt | 2 +- .../layout/fragment_assurance_controls.xml | 4 +- 4 files changed, 53 insertions(+), 25 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index cd7356b..e6cc89a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,11 +16,11 @@ android { // dev -> development, quality -> qc, uat -> User Acceptance Testing, preprod -> preproduction, prod -> production, iocl -> iocl-iisc production defaultConfig { - applicationId "in.sminnovations.hpostesting.dev" + applicationId "in.sminnovations.hpostesting.iocl" minSdk 21 targetSdk 34 - versionCode 121 - versionName "2.1.121" + versionCode 122 + versionName "2.1.122" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/example/hpostesting/presentation/assurance/AssuranceControlsFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/assurance/AssuranceControlsFragment.kt index 293ee12..135acac 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/assurance/AssuranceControlsFragment.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/assurance/AssuranceControlsFragment.kt @@ -26,6 +26,7 @@ import android.widget.AdapterView import android.widget.ArrayAdapter import android.widget.Spinner import android.widget.Toast +import androidx.core.view.isVisible import androidx.fragment.app.Fragment import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.constant.Constants @@ -58,7 +59,7 @@ class AssuranceControlsFragment : Fragment() { private fun initViews() { // binding.btnSubmit.visibility = View.GONE val solutionSpinner: Spinner = binding.spinnerSolutions - val solutionOptions = arrayOf("Select solution", "Tartrazine", "Acid Red") + val solutionOptions = arrayOf("Select solution", "Tartrazine", "Acid Red","Sickle-Cert-Buffer", "1 Abs Holo Filter", "0.25 Abs Holo Filter", "Air Blank") val solutionAdapter = ArrayAdapter(requireContext(), R.layout.simple_spinner_item, solutionOptions) solutionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) @@ -70,9 +71,27 @@ class AssuranceControlsFragment : Fragment() { position: Int, id: Long, ) { - val selectedValue: String = solutionOptions[position] - if (!selectedValue.equals("Select solution")) { - DataHolder.hemoCubeTestData!!.solution = selectedValue + val selectedSolution: String = solutionOptions[position] + if (selectedSolution != "Select solution") { + DataHolder.hemoCubeTestData!!.solution = selectedSolution + + // Update visibility and name based on selected solution + if(selectedSolution == "Tartrazine" || selectedSolution == "Acid Red"){ + activity?.runOnUiThread { + binding.spinnerConcentration.visibility = View.VISIBLE + // Ensure the name is updated only after concentration is selected. + // You might need to adjust this logic based on how and when you want to update the name. + // For now, it simply shows that the visibility is being handled. + } + } else { + activity?.runOnUiThread { + binding.spinnerConcentration.visibility = View.GONE + } + } + } else { + activity?.runOnUiThread { + binding.spinnerConcentration.visibility = View.GONE + } } } @@ -184,17 +203,26 @@ class AssuranceControlsFragment : Fragment() { val selectedadminOption = binding.spinnerAdmin.selectedItem.toString() // Check if any of the selections are default values -// if (selectedSolution == "Select solution") { -// Toast.makeText(requireContext(), "Please select a solution", Toast.LENGTH_LONG).show() -// return@setOnClickListener // Prevent further execution -// } -// -// if (selectedConcentration == "Select concentration") { -// Toast.makeText(requireContext(), "Please select a concentration", Toast.LENGTH_LONG).show() -// return@setOnClickListener // Prevent further execution -// } + if (selectedSolution == "Select solution") { + Toast.makeText(requireContext(), "Please select a solution", Toast.LENGTH_LONG).show() + return@setOnClickListener // Prevent further execution + }else{ + DataHolder.hemoCubeTestData!!.name = selectedSolution + } - if (selectedadminOption == "Select options") { + if (selectedConcentration == "Select concentration" && binding.spinnerConcentration.isVisible) { + Toast.makeText(requireContext(), "Please select a concentration", Toast.LENGTH_LONG).show() + return@setOnClickListener // Prevent further execution + }else if(binding.spinnerConcentration.isVisible){ + DataHolder.hemoCubeTestData!!.name = "$selectedSolution $selectedConcentration" + }else{ + DataHolder.hemoCubeTestData!!.name = selectedSolution + } + + + + + if (selectedadminOption == "Select options" && binding.spinnerAdmin.isVisible) { Toast.makeText(requireContext(), "Please select a option", Toast.LENGTH_LONG).show() return@setOnClickListener // Prevent further execution } @@ -208,11 +236,11 @@ class AssuranceControlsFragment : Fragment() { DataHolder.hemoCubeTestData!!.solution = binding.spinnerSolutions.selectedItem.toString() DataHolder.hemoCubeTestData!!.concentration = binding.spinnerConcentration.selectedItem.toString() DataHolder.hemoCubeTestData!!.filter = binding.spinnerAdmin.selectedItem.toString() - if(binding.spinnerAdmin.selectedItem.toString().equals("Select options")){ - Toast.makeText(requireContext(), "Please select a option", Toast.LENGTH_LONG).show() - }else { - DataHolder.hemoCubeTestData!!.name = DataHolder.hemoCubeTestData!!.filter.toString() - } +// if(binding.spinnerAdmin.selectedItem.toString().equals("Select options") && binding.spinnerAdmin.isVisible){ +// Toast.makeText(requireContext(), "Please select a option", Toast.LENGTH_LONG).show() +// }else { +// DataHolder.hemoCubeTestData!!.name = DataHolder.hemoCubeTestData!!.filter.toString() +// } diff --git a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt index 59a9964..53a5011 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt @@ -463,7 +463,7 @@ class HemoCubeFragment : Fragment() { fetchResult() } //#EC for v0 and v1 and #RC for v2 - (resultData.contains("#RC") && this.testStatusCode < TestStatus.EPROM_ADC_RETRIEVAL_COMPLETED.code) -> { + (resultData.contains("#EC") && this.testStatusCode < TestStatus.EPROM_ADC_RETRIEVAL_COMPLETED.code) -> { this.testStatusCode = TestStatus.EPROM_ADC_RETRIEVAL_COMPLETED.code hemoCubeViewModel.messages.postValue("EPROM ADC Loaded") //checkCuvettePresence() diff --git a/app/src/main/res/layout/fragment_assurance_controls.xml b/app/src/main/res/layout/fragment_assurance_controls.xml index 609d9cb..db8c249 100644 --- a/app/src/main/res/layout/fragment_assurance_controls.xml +++ b/app/src/main/res/layout/fragment_assurance_controls.xml @@ -52,7 +52,7 @@