Merge branch 'Homocube' into 'CrashIssues'
# Conflicts: # app/build.gradle # app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt # app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt # app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt
This commit is contained in:
@@ -72,6 +72,8 @@ dependencies {
|
||||
implementation 'com.google.android.things:androidthings:1.0'
|
||||
implementation 'com.google.firebase:firebase-appdistribution:16.0.0-beta10'
|
||||
implementation("com.google.firebase:firebase-appdistribution-api-ktx:16.0.0-beta10")
|
||||
|
||||
|
||||
// Testing
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
|
||||
@@ -55,6 +55,7 @@ class DashboardActivity : AppCompatActivity() {
|
||||
return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp()
|
||||
}
|
||||
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
// Copy and paste this into any part of your app - for example, in your main
|
||||
@@ -79,4 +80,6 @@ class DashboardActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -99,6 +99,7 @@ class HomeFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
private fun loadUserData() {
|
||||
// val query = Firebase.firestore.collection("patientData").whereEqualTo("testStatus", false).orderBy("createdAt", Query.Direction.DESCENDING)
|
||||
val query = Firebase.firestore.collection("patientData").whereEqualTo("testStatus", false)
|
||||
query.get().addOnSuccessListener {
|
||||
if (it.documents.isEmpty()) {
|
||||
|
||||
@@ -59,7 +59,7 @@ class HemoCubeFragment : Fragment() {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
initViews()
|
||||
observeViewModel()
|
||||
checkAndStartProcess()
|
||||
// checkAndStartProcess()
|
||||
}
|
||||
|
||||
private fun initViews() {
|
||||
@@ -80,6 +80,17 @@ class HemoCubeFragment : Fragment() {
|
||||
binding.btnSubmit.isEnabled = false
|
||||
binding.btnSubmit.isClickable = false
|
||||
|
||||
|
||||
binding.btnSamplestart.setOnClickListener {
|
||||
startSampleProcess()
|
||||
it.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.btnPlacebuffer.setOnClickListener {
|
||||
checkAndStartProcess()
|
||||
it.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.btnKit.setOnClickListener {
|
||||
if (isTestOngoing) {
|
||||
val title = "WARNING"
|
||||
@@ -158,6 +169,8 @@ class HemoCubeFragment : Fragment() {
|
||||
|
||||
hemoCubeViewModel.deviceData.observe(viewLifecycleOwner) {
|
||||
currentDeviceData = it
|
||||
// showToast(calculateRatio(0.17).toString())
|
||||
|
||||
}
|
||||
|
||||
hemoCubeViewModel.networkStatusLiveData.observe(viewLifecycleOwner) { isNetworkAvailable ->
|
||||
@@ -186,12 +199,12 @@ class HemoCubeFragment : Fragment() {
|
||||
}
|
||||
|
||||
private fun checkAndStartProcess() {
|
||||
if (isBufferValueAvailable()) {
|
||||
showBufferAlertDialog()
|
||||
} else {
|
||||
listenToHemoCube()
|
||||
startBufferProcess()
|
||||
}
|
||||
// if (isBufferValueAvailable()) {
|
||||
// showBufferAlertDialog()
|
||||
// } else {
|
||||
listenToHemoCube()
|
||||
startBufferProcess()
|
||||
// }
|
||||
}
|
||||
|
||||
private fun isBufferValueAvailable(): Boolean {
|
||||
@@ -272,7 +285,12 @@ class HemoCubeFragment : Fragment() {
|
||||
when {
|
||||
stringData.contains("ERROR 500") -> showError500Dialog()
|
||||
stringData.contains("ERROR 501") -> showError501Dialog()
|
||||
stringData.contains("#Buffer Completed") -> showStartSampleDialog()
|
||||
stringData.contains("#Buffer Completed") ->
|
||||
activity?.runOnUiThread {
|
||||
binding.btnSamplestart.visibility = View.VISIBLE
|
||||
binding.btnSamplestart.isClickable = true
|
||||
}
|
||||
|
||||
stringData.contains("#Sample Completed") -> {
|
||||
activity?.runOnUiThread {
|
||||
binding.btnSubmit.isEnabled = true
|
||||
@@ -375,7 +393,7 @@ class HemoCubeFragment : Fragment() {
|
||||
override fun onClickNegativeButton() {}
|
||||
|
||||
override fun onClickPositiveButton() {
|
||||
|
||||
startSampleProcess()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -58,6 +58,40 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_subtitle3" />
|
||||
|
||||
|
||||
|
||||
|
||||
<Button
|
||||
android:visibility="gone"
|
||||
android:id="@+id/btn_samplestart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:clickable="false"
|
||||
android:text="@string/Start_Sample"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/til_blood_group" />
|
||||
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_placebuffer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:clickable="false"
|
||||
android:text="@string/place_buffer"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_submit" />
|
||||
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_submit"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -69,8 +103,7 @@
|
||||
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/btn_samplestart" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/til_blood_group"
|
||||
|
||||
@@ -112,6 +112,8 @@
|
||||
<string name="sickle_cert">Sickle Cert</string>
|
||||
<string name="sickle_find">Sickle Find</string>
|
||||
<string name="submit">Submit</string>
|
||||
<string name="place_buffer">Start Buffer</string>
|
||||
<string name="Start_Sample">Start Sample</string>
|
||||
<string name="new_kit">New Kit</string>
|
||||
<string name="new_buffer">New Buffer</string>
|
||||
<string name="name_error_2">Invalid character, Allowed characters are Letters, Numbers and ( ) _ - , . only</string>
|
||||
|
||||
Reference in New Issue
Block a user