diff --git a/app/src/main/java/com/example/hpostesting/presentation/adapter/UserListAdapter.kt b/app/src/main/java/com/example/hpostesting/presentation/adapter/UserListAdapter.kt
index 780dfc1..53c65c8 100644
--- a/app/src/main/java/com/example/hpostesting/presentation/adapter/UserListAdapter.kt
+++ b/app/src/main/java/com/example/hpostesting/presentation/adapter/UserListAdapter.kt
@@ -53,7 +53,7 @@ class UserListAdapter(
userName.text = "Name: ${model.name}"
userId.text = "User ID:${model._id}"
if (model.incubationTime == "") {
- btnStartIncubation.visibility = View.VISIBLE
+// btnStartIncubation.visibility = View.VISIBLE
} else {
userId.text =
"User ID:${model._id} \n Time: ${isBetween15And30Minutes(model.incubationTime)} \n Started at: ${
@@ -106,7 +106,11 @@ class UserListAdapter(
val document = userdata.documents[0]
db.collection("patientData")
.document(document.id)
- .update("bloodGroup", bloodGroup)
+ .update("bloodGroup", bloodGroup,
+ "incubationTime", SimpleDateFormat(
+ "yyyy-MM-dd HH:mm:ss", Locale.getDefault()
+ ).format(Calendar.getInstance().time).toString()
+ )
.addOnSuccessListener {
Toast.makeText(
context,
@@ -151,25 +155,25 @@ class UserListAdapter(
}
btnStartIncubation.setOnClickListener {
- it.visibility = View.GONE
- Firebase.firestore.collection("patientData").whereEqualTo("_id", model._id).get()
- .addOnSuccessListener { data ->
- if (data.documents.isNotEmpty()) {
- data.documents.forEach { userData ->
- Firebase.firestore.collection("patientData").document(userData.id)
- .update(
- "incubationTime", SimpleDateFormat(
- "yyyy-MM-dd HH:mm:ss", Locale.getDefault()
- ).format(Calendar.getInstance().time).toString()
- ).addOnSuccessListener {
- Toast.makeText(
- view.context, "Incubation started", Toast.LENGTH_SHORT
- ).show()
- startListening()
- }
- }
- }
- }
+// it.visibility = View.GONE
+// Firebase.firestore.collection("patientData").whereEqualTo("_id", model._id).get()
+// .addOnSuccessListener { data ->
+// if (data.documents.isNotEmpty()) {
+// data.documents.forEach { userData ->
+// Firebase.firestore.collection("patientData").document(userData.id)
+// .update(
+// "incubationTime", SimpleDateFormat(
+// "yyyy-MM-dd HH:mm:ss", Locale.getDefault()
+// ).format(Calendar.getInstance().time).toString()
+// ).addOnSuccessListener {
+// Toast.makeText(
+// view.context, "Incubation started", Toast.LENGTH_SHORT
+// ).show()
+// startListening()
+// }
+// }
+// }
+// }
}
userCard.setOnClickListener {
if (batLevel < 40) {
diff --git a/app/src/main/java/com/example/hpostesting/presentation/buffercheck/HemoCubeBufferCheckFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/buffercheck/HemoCubeBufferCheckFragment.kt
index e8fb957..6cd5d8e 100644
--- a/app/src/main/java/com/example/hpostesting/presentation/buffercheck/HemoCubeBufferCheckFragment.kt
+++ b/app/src/main/java/com/example/hpostesting/presentation/buffercheck/HemoCubeBufferCheckFragment.kt
@@ -51,9 +51,9 @@ class HemoCubeBufferCheckFragment : Fragment() {
}
private fun initViews() {
- binding.btnKit.visibility = View.GONE
+// binding.btnKit.visibility = View.GONE
binding.btnSubmit.visibility = View.GONE
- binding.etBloodGroup.visibility = View.GONE
+// binding.etBloodGroup.visibility = View.GONE
listenToHemoCube()
startBufferProcess()
}
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 5e5c261..87ef90d 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
@@ -64,25 +64,25 @@ class HemoCubeFragment : Fragment() {
}
private fun initViews() {
- binding.btnSubmit.setOnClickListener {
- val bloodGroupText = binding.etBloodGroup.text.toString()
- if (bloodGroupText.isEmpty()) {
- binding.etBloodGroup.error = "Please enter your blood group"
- } else {
- activity?.runOnUiThread {
- binding.progressBar.visibility = View.VISIBLE
- }
- hemoCubeViewModel.uploadHemoCubeResultToDatabase(
- isOnline, true, sharedPreferences.getString(Constants.KIT_NUMBER, "")
- )
- }
- }
- if (isTestOngoing) {
- binding.btnKit.visibility = View.GONE
- binding.btnKit.isEnabled = false
- binding.btnKit.isClickable = false
-
- }
+// binding.btnSubmit.setOnClickListener {
+// val bloodGroupText = binding.etBloodGroup.text.toString()
+// if (bloodGroupText.isEmpty()) {
+// binding.etBloodGroup.error = "Please enter your blood group"
+// } else {
+// activity?.runOnUiThread {
+// binding.progressBar.visibility = View.VISIBLE
+// }
+// hemoCubeViewModel.uploadHemoCubeResultToDatabase(
+// isOnline, true, sharedPreferences.getString(Constants.KIT_NUMBER, "")
+// )
+// }
+// }
+// if (isTestOngoing) {
+// binding.btnKit.visibility = View.GONE
+// binding.btnKit.isEnabled = false
+// binding.btnKit.isClickable = false
+//
+// }
binding.btnSubmit.isEnabled = false
binding.btnSubmit.isClickable = false
@@ -90,70 +90,70 @@ class HemoCubeFragment : Fragment() {
binding.tvName.text = "Name: ${testDetails?.name}\n ID: ${testDetails?._id}"
Log.e("nametext",binding.tvName.text.toString())
- binding.btnKit.setOnClickListener {
- if (isTestOngoing) {
- val title = "WARNING"
- val message = "There is a on going test, do you want to stop it"
- val negativeText = getString(R.string.no)
- val positiveText = "Yes"
-
- UIUtils.createAlertDialog(requireContext(),
- title,
- message,
- negativeText,
- positiveText,
- object : MyDialogListener {
- override fun onClickNegativeButton() {
-
- }
-
- override fun onClickPositiveButton() {
- resetKitCount()
- val intent = Intent(context, KitScanActivity::class.java)
- startActivity(intent)
- (activity as HemocubeActivity).finish()
- }
- })
- } else {
- resetKitCount()
- val intent = Intent(context, KitScanActivity::class.java)
- startActivity(intent)
- (activity as HemocubeActivity).finish()
- }
- }
+// binding.btnKit.setOnClickListener {
+// if (isTestOngoing) {
+// val title = "WARNING"
+// val message = "There is a on going test, do you want to stop it"
+// val negativeText = getString(R.string.no)
+// val positiveText = "Yes"
+//
+// UIUtils.createAlertDialog(requireContext(),
+// title,
+// message,
+// negativeText,
+// positiveText,
+// object : MyDialogListener {
+// override fun onClickNegativeButton() {
+//
+// }
+//
+// override fun onClickPositiveButton() {
+// resetKitCount()
+// val intent = Intent(context, KitScanActivity::class.java)
+// startActivity(intent)
+// (activity as HemocubeActivity).finish()
+// }
+// })
+// } else {
+// resetKitCount()
+// val intent = Intent(context, KitScanActivity::class.java)
+// startActivity(intent)
+// (activity as HemocubeActivity).finish()
+// }
+// }
}
- private suspend fun checkBloodGroup() {
- binding.apply {
- val bloodGroup = etBloodGroup.text.toString()
- if (bloodGroup.isEmpty()) {
- etBloodGroup.error = "Please enter your blood group"
- } else {
- val db: FirebaseFirestore = Firebase.firestore
- val userdata = db.collection("patientData")
- .whereEqualTo("_id", hemoCubeViewModel.testDetails?._id).get().await()
- if (userdata.documents.isNotEmpty()) {
- db.collection("patientData").document(userdata.documents[0].id)
- .update("bloodGroup", bloodGroup)
- withContext(Dispatchers.Main) {
- val i = Intent(
- requireContext().applicationContext, DashboardActivity::class.java
- )
- startActivity(i)
- (activity as HemocubeActivity).finish()
- }
- }
- }
- }
- }
+// private suspend fun checkBloodGroup() {
+// binding.apply {
+// val bloodGroup = etBloodGroup.text.toString()
+// if (bloodGroup.isEmpty()) {
+// etBloodGroup.error = "Please enter your blood group"
+// } else {
+// val db: FirebaseFirestore = Firebase.firestore
+// val userdata = db.collection("patientData")
+// .whereEqualTo("_id", hemoCubeViewModel.testDetails?._id).get().await()
+// if (userdata.documents.isNotEmpty()) {
+// db.collection("patientData").document(userdata.documents[0].id)
+// .update("bloodGroup", bloodGroup)
+// withContext(Dispatchers.Main) {
+// val i = Intent(
+// requireContext().applicationContext, DashboardActivity::class.java
+// )
+// startActivity(i)
+// (activity as HemocubeActivity).finish()
+// }
+// }
+// }
+// }
+// }
private fun observeViewModel() {
hemoCubeViewModel.fireBaseUpload.observe(viewLifecycleOwner) { result ->
if (result == "Success") {
showToast("Test Results Uploaded Successfully")
- lifecycleScope.launch {
- checkBloodGroup()
- }
+// lifecycleScope.launch {
+// checkBloodGroup()
+// }
}
if (result == "Local") {
showToast("Internet not available, test details stored locally")
@@ -176,7 +176,7 @@ class HemoCubeFragment : Fragment() {
val coefficient1 = coefficients[0]
val coefficient2 = coefficients[1]
val result = coefficient1 * coefficient2
- showToast("coefficients: $coefficient1, $coefficient2")
+// showToast("coefficients: $coefficient1, $coefficient2")
}
}
isOnline = isNetworkAvailable
diff --git a/app/src/main/res/layout/fragment_hemo_cube_reference.xml b/app/src/main/res/layout/fragment_hemo_cube_reference.xml
index dcf4f6c..3bfd5f9 100644
--- a/app/src/main/res/layout/fragment_hemo_cube_reference.xml
+++ b/app/src/main/res/layout/fragment_hemo_cube_reference.xml
@@ -109,40 +109,40 @@
android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@id/til_blood_group" />
+ app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" />
-
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+