Compare commits
10 Commits
Bloodgroup
...
Bufferchec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac2bb91648 | ||
|
|
9db8e962d7 | ||
|
|
497a61c16b | ||
|
|
acd9262dfe | ||
|
|
f8ac0e81ce | ||
|
|
5a7a09817f | ||
|
|
ab09c659b9 | ||
|
|
14c15bb9ab | ||
|
|
0ca4083c16 | ||
|
|
662e2644f2 |
@@ -0,0 +1,19 @@
|
|||||||
|
package com.example.hpostesting.data.model.patient
|
||||||
|
|
||||||
|
data class BufferCheckData(
|
||||||
|
var kitno: String = "",
|
||||||
|
var deviceId: String? = "",
|
||||||
|
var appVersion:String? = "",
|
||||||
|
var deviceSerialNumber: String = "",
|
||||||
|
var deviceType: String = "HEMOCUBE",
|
||||||
|
var resultData: String = "",
|
||||||
|
var led1Buffer: Double? = null,
|
||||||
|
var led2Buffer: Double? = null,
|
||||||
|
var led1Sample: Double? = null,
|
||||||
|
var led2Sample: Double? = null,
|
||||||
|
var led1Average: Double? = null,
|
||||||
|
var led2Average: Double? = null,
|
||||||
|
var deviceRatio: Double? = null,
|
||||||
|
var calculatedRatio: Double? = null,
|
||||||
|
var classificationResult: String = ""
|
||||||
|
)
|
||||||
@@ -1,25 +1,19 @@
|
|||||||
package com.example.hpostesting.data.repository
|
package com.example.hpostesting.data.repository
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.room.Room
|
|
||||||
import com.example.hpostesting.data.dao.MyDatabase
|
|
||||||
import com.example.hpostesting.data.model.PendingUploads
|
import com.example.hpostesting.data.model.PendingUploads
|
||||||
import com.example.hpostesting.data.model.Response
|
import com.example.hpostesting.data.model.Response
|
||||||
|
import com.example.hpostesting.data.model.patient.BufferCheckData
|
||||||
import com.example.hpostesting.data.model.patient.DeviceData
|
import com.example.hpostesting.data.model.patient.DeviceData
|
||||||
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||||
import com.example.hpostesting.data.model.patient.UserData
|
import com.example.hpostesting.data.model.patient.UserData
|
||||||
import com.google.android.datatransport.runtime.dagger.Provides
|
|
||||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||||
import com.google.firebase.firestore.FirebaseFirestore
|
import com.google.firebase.firestore.FirebaseFirestore
|
||||||
import com.google.firebase.firestore.ktx.firestore
|
import com.google.firebase.firestore.ktx.firestore
|
||||||
import com.google.firebase.ktx.Firebase
|
import com.google.firebase.ktx.Firebase
|
||||||
import com.google.firebase.storage.ktx.storage
|
import com.google.firebase.storage.ktx.storage
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.tasks.await
|
import kotlinx.coroutines.tasks.await
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
class DatabaseRepository : Repository {
|
class DatabaseRepository : Repository {
|
||||||
|
|
||||||
@@ -57,6 +51,16 @@ class DatabaseRepository : Repository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun addTestToDatabaseforBufferCheck(data: BufferCheckData?): Response<String> {
|
||||||
|
return try {
|
||||||
|
db.collection("buffers").add(data!!).await()
|
||||||
|
Response.Success(data!!.kitno)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Firebase.crashlytics.recordException(e)
|
||||||
|
Response.Error(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun uploadFileToStorage(patientID: String, filePath: String): Response<Boolean> {
|
suspend fun uploadFileToStorage(patientID: String, filePath: String): Response<Boolean> {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.example.hpostesting.presentation.adapter
|
package com.example.hpostesting.presentation.adapter
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.app.AlertDialog
|
||||||
|
import android.content.Context
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -20,9 +22,20 @@ import java.text.SimpleDateFormat
|
|||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
import android.widget.AutoCompleteTextView
|
||||||
|
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||||
|
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
||||||
|
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
||||||
|
import com.google.firebase.firestore.FirebaseFirestore
|
||||||
|
|
||||||
class UserListAdapter(
|
class UserListAdapter(
|
||||||
options: FirestoreRecyclerOptions<UserData>, private val view: View, private val batLevel: Int
|
|
||||||
|
private val context: Context,
|
||||||
|
private val hemoCubeViewModel: HemoCubeViewModel,
|
||||||
|
options: FirestoreRecyclerOptions<UserData>,
|
||||||
|
private val view: View,
|
||||||
|
private val batLevel: Int,
|
||||||
|
private val testDetails: HemoCubeTestData? = DataHolder.selectedTest?.toHemoCubeTestData(),
|
||||||
) : FirestoreRecyclerAdapter<UserData, UserListAdapter.OrderItemViewHolder>(options) {
|
) : FirestoreRecyclerAdapter<UserData, UserListAdapter.OrderItemViewHolder>(options) {
|
||||||
|
|
||||||
class OrderItemViewHolder(val binding: UserItemViewBinding) :
|
class OrderItemViewHolder(val binding: UserItemViewBinding) :
|
||||||
@@ -40,7 +53,7 @@ class UserListAdapter(
|
|||||||
userName.text = "Name: ${model.name}"
|
userName.text = "Name: ${model.name}"
|
||||||
userId.text = "User ID:${model._id}"
|
userId.text = "User ID:${model._id}"
|
||||||
if (model.incubationTime == "") {
|
if (model.incubationTime == "") {
|
||||||
btnStartIncubation.visibility = View.VISIBLE
|
// btnStartIncubation.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
userId.text =
|
userId.text =
|
||||||
"User ID:${model._id} \n Time: ${isBetween15And30Minutes(model.incubationTime)} \n Started at: ${
|
"User ID:${model._id} \n Time: ${isBetween15And30Minutes(model.incubationTime)} \n Started at: ${
|
||||||
@@ -61,26 +74,106 @@ class UserListAdapter(
|
|||||||
} else {
|
} else {
|
||||||
teststatus.text = "Test is Pending"
|
teststatus.text = "Test is Pending"
|
||||||
}
|
}
|
||||||
btnStartIncubation.setOnClickListener {
|
|
||||||
it.visibility = View.GONE
|
holder.binding.btnBlood.setOnClickListener {
|
||||||
Firebase.firestore.collection("patientData").whereEqualTo("_id", model._id).get()
|
val inflater = LayoutInflater.from(context)
|
||||||
.addOnSuccessListener { data ->
|
val dialogView = inflater.inflate(R.layout.dialog_custom, null)
|
||||||
if (data.documents.isNotEmpty()) {
|
|
||||||
data.documents.forEach { userData ->
|
val builder = AlertDialog.Builder(context)
|
||||||
Firebase.firestore.collection("patientData").document(userData.id)
|
.setView(dialogView)
|
||||||
.update(
|
.setTitle("Add Blood Group")
|
||||||
"incubationTime", SimpleDateFormat(
|
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
val etBloodGroup = dialogView.findViewById<AutoCompleteTextView>(R.id.et_blood_group)
|
||||||
).format(Calendar.getInstance().time).toString()
|
|
||||||
).addOnSuccessListener {
|
builder.setPositiveButton("OK") { dialog, which ->
|
||||||
Toast.makeText(
|
val bloodGroup = etBloodGroup.text.toString()
|
||||||
view.context, "Incubation started", Toast.LENGTH_SHORT
|
if (bloodGroup.equals("Select Blood Group") || bloodGroup.isNullOrBlank()) {
|
||||||
).show()
|
etBloodGroup.error = "Please enter your blood group"
|
||||||
startListening()
|
Toast.makeText(
|
||||||
}
|
context,
|
||||||
|
"Please enter your blood group",
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
} else {
|
||||||
|
// Check if hemoCubeViewModel and testDetails are not null
|
||||||
|
val db: FirebaseFirestore = FirebaseFirestore.getInstance()
|
||||||
|
|
||||||
|
db.collection("patientData")
|
||||||
|
.whereEqualTo("_id", model._id)
|
||||||
|
.get()
|
||||||
|
.addOnSuccessListener { userdata ->
|
||||||
|
try {
|
||||||
|
val document = userdata.documents[0]
|
||||||
|
db.collection("patientData")
|
||||||
|
.document(document.id)
|
||||||
|
.update("bloodGroup", bloodGroup,
|
||||||
|
"incubationTime", SimpleDateFormat(
|
||||||
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
|
).format(Calendar.getInstance().time).toString()
|
||||||
|
)
|
||||||
|
.addOnSuccessListener {
|
||||||
|
Toast.makeText(
|
||||||
|
context,
|
||||||
|
"Blood group updated successfully",
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
}
|
||||||
|
.addOnFailureListener { e ->
|
||||||
|
Toast.makeText(
|
||||||
|
context,
|
||||||
|
"Failed to update blood group: ${e.message}",
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
}
|
||||||
|
} catch (e: IndexOutOfBoundsException) {
|
||||||
|
// Handle the case where no documents are found for the specified ID
|
||||||
|
Toast.makeText(
|
||||||
|
context,
|
||||||
|
"No user data found for the specified ID",
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
.addOnFailureListener { e ->
|
||||||
|
Toast.makeText(
|
||||||
|
context,
|
||||||
|
"Error fetching user data: ${e.message}",
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// Handle the selected blood group here
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.setNegativeButton("Cancel") { dialog, which ->
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
val alertDialog = builder.create()
|
||||||
|
alertDialog.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
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()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
userCard.setOnClickListener {
|
userCard.setOnClickListener {
|
||||||
if (batLevel < 40) {
|
if (batLevel < 40) {
|
||||||
@@ -130,6 +223,8 @@ class UserListAdapter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private fun isBetween15And30Minutes(createdAt: String): Long {
|
private fun isBetween15And30Minutes(createdAt: String): Long {
|
||||||
val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
|
val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
|
||||||
val createdAtDate: Date = formatter.parse(createdAt)!!
|
val createdAtDate: Date = formatter.parse(createdAt)!!
|
||||||
@@ -142,4 +237,9 @@ class UserListAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.example.hpostesting.presentation.buffercheck
|
package com.example.hpostesting.presentation.buffercheck
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
@@ -13,9 +14,11 @@ import androidx.lifecycle.MutableLiveData
|
|||||||
import com.example.hpostesting.data.DataHolder
|
import com.example.hpostesting.data.DataHolder
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
import com.example.hpostesting.data.constant.HemoCubeCommands
|
import com.example.hpostesting.data.constant.HemoCubeCommands
|
||||||
|
import com.example.hpostesting.data.model.patient.BufferCheckData
|
||||||
import com.example.hpostesting.data.model.patient.DeviceData
|
import com.example.hpostesting.data.model.patient.DeviceData
|
||||||
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
||||||
import com.example.hpostesting.presentation.UsbServiceListener
|
import com.example.hpostesting.presentation.UsbServiceListener
|
||||||
|
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
||||||
import com.example.hpostesting.presentation.utils.MyDialogListener
|
import com.example.hpostesting.presentation.utils.MyDialogListener
|
||||||
import com.example.hpostesting.presentation.utils.UIUtils
|
import com.example.hpostesting.presentation.utils.UIUtils
|
||||||
@@ -32,6 +35,8 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
private lateinit var sharedPreferences: SharedPreferences
|
private lateinit var sharedPreferences: SharedPreferences
|
||||||
private var currentDeviceData: DeviceData? = null
|
private var currentDeviceData: DeviceData? = null
|
||||||
private var resultData: String = ""
|
private var resultData: String = ""
|
||||||
|
private var kitno: String = ""
|
||||||
|
private var isOnline = false
|
||||||
private val messages = MutableLiveData<String>()
|
private val messages = MutableLiveData<String>()
|
||||||
private var isTestOngoing = false
|
private var isTestOngoing = false
|
||||||
private var startListening = MutableLiveData(false)
|
private var startListening = MutableLiveData(false)
|
||||||
@@ -51,15 +56,43 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun initViews() {
|
private fun initViews() {
|
||||||
binding.btnKit.visibility = View.GONE
|
|
||||||
binding.btnSubmit.visibility = View.GONE
|
binding.nameEditText.setText("SMI/SC/")
|
||||||
binding.etBloodGroup.visibility = View.GONE
|
|
||||||
listenToHemoCube()
|
binding.btnGo.setOnClickListener {
|
||||||
startBufferProcess()
|
val serialNumber = binding.nameEditText.text.toString().trim()
|
||||||
|
if (serialNumber.isNotEmpty() && isSerialValid(serialNumber)) {
|
||||||
|
kitno = serialNumber
|
||||||
|
listenToHemoCube()
|
||||||
|
startBufferProcess()
|
||||||
|
} else {
|
||||||
|
Toast.makeText(context, "Invalid KIT Number", Toast.LENGTH_LONG).show()
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
activity?.runOnUiThread {
|
||||||
|
binding.tvSubtitle2.visibility = View.GONE
|
||||||
|
binding.etAbhaId.visibility = View.GONE
|
||||||
|
binding.tvTitle.visibility = View.GONE
|
||||||
|
binding.tvTitle2.visibility = View.GONE
|
||||||
|
binding.btnGo.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
activity?.runOnUiThread {
|
||||||
|
binding.btnSubmit.isEnabled = true
|
||||||
|
binding.btnSubmit.isClickable = true
|
||||||
|
}
|
||||||
|
binding.btnSubmit.setOnClickListener {
|
||||||
|
|
||||||
|
}
|
||||||
|
binding.btnSubmit.isEnabled = false
|
||||||
|
binding.btnSubmit.isClickable = false
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observeViewModel() {
|
|
||||||
|
|
||||||
|
private fun observeViewModel() {
|
||||||
hemoCubeViewModel.deviceData.observe(viewLifecycleOwner) {
|
hemoCubeViewModel.deviceData.observe(viewLifecycleOwner) {
|
||||||
currentDeviceData = it
|
currentDeviceData = it
|
||||||
}
|
}
|
||||||
@@ -69,11 +102,20 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
hemoCubeViewModel.getDeviceData(sharedPreferences.getString(Constants.USER_ID, ""))
|
hemoCubeViewModel.getDeviceData(sharedPreferences.getString(Constants.USER_ID, ""))
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
requireContext(),
|
requireContext(), "No internet connection avaiable", Toast.LENGTH_SHORT
|
||||||
"No internet connection avaiable",
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
isOnline = isNetworkAvailable
|
||||||
|
}
|
||||||
|
hemoCubeViewModel.fireBaseUpload.observe(viewLifecycleOwner) { result ->
|
||||||
|
if (result == "Success") {
|
||||||
|
showToast("Kit result uploaded successfully")
|
||||||
|
}
|
||||||
|
if (result == "Local") {
|
||||||
|
showToast("Kit result uploading failed, note it down manually")
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.progressBar.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
messages.observe(viewLifecycleOwner) {
|
messages.observe(viewLifecycleOwner) {
|
||||||
@@ -118,10 +160,14 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
resultData += fullReadOutput.toString()
|
resultData += fullReadOutput.toString()
|
||||||
|
|
||||||
when {
|
when {
|
||||||
stringData.contains("ERROR 500") -> showError500Dialog()
|
|
||||||
stringData.contains("ERROR 501") -> showError501Dialog()
|
|
||||||
stringData.contains("#Buffer Completed") -> showStartSampleDialog()
|
stringData.contains("#Buffer Completed") -> showStartSampleDialog()
|
||||||
stringData.contains("#Sample Completed") -> fetchResult()
|
stringData.contains("#Sample Completed") -> {
|
||||||
|
activity?.runOnUiThread {
|
||||||
|
binding.btnSubmit.isEnabled = true
|
||||||
|
binding.btnSubmit.isClickable = true
|
||||||
|
}
|
||||||
|
fetchResult()
|
||||||
|
}
|
||||||
|
|
||||||
stringData.contains("RESULT") || resultData.contains("REND") -> {
|
stringData.contains("RESULT") || resultData.contains("REND") -> {
|
||||||
var validString: String
|
var validString: String
|
||||||
@@ -143,40 +189,6 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun showError500Dialog() {
|
|
||||||
UIUtils.createAlertDialog(requireContext(),
|
|
||||||
"BUFFER ERROR",
|
|
||||||
"Do you want to continue with existing buffer?",
|
|
||||||
getString(R.string.noo),
|
|
||||||
"Yes",
|
|
||||||
object : MyDialogListener {
|
|
||||||
override fun onClickNegativeButton() {}
|
|
||||||
|
|
||||||
override fun onClickPositiveButton() {
|
|
||||||
listenToHemoCube()
|
|
||||||
startBufferProcess()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private fun showError501Dialog() {
|
|
||||||
UIUtils.createAlertDialog(requireContext(),
|
|
||||||
"SAMPLE ERROR",
|
|
||||||
"Do you want to continue with Sample?",
|
|
||||||
getString(R.string.noo),
|
|
||||||
"Yes",
|
|
||||||
object : MyDialogListener {
|
|
||||||
override fun onClickNegativeButton() {}
|
|
||||||
|
|
||||||
override fun onClickPositiveButton() {
|
|
||||||
listenToHemoCube()
|
|
||||||
startSampleProcess()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showStartSampleDialog() {
|
private fun showStartSampleDialog() {
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
UIUtils.createAlertDialog(requireContext(),
|
UIUtils.createAlertDialog(requireContext(),
|
||||||
@@ -199,6 +211,7 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
try {
|
try {
|
||||||
val result = validString.split(" ")
|
val result = validString.split(" ")
|
||||||
if (result.size == 8) {
|
if (result.size == 8) {
|
||||||
|
val deviceSerialNo = result[2]
|
||||||
val led1BufferForDevice = result[3].toDoubleOrNull()
|
val led1BufferForDevice = result[3].toDoubleOrNull()
|
||||||
val led2BufferForDevice = result[4].toDoubleOrNull()
|
val led2BufferForDevice = result[4].toDoubleOrNull()
|
||||||
val led1Sample = result[5].toDoubleOrNull()
|
val led1Sample = result[5].toDoubleOrNull()
|
||||||
@@ -206,9 +219,23 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
val led1Average = log10(led1BufferForDevice?.div(led1Sample!!) ?: 0.0)
|
val led1Average = log10(led1BufferForDevice?.div(led1Sample!!) ?: 0.0)
|
||||||
val led2Average = log10(led2BufferForDevice?.div(led2Sample!!) ?: 0.0)
|
val led2Average = log10(led2BufferForDevice?.div(led2Sample!!) ?: 0.0)
|
||||||
val deviceRatio = led1Average / led2Average
|
val deviceRatio = led1Average / led2Average
|
||||||
val calculatedRatio = calculateRatio(deviceRatio)
|
val calculatedRatio = 0.14
|
||||||
val classificationResult = findResult(calculatedRatio)
|
val classificationResult = findResult(calculatedRatio)
|
||||||
messages.postValue(classificationResult)
|
messages.postValue(classificationResult)
|
||||||
|
val bufferData = BufferCheckData(
|
||||||
|
kitno = kitno,
|
||||||
|
led1Buffer = led1BufferForDevice,
|
||||||
|
led2Buffer = led2BufferForDevice,
|
||||||
|
led1Average = led1Average,
|
||||||
|
led2Average = led2Average,
|
||||||
|
led1Sample = led1Sample,
|
||||||
|
led2Sample = led2Sample,
|
||||||
|
deviceRatio = deviceRatio,
|
||||||
|
calculatedRatio = calculatedRatio,
|
||||||
|
classificationResult = classificationResult,
|
||||||
|
deviceSerialNumber = deviceSerialNo
|
||||||
|
)
|
||||||
|
hemoCubeViewModel.uploadHemoCubeResultToDatabaseforbuffercheckN(bufferData)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
@@ -245,8 +272,7 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
|
|
||||||
private fun startBufferProcess() {
|
private fun startBufferProcess() {
|
||||||
|
|
||||||
(activity as HemocubeBufferCheckActivity).mService.sendAndListenToHemoCube(
|
(activity as HemocubeBufferCheckActivity).mService.sendAndListenToHemoCube(HemoCubeCommands.startBuffer,
|
||||||
HemoCubeCommands.startBuffer,
|
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {}
|
override fun onUsbRead(data: ByteArray?) {}
|
||||||
|
|
||||||
@@ -257,8 +283,7 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
|
|
||||||
private fun startSampleProcess() {
|
private fun startSampleProcess() {
|
||||||
|
|
||||||
(activity as HemocubeBufferCheckActivity).mService.sendAndListenToHemoCube(
|
(activity as HemocubeBufferCheckActivity).mService.sendAndListenToHemoCube(HemoCubeCommands.startSample,
|
||||||
HemoCubeCommands.startSample,
|
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {}
|
override fun onUsbRead(data: ByteArray?) {}
|
||||||
|
|
||||||
@@ -269,8 +294,7 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
|
|
||||||
private fun fetchResult() {
|
private fun fetchResult() {
|
||||||
|
|
||||||
(activity as HemocubeBufferCheckActivity).mService.sendAndListenToHemoCube(
|
(activity as HemocubeBufferCheckActivity).mService.sendAndListenToHemoCube(HemoCubeCommands.getSample,
|
||||||
HemoCubeCommands.getSample,
|
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {}
|
override fun onUsbRead(data: ByteArray?) {}
|
||||||
|
|
||||||
@@ -300,6 +324,15 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun isSerialValid(s: String): Boolean {
|
||||||
|
if (s.length != 17) {
|
||||||
|
binding.nameEditText.error = getString(R.string.invalid_kit)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun isValidResult(line: String): String {
|
private fun isValidResult(line: String): String {
|
||||||
return if (line.contains("RESULT") && line.split(" ").size == 8) {
|
return if (line.contains("RESULT") && line.split(" ").size == 8) {
|
||||||
line
|
line
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ class HomeFragment : Fragment() {
|
|||||||
private val viewModel: TestRightViewModel by activityViewModels()
|
private val viewModel: TestRightViewModel by activityViewModels()
|
||||||
private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels()
|
private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels()
|
||||||
private lateinit var rvAdapter: UserListAdapter
|
private lateinit var rvAdapter: UserListAdapter
|
||||||
|
private var batLevel: Int = 0 // Initialize with a default value, or obtain the actual battery level
|
||||||
|
|
||||||
|
|
||||||
private lateinit var sharedPreference: SharedPreferences
|
private lateinit var sharedPreference: SharedPreferences
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||||
@@ -151,8 +154,12 @@ class HomeFragment : Fragment() {
|
|||||||
val bm = requireContext().getSystemService(BATTERY_SERVICE) as BatteryManager
|
val bm = requireContext().getSystemService(BATTERY_SERVICE) as BatteryManager
|
||||||
val batLevel: Int = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
|
val batLevel: Int = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
|
||||||
|
|
||||||
rvAdapter = UserListAdapter(recyclerViewOptions, binding.root, batLevel)
|
rvAdapter = view?.let {
|
||||||
|
UserListAdapter(requireContext(), hemoCubeViewModel, recyclerViewOptions,
|
||||||
|
it, batLevel)
|
||||||
|
}!!
|
||||||
binding.rvOrder.adapter = rvAdapter
|
binding.rvOrder.adapter = rvAdapter
|
||||||
|
|
||||||
rvAdapter.startListening()
|
rvAdapter.startListening()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Firebase.crashlytics.recordException(e)
|
Firebase.crashlytics.recordException(e)
|
||||||
@@ -195,11 +202,12 @@ class HomeFragment : Fragment() {
|
|||||||
val recyclerViewOptions =
|
val recyclerViewOptions =
|
||||||
FirestoreRecyclerOptions.Builder<UserData>().setQuery(query, UserData::class.java)
|
FirestoreRecyclerOptions.Builder<UserData>().setQuery(query, UserData::class.java)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
val bm = requireContext().getSystemService(BATTERY_SERVICE) as BatteryManager
|
val bm = requireContext().getSystemService(BATTERY_SERVICE) as BatteryManager
|
||||||
val batLevel: Int = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
|
batLevel = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
|
||||||
|
|
||||||
rvAdapter = UserListAdapter(recyclerViewOptions, binding.root, batLevel)
|
rvAdapter = view?.let {
|
||||||
|
UserListAdapter(requireContext(), hemoCubeViewModel, recyclerViewOptions, it, batLevel)
|
||||||
|
}!!
|
||||||
binding.rvOrder.adapter = rvAdapter
|
binding.rvOrder.adapter = rvAdapter
|
||||||
rvAdapter.startListening()
|
rvAdapter.startListening()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,25 +64,25 @@ class HemoCubeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun initViews() {
|
private fun initViews() {
|
||||||
binding.btnSubmit.setOnClickListener {
|
// binding.btnSubmit.setOnClickListener {
|
||||||
val bloodGroupText = binding.etBloodGroup.text.toString()
|
// val bloodGroupText = binding.etBloodGroup.text.toString()
|
||||||
if (bloodGroupText.isEmpty()) {
|
// if (bloodGroupText.isEmpty()) {
|
||||||
binding.etBloodGroup.error = "Please enter your blood group"
|
// binding.etBloodGroup.error = "Please enter your blood group"
|
||||||
} else {
|
// } else {
|
||||||
activity?.runOnUiThread {
|
// activity?.runOnUiThread {
|
||||||
binding.progressBar.visibility = View.VISIBLE
|
// binding.progressBar.visibility = View.VISIBLE
|
||||||
}
|
// }
|
||||||
hemoCubeViewModel.uploadHemoCubeResultToDatabase(
|
// hemoCubeViewModel.uploadHemoCubeResultToDatabase(
|
||||||
isOnline, true, sharedPreferences.getString(Constants.KIT_NUMBER, "")
|
// isOnline, true, sharedPreferences.getString(Constants.KIT_NUMBER, "")
|
||||||
)
|
// )
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (isTestOngoing) {
|
// if (isTestOngoing) {
|
||||||
binding.btnKit.visibility = View.GONE
|
// binding.btnKit.visibility = View.GONE
|
||||||
binding.btnKit.isEnabled = false
|
// binding.btnKit.isEnabled = false
|
||||||
binding.btnKit.isClickable = false
|
// binding.btnKit.isClickable = false
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
binding.btnSubmit.isEnabled = false
|
binding.btnSubmit.isEnabled = false
|
||||||
binding.btnSubmit.isClickable = false
|
binding.btnSubmit.isClickable = false
|
||||||
|
|
||||||
@@ -90,70 +90,70 @@ class HemoCubeFragment : Fragment() {
|
|||||||
binding.tvName.text = "Name: ${testDetails?.name}\n ID: ${testDetails?._id}"
|
binding.tvName.text = "Name: ${testDetails?.name}\n ID: ${testDetails?._id}"
|
||||||
Log.e("nametext",binding.tvName.text.toString())
|
Log.e("nametext",binding.tvName.text.toString())
|
||||||
|
|
||||||
binding.btnKit.setOnClickListener {
|
// binding.btnKit.setOnClickListener {
|
||||||
if (isTestOngoing) {
|
// if (isTestOngoing) {
|
||||||
val title = "WARNING"
|
// val title = "WARNING"
|
||||||
val message = "There is a on going test, do you want to stop it"
|
// val message = "There is a on going test, do you want to stop it"
|
||||||
val negativeText = getString(R.string.no)
|
// val negativeText = getString(R.string.no)
|
||||||
val positiveText = "Yes"
|
// val positiveText = "Yes"
|
||||||
|
//
|
||||||
UIUtils.createAlertDialog(requireContext(),
|
// UIUtils.createAlertDialog(requireContext(),
|
||||||
title,
|
// title,
|
||||||
message,
|
// message,
|
||||||
negativeText,
|
// negativeText,
|
||||||
positiveText,
|
// positiveText,
|
||||||
object : MyDialogListener {
|
// object : MyDialogListener {
|
||||||
override fun onClickNegativeButton() {
|
// override fun onClickNegativeButton() {
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun onClickPositiveButton() {
|
// override fun onClickPositiveButton() {
|
||||||
resetKitCount()
|
// resetKitCount()
|
||||||
val intent = Intent(context, KitScanActivity::class.java)
|
// val intent = Intent(context, KitScanActivity::class.java)
|
||||||
startActivity(intent)
|
// startActivity(intent)
|
||||||
(activity as HemocubeActivity).finish()
|
// (activity as HemocubeActivity).finish()
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
} else {
|
// } else {
|
||||||
resetKitCount()
|
// resetKitCount()
|
||||||
val intent = Intent(context, KitScanActivity::class.java)
|
// val intent = Intent(context, KitScanActivity::class.java)
|
||||||
startActivity(intent)
|
// startActivity(intent)
|
||||||
(activity as HemocubeActivity).finish()
|
// (activity as HemocubeActivity).finish()
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun checkBloodGroup() {
|
// private suspend fun checkBloodGroup() {
|
||||||
binding.apply {
|
// binding.apply {
|
||||||
val bloodGroup = etBloodGroup.text.toString()
|
// val bloodGroup = etBloodGroup.text.toString()
|
||||||
if (bloodGroup.isEmpty()) {
|
// if (bloodGroup.isEmpty()) {
|
||||||
etBloodGroup.error = "Please enter your blood group"
|
// etBloodGroup.error = "Please enter your blood group"
|
||||||
} else {
|
// } else {
|
||||||
val db: FirebaseFirestore = Firebase.firestore
|
// val db: FirebaseFirestore = Firebase.firestore
|
||||||
val userdata = db.collection("patientData")
|
// val userdata = db.collection("patientData")
|
||||||
.whereEqualTo("_id", hemoCubeViewModel.testDetails?._id).get().await()
|
// .whereEqualTo("_id", hemoCubeViewModel.testDetails?._id).get().await()
|
||||||
if (userdata.documents.isNotEmpty()) {
|
// if (userdata.documents.isNotEmpty()) {
|
||||||
db.collection("patientData").document(userdata.documents[0].id)
|
// db.collection("patientData").document(userdata.documents[0].id)
|
||||||
.update("bloodGroup", bloodGroup)
|
// .update("bloodGroup", bloodGroup)
|
||||||
withContext(Dispatchers.Main) {
|
// withContext(Dispatchers.Main) {
|
||||||
val i = Intent(
|
// val i = Intent(
|
||||||
requireContext().applicationContext, DashboardActivity::class.java
|
// requireContext().applicationContext, DashboardActivity::class.java
|
||||||
)
|
// )
|
||||||
startActivity(i)
|
// startActivity(i)
|
||||||
(activity as HemocubeActivity).finish()
|
// (activity as HemocubeActivity).finish()
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
private fun observeViewModel() {
|
private fun observeViewModel() {
|
||||||
hemoCubeViewModel.fireBaseUpload.observe(viewLifecycleOwner) { result ->
|
hemoCubeViewModel.fireBaseUpload.observe(viewLifecycleOwner) { result ->
|
||||||
if (result == "Success") {
|
if (result == "Success") {
|
||||||
showToast("Test Results Uploaded Successfully")
|
showToast("Test Results Uploaded Successfully")
|
||||||
lifecycleScope.launch {
|
// lifecycleScope.launch {
|
||||||
checkBloodGroup()
|
// checkBloodGroup()
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
if (result == "Local") {
|
if (result == "Local") {
|
||||||
showToast("Internet not available, test details stored locally")
|
showToast("Internet not available, test details stored locally")
|
||||||
@@ -176,7 +176,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
val coefficient1 = coefficients[0]
|
val coefficient1 = coefficients[0]
|
||||||
val coefficient2 = coefficients[1]
|
val coefficient2 = coefficients[1]
|
||||||
val result = coefficient1 * coefficient2
|
val result = coefficient1 * coefficient2
|
||||||
showToast("coefficients: $coefficient1, $coefficient2")
|
// showToast("coefficients: $coefficient1, $coefficient2")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isOnline = isNetworkAvailable
|
isOnline = isNetworkAvailable
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.example.hpostesting.data.NetworkStatusLiveData
|
|||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
import com.example.hpostesting.data.dao.HemoCubeDao
|
import com.example.hpostesting.data.dao.HemoCubeDao
|
||||||
import com.example.hpostesting.data.model.Response
|
import com.example.hpostesting.data.model.Response
|
||||||
|
import com.example.hpostesting.data.model.patient.BufferCheckData
|
||||||
import com.example.hpostesting.data.model.patient.DeviceData
|
import com.example.hpostesting.data.model.patient.DeviceData
|
||||||
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||||
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
||||||
@@ -69,6 +70,18 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fun uploadHemoCubeResultToDatabaseforbuffercheckN(bufferCheckData: BufferCheckData) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
addResultTestToDbforbuffercheck(bufferCheckData)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun getDeviceData(deviceId: String?) = viewModelScope.launch {
|
fun getDeviceData(deviceId: String?) = viewModelScope.launch {
|
||||||
deviceData.postValue(deviceId?.let { repository.getDeviceDataById(it) })
|
deviceData.postValue(deviceId?.let { repository.getDeviceDataById(it) })
|
||||||
}
|
}
|
||||||
@@ -126,6 +139,29 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun addResultTestToDbforbuffercheck(bufferCheckData: BufferCheckData) {
|
||||||
|
viewModelScope.launch {
|
||||||
|
try {
|
||||||
|
|
||||||
|
when (val response = repository.addTestToDatabaseforBufferCheck(bufferCheckData)) {
|
||||||
|
is Response.Success -> {
|
||||||
|
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
||||||
|
fireBaseUpload.postValue("Success")
|
||||||
|
}
|
||||||
|
|
||||||
|
is Response.Error -> {
|
||||||
|
Log.e("Testdb", "Error uploading data to Firestore: $response")
|
||||||
|
fireBaseUpload.postValue("Error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e("Testdb", "Exception during data upload: ${e.message}")
|
||||||
|
fireBaseUpload.postValue("Error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun bulkAddResultTestToDb(userData: HemoCubeTestData) {
|
fun bulkAddResultTestToDb(userData: HemoCubeTestData) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
userData.reportUploadTime = SimpleDateFormat(
|
userData.reportUploadTime = SimpleDateFormat(
|
||||||
|
|||||||
24
app/src/main/res/layout/dialog_custom.xml
Normal file
24
app/src/main/res/layout/dialog_custom.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/til_blood_group"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/et_blood_group"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/select_blood_group"
|
||||||
|
android:inputType="none"
|
||||||
|
android:labelFor="@id/til_blood_group"
|
||||||
|
app:simpleItems="@array/blood_group" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
</LinearLayout>
|
||||||
@@ -27,7 +27,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="24dp"
|
android:layout_marginHorizontal="24dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:text="@string/step4"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||||
@@ -45,6 +44,7 @@
|
|||||||
<!-- app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" />-->
|
<!-- app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" />-->
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:visibility="gone"
|
||||||
android:id="@+id/tv_name"
|
android:id="@+id/tv_name"
|
||||||
style="@style/title2"
|
style="@style/title2"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
android:layout_marginHorizontal="24dp"
|
android:layout_marginHorizontal="24dp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/btn_submit" />
|
tools:ignore="MissingConstraints" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_subtitle4"
|
android:id="@+id/tv_subtitle4"
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" />
|
app:layout_constraintTop_toBottomOf="@id/et_abha_id" />
|
||||||
|
|
||||||
|
|
||||||
<!-- <Button-->
|
<!-- <Button-->
|
||||||
@@ -98,7 +98,55 @@
|
|||||||
<!-- app:layout_constraintTop_toBottomOf="@id/btn_submit" />-->
|
<!-- app:layout_constraintTop_toBottomOf="@id/btn_submit" />-->
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_title2"
|
||||||
|
style="@style/title1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="24dp"
|
||||||
|
android:layout_marginTop="48dp"
|
||||||
|
android:text="@string/enter_kit_serial_number_manually"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
tools:ignore="MissingConstraints" />
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/et_abha_id"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="24dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/btn_go"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_title2">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/name_edit_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLength="17"
|
||||||
|
android:inputType="text"
|
||||||
|
android:hint="@string/serial_number" />
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btn_go"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="24dp"
|
||||||
|
android:text="@string/go"
|
||||||
|
app:cornerRadius="16dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/et_abha_id"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="1.0"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/et_abha_id"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/et_abha_id" />
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
android:visibility="gone"
|
||||||
android:id="@+id/btn_submit"
|
android:id="@+id/btn_submit"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -109,40 +157,40 @@
|
|||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/til_blood_group" />
|
app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<!-- <com.google.android.material.textfield.TextInputLayout-->
|
||||||
android:id="@+id/til_blood_group"
|
<!-- android:id="@+id/til_blood_group"-->
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
<!-- style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"-->
|
||||||
android:layout_width="match_parent"
|
<!-- android:layout_width="match_parent"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_marginHorizontal="24dp"
|
<!-- android:layout_marginHorizontal="24dp"-->
|
||||||
android:layout_marginTop="16dp"
|
<!-- android:layout_marginTop="16dp"-->
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_subtitle4">
|
<!-- app:layout_constraintTop_toBottomOf="@id/tv_subtitle4">-->
|
||||||
|
|
||||||
<AutoCompleteTextView
|
<!-- <AutoCompleteTextView-->
|
||||||
android:id="@+id/et_blood_group"
|
<!-- android:id="@+id/et_blood_group"-->
|
||||||
android:layout_width="match_parent"
|
<!-- android:layout_width="match_parent"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:hint="@string/select_blood_group"
|
<!-- android:hint="@string/select_blood_group"-->
|
||||||
android:inputType="none"
|
<!-- android:inputType="none"-->
|
||||||
android:labelFor="@id/til_blood_group"
|
<!-- android:labelFor="@id/til_blood_group"-->
|
||||||
app:simpleItems="@array/blood_group" />
|
<!-- app:simpleItems="@array/blood_group" />-->
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
<!-- </com.google.android.material.textfield.TextInputLayout>-->
|
||||||
|
|
||||||
<Button
|
<!-- <Button-->
|
||||||
android:id="@+id/btn_kit"
|
<!-- android:id="@+id/btn_kit"-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_margin="10dp"
|
<!-- android:layout_margin="10dp"-->
|
||||||
android:text="@string/new_kit"
|
<!-- android:text="@string/new_kit"-->
|
||||||
android:textColor="@color/white"
|
<!-- android:textColor="@color/white"-->
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
<!-- app:layout_constraintStart_toStartOf="parent" />-->
|
||||||
|
|
||||||
<!-- <Button-->
|
<!-- <Button-->
|
||||||
<!-- android:id="@+id/btn_buffer"-->
|
<!-- android:id="@+id/btn_buffer"-->
|
||||||
@@ -181,7 +229,6 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</layout>
|
||||||
|
|
||||||
</layout>
|
|
||||||
@@ -79,9 +79,17 @@
|
|||||||
android:layout_marginHorizontal="16dp"
|
android:layout_marginHorizontal="16dp"
|
||||||
android:text="@string/start_incubation"
|
android:text="@string/start_incubation"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
app:layout_constraintStart_toEndOf="@+id/userImage"
|
app:layout_constraintStart_toEndOf="@+id/btn_blood"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/teststatus" />
|
app:layout_constraintBottom_toBottomOf="@+id/btn_blood" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_blood"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="16dp"
|
||||||
|
android:text="@string/blood_group"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/btn_startIncubation"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/teststatus" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user