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 2226011..cd52b4d 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 @@ -190,14 +190,14 @@ class UserListAdapter( // } } userCard.setOnClickListener { -// if (batLevel < 40) { -// Toast.makeText( -// view.context, -// "Battery level is low than 40%, please charge the device to continue testing", -// Toast.LENGTH_SHORT -// ).show() -// return@setOnClickListener -// } + if (batLevel < 40) { + Toast.makeText( + view.context, + "Battery level is low than 40%, please charge the device to continue testing", + Toast.LENGTH_SHORT + ).show() + return@setOnClickListener + } if (model.testStatus != null) { if (model.testStatus!!) { Toast.makeText( diff --git a/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt index df738e3..1a6995f 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt @@ -137,10 +137,10 @@ class HomeFragment : Fragment() { val dateFormat = SimpleDateFormat("yyyy-MM-dd") val currentDate = Date() val formattedDate = dateFormat.format(currentDate) -// val query = Firebase.firestore.collection("patientData") -// .whereGreaterThanOrEqualTo("createdAt", formattedDate) -// .orderBy("createdAt", Query.Direction.DESCENDING) - val query = Firebase.firestore.collection("patientData").whereEqualTo("testStatus", false) + val query = Firebase.firestore.collection("patientData") + .whereGreaterThanOrEqualTo("createdAt", formattedDate) + .orderBy("createdAt", Query.Direction.DESCENDING) +// val query = Firebase.firestore.collection("patientData").whereEqualTo("testStatus", false) query.get().addOnSuccessListener { if (it.documents.isEmpty()) { binding.pendingTest.visibility = View.VISIBLE 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 0075450..ffe65e8 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 @@ -106,13 +106,10 @@ class HemoCubeFragment : Fragment() { } else { activity?.runOnUiThread { binding.tvSubtitle4.visibility = View.VISIBLE -// binding.tvSubtitle4.text = "Buffer Started" } - checkAndStartProcess() - it.visibility = View.GONE } - + it.visibility = View.GONE } } @@ -319,7 +316,6 @@ class HemoCubeFragment : Fragment() { stringData.contains("#SC") -> { binding.tvSubtitle4.text = "Sample Completed" - binding.btnSubmit.visibility = View.VISIBLE fetchResult() testingTrace.stop() } @@ -446,12 +442,12 @@ class HemoCubeFragment : Fragment() { apply() } } - activity?.runOnUiThread { - binding.btnSubmit.visibility = View.VISIBLE + activity?.runOnUiThread { + binding.btnSubmit.visibility = View.VISIBLE + } binding.btnSubmit.isEnabled = true binding.btnSubmit.isClickable = true binding.clParent.setBackgroundColor(Color.parseColor("#edfffd")) - } } } catch (e: Exception) { Toast.makeText(