new 125 version, changes in HemoCubeFragment Ip address in home, led1Average at line 1004 change if condition, in home download csv for all.
This commit is contained in:
@@ -138,6 +138,7 @@ class HomeFragment : Fragment() {
|
|||||||
viewModel.allUserData.observe(viewLifecycleOwner) { userData ->
|
viewModel.allUserData.observe(viewLifecycleOwner) { userData ->
|
||||||
deleteIncompleteRegistrations(userData)
|
deleteIncompleteRegistrations(userData)
|
||||||
}
|
}
|
||||||
|
getLocationIP()
|
||||||
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userData ->
|
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userData ->
|
||||||
deleteHemoCubeIncompleteRegistrations(userData)
|
deleteHemoCubeIncompleteRegistrations(userData)
|
||||||
if (userData.isNotEmpty()) {
|
if (userData.isNotEmpty()) {
|
||||||
@@ -192,25 +193,26 @@ class HomeFragment : Fragment() {
|
|||||||
//// showUploadDialog(requireContext())
|
//// showUploadDialog(requireContext())
|
||||||
// }
|
// }
|
||||||
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userData ->
|
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userData ->
|
||||||
if (sharedPreference.getString(Constants.USER_ID, "").toString() == "ADMIN") {
|
// if (sharedPreference.getString(Constants.USER_ID, "").toString() == "ADMIN") {
|
||||||
val btnSaveLocalVisibility =
|
//
|
||||||
if (userData.any { it.testStatus == true }) View.VISIBLE else View.GONE
|
// }else{
|
||||||
binding.downloadCSV.visibility = btnSaveLocalVisibility
|
// binding.downloadCSV.visibility = View.GONE
|
||||||
binding.downloadCSV.setOnClickListener {
|
// }
|
||||||
if (btnSaveLocalVisibility == View.VISIBLE) {
|
val btnSaveLocalVisibility =
|
||||||
// Execute the action when the button is visible (testStatus is true for at least one user)
|
if (userData.any { it.testStatus == true }) View.VISIBLE else View.GONE
|
||||||
showDownloadDialog(requireContext())
|
binding.downloadCSV.visibility = btnSaveLocalVisibility
|
||||||
} else {
|
binding.downloadCSV.setOnClickListener {
|
||||||
// Handle the case when the button is not visible
|
if (btnSaveLocalVisibility == View.VISIBLE) {
|
||||||
Toast.makeText(
|
// Execute the action when the button is visible (testStatus is true for at least one user)
|
||||||
requireContext(),
|
showDownloadDialog(requireContext())
|
||||||
"No test details stored locally",
|
} else {
|
||||||
Toast.LENGTH_SHORT
|
// Handle the case when the button is not visible
|
||||||
).show()
|
Toast.makeText(
|
||||||
}
|
requireContext(),
|
||||||
|
"No test details stored locally",
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
binding.downloadCSV.visibility = View.GONE
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,6 +258,18 @@ class HomeFragment : Fragment() {
|
|||||||
checkNetworkStatus()
|
checkNetworkStatus()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private fun getLocationIP() {
|
||||||
|
getPublicIpAddr { ipAddress ->
|
||||||
|
if(ipAddress != "fail"){
|
||||||
|
DataHolder.ipAddress = ipAddress
|
||||||
|
with(sharedPreference.edit()) {
|
||||||
|
putString(Constants.IP_ADDRESS, ipAddress)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.P)
|
@RequiresApi(Build.VERSION_CODES.P)
|
||||||
private fun checkNetworkStatus() {
|
private fun checkNetworkStatus() {
|
||||||
hemoCubeViewModel.networkStatusLiveData.observe(viewLifecycleOwner) { isConnected ->
|
hemoCubeViewModel.networkStatusLiveData.observe(viewLifecycleOwner) { isConnected ->
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
|
|
||||||
if (isBufferValueAvailable()){
|
if (isBufferValueAvailable()){
|
||||||
hemoCubeViewModel.messages.postValue("Ready to test")
|
hemoCubeViewModel.messages.postValue("Ready to test")
|
||||||
|
isUsingExistingBuffer = true
|
||||||
binding.btnPlacebuffer.apply {
|
binding.btnPlacebuffer.apply {
|
||||||
setBackgroundColor(Color.GREEN) // Set button background color to green
|
setBackgroundColor(Color.GREEN) // Set button background color to green
|
||||||
text = "Refresh Buffer" // Change button text to "Buffer Exists"
|
text = "Refresh Buffer" // Change button text to "Buffer Exists"
|
||||||
@@ -997,7 +998,19 @@ class HemoCubeFragment : Fragment() {
|
|||||||
//used for latest trueheme and v1
|
//used for latest trueheme and v1
|
||||||
val deviceRatio = led2Average / led1Average
|
val deviceRatio = led2Average / led1Average
|
||||||
val borderlineMetric = (led1Average - led2Average) / deviceRatio
|
val borderlineMetric = (led1Average - led2Average) / deviceRatio
|
||||||
|
// activity?.runOnUiThread {
|
||||||
|
// Toast.makeText(requireContext(),"led1Average: $led1Average, led2Average: $led2Average",Toast.LENGTH_LONG).show()
|
||||||
|
// }
|
||||||
|
if(led1Average < 0 || led2Average < 0){
|
||||||
|
hemoCubeViewModel.messages.postValue("Negative Absorbance - Repeat test with reading Buffer first and sample second")
|
||||||
|
this.testStatusCode = TestStatus.BUFFER_PRINT_COMPLETED.code
|
||||||
|
binding.testing.visibility = View.GONE
|
||||||
|
binding.btnPlacebuffer.visibility = View.GONE
|
||||||
|
binding.btnSamplestart.visibility = View.VISIBLE
|
||||||
|
binding.btnSamplestart.isClickable = true
|
||||||
|
binding.btnSamplestart.isEnabled = true
|
||||||
|
return
|
||||||
|
}
|
||||||
if(Constants.ABS_FLAGS_ENABLED){
|
if(Constants.ABS_FLAGS_ENABLED){
|
||||||
val inRange2mmLed1: Boolean
|
val inRange2mmLed1: Boolean
|
||||||
val inRange2mmLed2: Boolean
|
val inRange2mmLed2: Boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user