Compare commits
1 Commits
DigitalCar
...
CSV-file-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d8d33dfc9 |
@@ -54,9 +54,10 @@ dependencies {
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.12.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'com.google.android.material:material:1.9.0'
|
||||
implementation 'com.google.android.material:material:1.10.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.2'
|
||||
implementation 'com.opencsv:opencsv:5.5'
|
||||
|
||||
//firebase
|
||||
implementation platform('com.google.firebase:firebase-bom:32.1.0')
|
||||
@@ -71,8 +72,8 @@ dependencies {
|
||||
implementation 'com.google.android.gms:play-services-location:21.0.1'
|
||||
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
|
||||
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")
|
||||
implementation 'com.google.firebase:firebase-appdistribution:16.0.0-beta11'
|
||||
implementation("com.google.firebase:firebase-appdistribution-api-ktx:16.0.0-beta11")
|
||||
|
||||
|
||||
// Testing
|
||||
@@ -82,13 +83,12 @@ dependencies {
|
||||
|
||||
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2"
|
||||
implementation 'com.opencsv:opencsv:4.6'
|
||||
implementation 'com.github.mik3y:usb-serial-for-android:3.5.1'
|
||||
|
||||
implementation "androidx.fragment:fragment-ktx:1.6.1"
|
||||
implementation "androidx.fragment:fragment-ktx:1.6.2"
|
||||
|
||||
// CSV read, write
|
||||
implementation 'com.opencsv:opencsv:4.6'
|
||||
implementation 'com.opencsv:opencsv:5.5'
|
||||
|
||||
// Barcode scanner
|
||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||
@@ -97,22 +97,22 @@ dependencies {
|
||||
implementation 'com.google.android.gms:play-services-code-scanner:16.1.0'
|
||||
|
||||
//Room
|
||||
implementation "androidx.room:room-ktx:2.6.0-rc01"
|
||||
implementation "androidx.room:room-runtime:2.6.0-rc01"
|
||||
kapt ("androidx.room:room-compiler:2.6.0-rc01")
|
||||
implementation "androidx.room:room-ktx:2.6.1"
|
||||
implementation "androidx.room:room-runtime:2.6.1"
|
||||
kapt ("androidx.room:room-compiler:2.6.1")
|
||||
|
||||
//image
|
||||
implementation 'com.github.bumptech.glide:glide:4.13.2'
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
|
||||
|
||||
// Navigation Component
|
||||
implementation "androidx.navigation:navigation-fragment-ktx:2.7.3"
|
||||
implementation "androidx.navigation:navigation-ui-ktx:2.7.3"
|
||||
implementation "androidx.navigation:navigation-fragment-ktx:2.7.5"
|
||||
implementation "androidx.navigation:navigation-ui-ktx:2.7.5"
|
||||
|
||||
//Dagger - Hilt
|
||||
implementation "com.google.dagger:hilt-android:2.46"
|
||||
kapt "com.google.dagger:hilt-android-compiler:2.46"
|
||||
kapt "androidx.hilt:hilt-compiler:1.0.0"
|
||||
kapt "androidx.hilt:hilt-compiler:1.1.0"
|
||||
|
||||
// Retrofit + GSON
|
||||
implementation "com.squareup.retrofit2:retrofit:2.9.0"
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
|
||||
|
||||
18
app/src/main/java/com/example/hpostesting/data/CsvHelper.kt
Normal file
18
app/src/main/java/com/example/hpostesting/data/CsvHelper.kt
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.example.hpostesting.data
|
||||
|
||||
import com.opencsv.CSVWriter
|
||||
import java.io.FileWriter
|
||||
import java.io.IOException
|
||||
|
||||
class CsvHelper {
|
||||
companion object {
|
||||
@Throws(IOException::class)
|
||||
fun writeToCsv(filePath: String, data: List<Array<String>>) {
|
||||
CSVWriter(FileWriter(filePath)).use { csvWriter ->
|
||||
data.forEach { row ->
|
||||
csvWriter.writeNext(row)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,8 +61,6 @@ object Constants {
|
||||
"HC-V1-018",
|
||||
"HC-V1-019",
|
||||
"HC-V1-020",
|
||||
"HCV-000-3001",
|
||||
"HCV-000-3002",
|
||||
)
|
||||
|
||||
const val password = "SMI@12345"
|
||||
@@ -71,7 +69,5 @@ object Constants {
|
||||
const val KIT_COUNT = "KitCount"
|
||||
const val BUFFER_VALUE_1 = "BufferValue1"
|
||||
const val BUFFER_VALUE_2 = "BufferValue2"
|
||||
const val BUFFER_VALUE_3 = "BufferValue3"
|
||||
const val BUFFER_VALUE_4 = "BufferValue4"
|
||||
const val DEVICE_ID = "DEVICE_ID"
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||
import com.google.android.datatransport.runtime.dagger.Provides
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Database(entities = [UserData::class, HemoCubeTestData::class, DeviceData::class], version = 6, exportSchema = false)
|
||||
@Database(entities = [UserData::class, HemoCubeTestData::class, DeviceData::class], version = 3, exportSchema = false)
|
||||
@TypeConverters(Converters::class)
|
||||
abstract class MyDatabase : RoomDatabase() {
|
||||
abstract fun userDao(): UserDao
|
||||
|
||||
@@ -8,17 +8,14 @@ data class HemoCubeTestData(
|
||||
@PrimaryKey
|
||||
var _id: String = "",
|
||||
var name: String = "",
|
||||
var birthYear: String = "",
|
||||
var state: String = "",
|
||||
var abhaId: String = "",
|
||||
var bloodGroup: String = "",
|
||||
var birthYear: String = "",
|
||||
var userImageURL: String = "",
|
||||
var location: UserData.Location? = null,
|
||||
var reportUploadTime: String? = "",
|
||||
var testType: String? = "HEMOCUBE",
|
||||
var testTime: String? = "",
|
||||
var testStatus: Boolean? = false,
|
||||
var gender: String = "",
|
||||
var localFlag: Boolean = false,
|
||||
var deviceId: String? = "",
|
||||
var appVersion:String? = "",
|
||||
@@ -28,16 +25,10 @@ data class HemoCubeTestData(
|
||||
var resultData: String = "",
|
||||
var led1Buffer: Double? = null,
|
||||
var led2Buffer: Double? = null,
|
||||
var led3Buffer: Double? = null,
|
||||
var led4Buffer: Double? = null,
|
||||
var led1Sample: Double? = null,
|
||||
var led2Sample: Double? = null,
|
||||
var led3Sample: Double? = null,
|
||||
var led4Sample: Double? = null,
|
||||
var led1Average: Double? = null,
|
||||
var led2Average: Double? = null,
|
||||
var led3Average: Double? = null,
|
||||
var led4Average: Double? = null,
|
||||
var deviceRatio: Double? = null,
|
||||
var calculatedRatio: Double? = null,
|
||||
var coefficients: String? = "",
|
||||
|
||||
@@ -11,9 +11,7 @@ data class UserData(
|
||||
var name: String = "",
|
||||
var incubationTime: String = "",
|
||||
var birthYear: String = "",
|
||||
var abhaId: String = "",
|
||||
var userImageURL: String = "",
|
||||
var gender: String ="",
|
||||
var location: Location? = null,
|
||||
var createdBy: String? = "",
|
||||
var reportUploadTime: String? = "",
|
||||
@@ -21,7 +19,6 @@ data class UserData(
|
||||
var testStatus: Boolean? = false,
|
||||
var mobileId: String = "",
|
||||
var deviceId: String = "",
|
||||
var state: String = "",
|
||||
var deviceSerialNumber: String = "",
|
||||
var kitSerial: String = "",
|
||||
var csvPath: String = "",
|
||||
@@ -47,6 +44,5 @@ fun UserData.toHemoCubeTestData() = HemoCubeTestData(
|
||||
birthYear = birthYear,
|
||||
userImageURL = userImageURL,
|
||||
testStatus = testStatus,
|
||||
location = location,
|
||||
gender = gender
|
||||
location = location
|
||||
)
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import com.example.hpostesting.data.DataHolder
|
||||
import com.example.hpostesting.data.constant.Constants
|
||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
||||
import com.example.hpostesting.presentation.diagnostics.DiagnosticsActivity
|
||||
import com.example.hpostesting.presentation.hemocube.HemocubeActivity
|
||||
import com.example.hpostesting.presentation.testRight.TestRightActivity
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.example.hpostesting.data.CsvHelper
|
||||
import com.example.hpostesting.data.DataHolder
|
||||
import com.example.hpostesting.data.constant.Constants
|
||||
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||
@@ -32,6 +33,7 @@ import com.google.firebase.perf.ktx.performance
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import `in`.sminnovations.hpostesting.R
|
||||
import `in`.sminnovations.hpostesting.databinding.FragmentHomeBinding
|
||||
import java.io.IOException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
@@ -337,6 +339,25 @@ class HomeFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun downloadCsv() {
|
||||
val csvData = hemoCubeViewModel.getLocalUserDataForCsv()
|
||||
|
||||
try {
|
||||
val filePath = requireContext().getExternalFilesDir(null)?.absolutePath + "/userdata.csv"
|
||||
CsvHelper.writeToCsv(filePath, csvData)
|
||||
showToast("CSV downloaded successfully at: $filePath")
|
||||
} catch (e: IOException) {
|
||||
showToast("Error downloading CSV")
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showToast(message: String) {
|
||||
Toast.makeText(requireContext(), message, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.example.hpostesting.presentation.hemocube
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.example.hpostesting.data.DataHolder
|
||||
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
||||
import `in`.sminnovations.hpostesting.R
|
||||
import `in`.sminnovations.hpostesting.databinding.FragmentDigitalCardBinding
|
||||
import `in`.sminnovations.hpostesting.databinding.FragmentHemoCubeReferenceBinding
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
|
||||
class DigitalCardFragment : Fragment() {
|
||||
private lateinit var binding: FragmentDigitalCardBinding
|
||||
private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels()
|
||||
private lateinit var sharedPreferences: SharedPreferences
|
||||
val testDetails = DataHolder.selectedTest?.toHemoCubeTestData()
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
|
||||
): View {
|
||||
binding = FragmentDigitalCardBinding.inflate(inflater, container, false)
|
||||
sharedPreferences =
|
||||
requireContext().getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
initViews()
|
||||
}
|
||||
|
||||
private fun initViews() {
|
||||
activity?.runOnUiThread {
|
||||
binding.progressBar.visibility = View.VISIBLE
|
||||
}
|
||||
val originalDateStr = testDetails?.testTime
|
||||
val originalDateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||
val originalDate: Date? = originalDateFormat.parse(originalDateStr)
|
||||
val desiredDateFormat = SimpleDateFormat("MMM dd, yyyy")
|
||||
val formattedDate: String = originalDate?.let { desiredDateFormat.format(it) } ?: "N/A"
|
||||
activity?.runOnUiThread {
|
||||
binding.progressBar.visibility = View.GONE
|
||||
}
|
||||
binding.name.text = "Name: ${testDetails?.name}"
|
||||
binding.dob.text = "DOB: ${testDetails?.birthYear}"
|
||||
binding.gender.text = "gender: ${testDetails?.gender}"
|
||||
binding.State.text = "state: ${testDetails?.state}"
|
||||
binding.abhaid.text = "ABHA ID: ${testDetails?.abhaId}"
|
||||
binding.blood.text = "Blood Group: ${testDetails?.bloodGroup}"
|
||||
binding.sicklecell.text = "Sickle-Cell: ${testDetails?.classificationResult}"
|
||||
binding.issueDate.text = "Issue Date: $formattedDate"
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ import com.example.hpostesting.data.model.patient.DeviceData
|
||||
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
||||
import com.example.hpostesting.presentation.UsbServiceListener
|
||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
||||
import com.example.hpostesting.presentation.diagnostics.DiagnosticsActivity
|
||||
import com.example.hpostesting.presentation.utils.MyDialogListener
|
||||
import com.example.hpostesting.presentation.utils.UIUtils
|
||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||
@@ -42,15 +41,7 @@ class HemoCubeFragment : Fragment() {
|
||||
private var isUsingExistingBuffer = false
|
||||
private var isTestOngoing = false
|
||||
private var startListening = MutableLiveData<Boolean>(false)
|
||||
private val testingTrace = Firebase.performance.newTrace("testing_trace")
|
||||
private var led1BufferForDevice = 0.0
|
||||
private var led2BufferForDevice = 0.0
|
||||
private var led3BufferForDevice = 0.0
|
||||
private var led4BufferForDevice = 0.0
|
||||
private var led1SampleForDevice = 0.0
|
||||
private var led2SampleForDevice = 0.0
|
||||
private var led3SampleForDevice = 0.0
|
||||
private var led4SampleForDevice = 0.0
|
||||
val testingTrace = Firebase.performance.newTrace("testing_trace")
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
|
||||
@@ -64,9 +55,8 @@ class HemoCubeFragment : Fragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
initViews()
|
||||
listenToHemoCube()
|
||||
getDeviceInfo()
|
||||
observeViewModel()
|
||||
checkAndStartProcess()
|
||||
}
|
||||
|
||||
private fun initViews() {
|
||||
@@ -78,58 +68,34 @@ class HemoCubeFragment : Fragment() {
|
||||
isOnline, true, sharedPreferences.getString(Constants.KIT_NUMBER, "")
|
||||
)
|
||||
}
|
||||
if (isTestOngoing) {
|
||||
// binding.btnKit.visibility = View.GONE
|
||||
// binding.btnKit.isEnabled = false
|
||||
// binding.btnKit.isClickable = false
|
||||
}
|
||||
|
||||
binding.tvTitle2.visibility = View.GONE
|
||||
binding.etAbhaId.visibility = View.GONE
|
||||
binding.nameEditText.visibility = View.GONE
|
||||
binding.tvTitle.visibility = View.GONE
|
||||
binding.btnGo.visibility = View.GONE
|
||||
binding.btnSubmit.isEnabled = true
|
||||
binding.btnSubmit.isClickable = true
|
||||
binding.btnPlacebuffer.visibility = View.GONE
|
||||
binding.btnSubmit.isEnabled = false
|
||||
binding.btnSubmit.isClickable = false
|
||||
|
||||
|
||||
binding.tvName.text = "Name: ${testDetails?.name}\n ID: ${testDetails?._id}"
|
||||
binding.tvSubtitle4.text = "Config"
|
||||
|
||||
binding.btnSamplestart.setOnClickListener {
|
||||
activity?.runOnUiThread {
|
||||
binding.tvSubtitle4.visibility = View.VISIBLE
|
||||
binding.tvSubtitle4.text = "Sample Started"
|
||||
}
|
||||
startSampleProcess()
|
||||
it.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.btnPlacebuffer.setOnClickListener {
|
||||
if (isBufferValueAvailable()) {
|
||||
showBufferAlertDialog()
|
||||
} else {
|
||||
activity?.runOnUiThread {
|
||||
binding.tvSubtitle4.visibility = View.VISIBLE
|
||||
}
|
||||
checkAndStartProcess()
|
||||
}
|
||||
it.visibility = View.GONE
|
||||
}
|
||||
|
||||
Log.e("nametext", binding.tvName.text.toString())
|
||||
}
|
||||
|
||||
private fun observeViewModel() {
|
||||
hemoCubeViewModel.fireBaseUpload.observe(viewLifecycleOwner) { result ->
|
||||
if (result == "Success") {
|
||||
showToast("Test Results Uploaded Successfully")
|
||||
|
||||
val digitalCardFragment = DigitalCardFragment()
|
||||
val transaction = parentFragmentManager.beginTransaction()
|
||||
transaction.replace(R.id.fragment_container, digitalCardFragment)
|
||||
transaction.addToBackStack(null)
|
||||
transaction.commit()
|
||||
|
||||
// val i = Intent(
|
||||
// requireContext().applicationContext, DashboardActivity::class.java
|
||||
// )
|
||||
// startActivity(i)
|
||||
// (activity as HemocubeActivity).finish()
|
||||
val i = Intent(
|
||||
requireContext().applicationContext, DashboardActivity::class.java
|
||||
)
|
||||
startActivity(i)
|
||||
(activity as HemocubeActivity).finish()
|
||||
}
|
||||
if (result == "Local") {
|
||||
showToast("Internet not available, test details stored locally")
|
||||
@@ -165,39 +131,42 @@ class HemoCubeFragment : Fragment() {
|
||||
hemoCubeViewModel.messages.observe(viewLifecycleOwner) {
|
||||
binding.tvSubtitle4.text = it
|
||||
}
|
||||
// startListening.observe(viewLifecycleOwner) {
|
||||
// if (it) {
|
||||
// lifecycleScope.launch {
|
||||
// delay(1000)
|
||||
// if (binding.tvSubtitle4.text.toString().isEmpty()) {
|
||||
// (activity as HemocubeActivity).reconnectDevice()
|
||||
// if (isBufferValueAvailable()) {
|
||||
// showBufferAlertDialog()
|
||||
// } else {
|
||||
// listenToHemoCube()
|
||||
// startBufferProcess()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private fun checkAndStartProcess() {
|
||||
startBufferProcess()
|
||||
if (isBufferValueAvailable()) {
|
||||
showBufferAlertDialog()
|
||||
} else {
|
||||
listenToHemoCube()
|
||||
startBufferProcess()
|
||||
}
|
||||
}
|
||||
|
||||
private fun isBufferValueAvailable(): Boolean {
|
||||
return try {
|
||||
if (sharedPreferences.getString(
|
||||
Constants.BUFFER_VALUE_1, ""
|
||||
) != "" && sharedPreferences.getString(Constants.BUFFER_VALUE_2, "") != ""
|
||||
&& sharedPreferences.getString(Constants.BUFFER_VALUE_3, "") != ""
|
||||
&& sharedPreferences.getString(Constants.BUFFER_VALUE_4, "") != ""
|
||||
) {
|
||||
sharedPreferences.getString(Constants.BUFFER_VALUE_1, "")
|
||||
?.toDouble()!! > 0.0 && sharedPreferences.getString(
|
||||
Constants.BUFFER_VALUE_2,
|
||||
""
|
||||
)
|
||||
?.toDouble()!! > 0.0 && sharedPreferences.getString(
|
||||
Constants.BUFFER_VALUE_3,
|
||||
""
|
||||
)
|
||||
?.toDouble()!! > 0.0 && sharedPreferences.getString(
|
||||
Constants.BUFFER_VALUE_4,
|
||||
""
|
||||
)
|
||||
?.toDouble()!! > 0.0
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
showToast("error while getting existing buffer")
|
||||
return if (sharedPreferences.getString(
|
||||
Constants.BUFFER_VALUE_1, ""
|
||||
) != "" && sharedPreferences.getString(Constants.BUFFER_VALUE_2, "") != ""
|
||||
) {
|
||||
sharedPreferences.getString(Constants.BUFFER_VALUE_1, "")
|
||||
?.toDouble()!! > 0.0 && sharedPreferences.getString(Constants.BUFFER_VALUE_2, "")
|
||||
?.toDouble()!! > 0.0
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
@@ -215,15 +184,13 @@ class HemoCubeFragment : Fragment() {
|
||||
positiveText,
|
||||
object : MyDialogListener {
|
||||
override fun onClickNegativeButton() {
|
||||
listenToHemoCube()
|
||||
startBufferProcess()
|
||||
}
|
||||
|
||||
override fun onClickPositiveButton() {
|
||||
activity?.runOnUiThread {
|
||||
binding.btnPlacebuffer.visibility = View.GONE
|
||||
binding.btnSamplestart.visibility = View.VISIBLE
|
||||
binding.tvSubtitle4.text = "Place Sample"
|
||||
}
|
||||
listenToHemoCube()
|
||||
startSampleProcess()
|
||||
isUsingExistingBuffer = true
|
||||
}
|
||||
})
|
||||
@@ -259,112 +226,42 @@ class HemoCubeFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getDeviceInfo() {
|
||||
hemoCubeViewModel.progressBar.postValue(true)
|
||||
(activity as HemocubeActivity).mService.sendAndListenToHemoCube(
|
||||
HemoCubeCommands.getDeviceId,
|
||||
object : UsbServiceListener {
|
||||
override fun onUsbRead(data: ByteArray?) {
|
||||
data?.let {
|
||||
val stringData = String(it)
|
||||
hemoCubeViewModel.messages.postValue(stringData)
|
||||
binding.tvSubtitle4.text = stringData
|
||||
}
|
||||
}
|
||||
|
||||
override fun onUsbError(e: Exception?) {
|
||||
hemoCubeViewModel.progressBar.postValue(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun handleUsbData(stringData: String, fullReadOutput: StringBuilder) {
|
||||
if (stringData.contains("#")) {
|
||||
hemoCubeViewModel.messages.postValue(stringData)
|
||||
isTestOngoing = true
|
||||
}
|
||||
|
||||
resultData += stringData
|
||||
|
||||
when {
|
||||
stringData.contains("SN") -> {
|
||||
val slData = stringData.split(" ")
|
||||
if (slData.size > 1) {
|
||||
val hardwareId = slData[1].trim()
|
||||
with(sharedPreferences.edit()) {
|
||||
putString(Constants.DEVICE_ID, hardwareId)
|
||||
apply()
|
||||
}
|
||||
}
|
||||
activity?.runOnUiThread {
|
||||
binding.btnPlacebuffer.visibility = View.VISIBLE
|
||||
}
|
||||
hemoCubeViewModel.messages.postValue("Start")
|
||||
}
|
||||
|
||||
stringData.contains("#BS") -> {
|
||||
hemoCubeViewModel.messages.postValue("Buffer Started")
|
||||
}
|
||||
|
||||
stringData.contains("#BC") -> {
|
||||
activity?.runOnUiThread {
|
||||
binding.tvSubtitle4.text = "Buffer Completed"
|
||||
binding.btnSamplestart.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
stringData.contains("#SS") -> {
|
||||
activity?.runOnUiThread {
|
||||
binding.tvSubtitle4.text = "Sample Started"
|
||||
binding.btnSamplestart.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
stringData.contains("#SC") -> {
|
||||
binding.tvSubtitle4.text = "Sample Completed"
|
||||
stringData.contains("#Buffer Completed") -> showStartSampleDialog()
|
||||
stringData.contains("#Sample Completed") -> {
|
||||
fetchResult()
|
||||
testingTrace.stop()
|
||||
}
|
||||
|
||||
resultData.contains("REND") -> {
|
||||
val resultLines = resultData.split("\\s+(?=LB|LS)".toRegex())
|
||||
var bufferIntensity = resultLines[1].split(' ')[1].trim()
|
||||
led1BufferForDevice = if (isUsingExistingBuffer) {
|
||||
sharedPreferences.getString(Constants.BUFFER_VALUE_1, "")?.toDoubleOrNull()!!
|
||||
stringData.contains("RESULT") || resultData.contains("REND") -> {
|
||||
var validString: String
|
||||
val results: List<String>
|
||||
if (stringData.contains("RESULT")) {
|
||||
validString = isValidResult(stringData)
|
||||
if (validString.isEmpty()) {
|
||||
results = resultData.split("\n")
|
||||
validString = parseResult(results)
|
||||
}
|
||||
} else {
|
||||
bufferIntensity.toDoubleOrNull()!!
|
||||
results = resultData.split("\n")
|
||||
validString = parseResult(results)
|
||||
}
|
||||
bufferIntensity = resultLines[2].split(' ')[1].trim()
|
||||
led2BufferForDevice = if (isUsingExistingBuffer) {
|
||||
sharedPreferences.getString(Constants.BUFFER_VALUE_2, "")?.toDoubleOrNull()!!
|
||||
} else {
|
||||
bufferIntensity.toDoubleOrNull()!!
|
||||
if (validString.isNotEmpty()) {
|
||||
handleValidResult(validString, resultData)
|
||||
}
|
||||
bufferIntensity = resultLines[3].split(' ')[1].trim()
|
||||
led3BufferForDevice = if (isUsingExistingBuffer) {
|
||||
sharedPreferences.getString(Constants.BUFFER_VALUE_3, "")?.toDoubleOrNull()!!
|
||||
} else {
|
||||
bufferIntensity.toDoubleOrNull()!!
|
||||
}
|
||||
bufferIntensity = resultLines[4].split(' ')[1].trim()
|
||||
led4BufferForDevice = if (isUsingExistingBuffer) {
|
||||
sharedPreferences.getString(Constants.BUFFER_VALUE_4, "")?.toDoubleOrNull()!!
|
||||
} else {
|
||||
bufferIntensity.toDoubleOrNull()!!
|
||||
}
|
||||
|
||||
var sampleIntensity = resultLines[5].split(' ')[1].trim()
|
||||
led1SampleForDevice = resultLines[5].split(' ')[1].trim().toDoubleOrNull()!!
|
||||
sampleIntensity = resultLines[6].split(' ')[1].trim()
|
||||
led2SampleForDevice = resultLines[6].split(' ')[1].trim().toDoubleOrNull()!!
|
||||
sampleIntensity = resultLines[7].split(' ')[1].trim()
|
||||
led3SampleForDevice = resultLines[7].split(' ')[1].trim().toDoubleOrNull()!!
|
||||
sampleIntensity = resultLines[8].split(' ')[1].split('\r')[0].trim()
|
||||
led4SampleForDevice = resultLines[8].split(' ')[1].split('\r')[0].trim().toDoubleOrNull()!!
|
||||
processResult()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun showError() {
|
||||
activity?.runOnUiThread {
|
||||
UIUtils.createAlertDialog(requireContext(),
|
||||
@@ -394,65 +291,106 @@ class HemoCubeFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun processResult() {
|
||||
private fun showStartSampleDialog() {
|
||||
activity?.runOnUiThread {
|
||||
UIUtils.createAlertDialog(requireContext(),
|
||||
"Start Sample",
|
||||
"Do you want to start sample reading?",
|
||||
getString(R.string.no),
|
||||
"Yes",
|
||||
object : MyDialogListener {
|
||||
override fun onClickNegativeButton() {}
|
||||
|
||||
override fun onClickPositiveButton() {
|
||||
listenToHemoCube()
|
||||
startSampleProcess()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleValidResult(validString: String, fullReadOutput: String) {
|
||||
try {
|
||||
val result = validString.split(" ")
|
||||
val deviceLog = resultData
|
||||
|
||||
val pInfo = requireActivity().packageManager.getPackageInfo(
|
||||
requireActivity().packageName, 0
|
||||
)
|
||||
val version = pInfo.versionName
|
||||
|
||||
val led1Average = log10(led1BufferForDevice?.div(led1SampleForDevice!!) ?: 0.0)
|
||||
val led2Average = log10(led2BufferForDevice?.div(led2SampleForDevice!!) ?: 0.0)
|
||||
val led3Average = log10(led3BufferForDevice?.div(led3SampleForDevice!!) ?: 0.0)
|
||||
val led4Average = log10(led4BufferForDevice?.div(led4SampleForDevice!!) ?: 0.0)
|
||||
val deviceRatio = led1Average / led3Average
|
||||
|
||||
if (led1Average < 0 || led2Average < 0) {
|
||||
activity?.runOnUiThread {
|
||||
binding.errorMessage.text = "Warning: Negative Abs. Retake Blank Reading"
|
||||
binding.errorMessage.visibility = View.VISIBLE
|
||||
if (result.size == 8) {
|
||||
val deviceSerialNo = result[2]
|
||||
with(sharedPreferences.edit()) {
|
||||
putString(Constants.DEVICE_ID, deviceSerialNo)
|
||||
apply()
|
||||
}
|
||||
}
|
||||
|
||||
DataHolder.hemoCubeTestData?.apply {
|
||||
deviceId = sharedPreferences.getString(Constants.DEVICE_ID, "").toString()
|
||||
led1Buffer = led1BufferForDevice
|
||||
led2Buffer = led2BufferForDevice
|
||||
led3Buffer = led3BufferForDevice
|
||||
led4Buffer = led4BufferForDevice
|
||||
appVersion = version
|
||||
this.led1Sample = led1SampleForDevice
|
||||
this.led2Sample = led2SampleForDevice
|
||||
this.led3Sample = led3SampleForDevice
|
||||
this.led4Sample = led4SampleForDevice
|
||||
this.led1Average = led1Average
|
||||
this.led2Average = led2Average
|
||||
this.led3Average = led3Average
|
||||
this.led4Average = led4Average
|
||||
this.deviceRatio = deviceRatio
|
||||
this.calculatedRatio = calculateRatio(deviceRatio)
|
||||
this.coefficients = currentDeviceData?.coefficients?.get(0)
|
||||
.toString() + ", " + currentDeviceData?.coefficients?.get(1).toString()
|
||||
this.classificationResult = findResult(calculatedRatio)
|
||||
hemoCubeViewModel.messages.postValue(this.classificationResult)
|
||||
this.resultData = deviceLog
|
||||
if (!isUsingExistingBuffer) {
|
||||
with(sharedPreferences.edit()) {
|
||||
putString(Constants.BUFFER_VALUE_1, led1BufferForDevice.toString())
|
||||
putString(Constants.BUFFER_VALUE_2, led2BufferForDevice.toString())
|
||||
putString(Constants.BUFFER_VALUE_3, led3BufferForDevice.toString())
|
||||
putString(Constants.BUFFER_VALUE_4, led4BufferForDevice.toString())
|
||||
apply()
|
||||
val loginId = sharedPreferences.getString(Constants.USER_ID, "").toString()
|
||||
if (checkDeviceIdMismatch(deviceSerialNo, loginId)) {
|
||||
activity?.runOnUiThread {
|
||||
binding.errorMessage.text = "Warning: Login Id is different"
|
||||
binding.errorMessage.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
val led1BufferForDevice = if (isUsingExistingBuffer) {
|
||||
sharedPreferences.getString(Constants.BUFFER_VALUE_1, "")?.toDoubleOrNull()
|
||||
} else {
|
||||
result[3].toDoubleOrNull()
|
||||
}
|
||||
val led2BufferForDevice = if (isUsingExistingBuffer) {
|
||||
sharedPreferences.getString(Constants.BUFFER_VALUE_2, "")?.toDoubleOrNull()
|
||||
} else {
|
||||
result[4].toDoubleOrNull()
|
||||
}
|
||||
val pInfo = requireActivity().packageManager.getPackageInfo(
|
||||
requireActivity().packageName, 0
|
||||
)
|
||||
val version = pInfo.versionName
|
||||
val led1Sample = result[5].toDoubleOrNull()
|
||||
val led2Sample = result[6].toDoubleOrNull()
|
||||
val led1Average = log10(led1BufferForDevice?.div(led1Sample!!) ?: 0.0)
|
||||
val led2Average = log10(led2BufferForDevice?.div(led2Sample!!) ?: 0.0)
|
||||
val deviceRatio = led1Average / led2Average
|
||||
// if (led1BufferForDevice!! > 20000 && led1BufferForDevice < 24000 && led2BufferForDevice!! > 20000 && led2BufferForDevice < 24000) {
|
||||
// if (led1Sample!! < led1BufferForDevice && led1Sample < 24000 && led2Sample!! < led2BufferForDevice && led2Sample < 24000) {
|
||||
// if (deviceRatio < 0.08) {
|
||||
// if (deviceRatio > 1.07) {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if (led1Average < 0 || led2Average < 0) {
|
||||
activity?.runOnUiThread{
|
||||
binding.errorMessage.text = "Warning: Negative Abs. Retake Blank Reading"
|
||||
binding.errorMessage.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
DataHolder.hemoCubeTestData?.apply {
|
||||
deviceId = deviceSerialNo
|
||||
led1Buffer = led1BufferForDevice
|
||||
led2Buffer = led2BufferForDevice
|
||||
appVersion = version
|
||||
this.led1Sample = led1Sample
|
||||
this.led2Sample = led2Sample
|
||||
this.led1Average = led1Average
|
||||
this.led2Average = led2Average
|
||||
this.deviceRatio = deviceRatio
|
||||
this.calculatedRatio = calculateRatio(deviceRatio)
|
||||
this.coefficients = currentDeviceData?.coefficients?.get(0).toString() + ", " + currentDeviceData?.coefficients?.get(1).toString()
|
||||
this.classificationResult = findResult(calculatedRatio)
|
||||
hemoCubeViewModel.messages.postValue(this.classificationResult)
|
||||
this.resultData = deviceLog
|
||||
if (!isUsingExistingBuffer) {
|
||||
with(sharedPreferences.edit()) {
|
||||
putString(Constants.BUFFER_VALUE_1, led1Buffer.toString())
|
||||
putString(Constants.BUFFER_VALUE_2, led2Buffer.toString())
|
||||
apply()
|
||||
}
|
||||
}
|
||||
activity?.runOnUiThread {
|
||||
binding.btnSubmit.visibility = View.VISIBLE
|
||||
binding.btnSubmit.isEnabled = true
|
||||
binding.btnSubmit.isClickable = true
|
||||
binding.clParent.setBackgroundColor(Color.parseColor("#edfffd"))
|
||||
}
|
||||
binding.btnSubmit.isEnabled = true
|
||||
binding.btnSubmit.isClickable = true
|
||||
binding.clParent.setBackgroundColor(Color.parseColor("#edfffd"))
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Toast.makeText(
|
||||
@@ -499,10 +437,6 @@ class HemoCubeFragment : Fragment() {
|
||||
private fun startBufferProcess() {
|
||||
hemoCubeViewModel.progressBar.postValue(true)
|
||||
|
||||
activity?.runOnUiThread {
|
||||
binding.btnPlacebuffer.visibility = View.GONE
|
||||
}
|
||||
|
||||
(activity as HemocubeActivity).mService.sendAndListenToHemoCube(HemoCubeCommands.startBuffer,
|
||||
object : UsbServiceListener {
|
||||
override fun onUsbRead(data: ByteArray?) {}
|
||||
@@ -546,6 +480,29 @@ class HemoCubeFragment : Fragment() {
|
||||
return coefficient1 * ratio + coefficient2
|
||||
}
|
||||
|
||||
private fun parseResult(frames: List<String>): String {
|
||||
val lines = mutableListOf<String>()
|
||||
for (frame in frames.reversed()) {
|
||||
if (frame.contains("REND") || frame.contains("RESULT")) lines += frame
|
||||
if (frame.contains("RESULT")) {
|
||||
break
|
||||
}
|
||||
}
|
||||
val line = lines.reversed().joinToString("").trim()
|
||||
if (line.contains("RESULT") && line.split(" ").size == 8) {
|
||||
return line
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
private fun isValidResult(line: String): String {
|
||||
return if (line.contains("RESULT") && line.split(" ").size == 8) {
|
||||
line
|
||||
} else {
|
||||
""
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkDeviceIdMismatch(deviceId: String, loginId: String): Boolean {
|
||||
if (!deviceId.isNullOrEmpty() && !loginId.isNullOrEmpty() && deviceId.last() != loginId.last())
|
||||
return true
|
||||
|
||||
@@ -95,16 +95,10 @@ class HemoCubeViewModel @Inject constructor(
|
||||
testDetails?.kitSerial = sharedPreference.getString(Constants.KIT_NUMBER, "").toString()
|
||||
testDetails?.led1Buffer = DataHolder.hemoCubeTestData?.led1Buffer
|
||||
testDetails?.led2Buffer = DataHolder.hemoCubeTestData?.led2Buffer
|
||||
testDetails?.led3Buffer = DataHolder.hemoCubeTestData?.led3Buffer
|
||||
testDetails?.led4Buffer = DataHolder.hemoCubeTestData?.led4Buffer
|
||||
testDetails?.led1Sample = DataHolder.hemoCubeTestData?.led1Sample
|
||||
testDetails?.led2Sample = DataHolder.hemoCubeTestData?.led2Sample
|
||||
testDetails?.led3Sample = DataHolder.hemoCubeTestData?.led3Sample
|
||||
testDetails?.led4Sample = DataHolder.hemoCubeTestData?.led4Sample
|
||||
testDetails?.led1Average = DataHolder.hemoCubeTestData?.led1Average
|
||||
testDetails?.led2Average = DataHolder.hemoCubeTestData?.led2Average
|
||||
testDetails?.led3Average = DataHolder.hemoCubeTestData?.led3Average
|
||||
testDetails?.led4Average = DataHolder.hemoCubeTestData?.led4Average
|
||||
testDetails?.deviceRatio = DataHolder.hemoCubeTestData?.deviceRatio
|
||||
testDetails?.calculatedRatio = DataHolder.hemoCubeTestData?.calculatedRatio
|
||||
testDetails?.coefficients = DataHolder.hemoCubeTestData?.coefficients
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.example.hpostesting.presentation.testRight
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
||||
@@ -34,7 +34,7 @@ class UsbService : Service() {
|
||||
fun connect(driver: UsbSerialDriver, connection: UsbDeviceConnection) {
|
||||
mPort = driver.ports[0] // Most devices have just one port (port 0)
|
||||
mPort.open(connection)
|
||||
mPort.setParameters(9600, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE)
|
||||
mPort.setParameters(115200, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE)
|
||||
isUsbConnected = true
|
||||
Log.d(TAG, "My Usb Connected ${mPort.driver}")
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 7.0 KiB |
@@ -1,5 +0,0 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>
|
||||
</vector>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1,243 +0,0 @@
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="com.example.hpostesting.presentation.hemocube.DigitalCardFragment">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/fragment_container">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/userCard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="350dp"
|
||||
android:layout_marginTop="24dp"
|
||||
app:cardBackgroundColor="#C0C0C0"
|
||||
app:cardCornerRadius="25dp"
|
||||
app:cardElevation="0dp"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="22dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/userImage"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@drawable/karnataka" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/userName"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginStart="46dp"
|
||||
app:layout_constraintTop_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/userImage"
|
||||
app:layout_constraintTop_toTopOf="@+id/userImage"
|
||||
tools:src="@drawable/sickle_cell_gov_logo"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/userImage3"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginStart="36dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/userName"
|
||||
app:layout_constraintTop_toTopOf="@+id/userName"
|
||||
tools:src="@drawable/indianoil"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/userImage4"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginTop="30dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/userImage"
|
||||
tools:src="@drawable/person" />
|
||||
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/userdetails"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_marginTop="24dp"
|
||||
app:cardBackgroundColor="#FFFFFF"
|
||||
app:cardCornerRadius="5dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/userImage"
|
||||
app:layout_constraintStart_toEndOf="@+id/userImage4"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
style="@style/title1_1"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/userImage"
|
||||
android:text="Name: Mariya" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dob"
|
||||
style="@style/title1_1"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="30dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/name"
|
||||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
android:text="DOB: 1998" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gender"
|
||||
style="@style/title1_1"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="50dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/dob"
|
||||
app:layout_constraintTop_toBottomOf="@id/dob"
|
||||
android:text="gender: female" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/State"
|
||||
style="@style/title1_1"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="70dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/gender"
|
||||
app:layout_constraintTop_toBottomOf="@id/gender"
|
||||
android:text="State: Kerala" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/userdetails2"
|
||||
android:layout_width="150dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_marginTop="24dp"
|
||||
app:cardBackgroundColor="#FFFFFF"
|
||||
app:cardCornerRadius="5dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/userImage3"
|
||||
app:layout_constraintStart_toEndOf="@+id/userdetails"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/abhaid"
|
||||
style="@style/title1_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/userImage3"
|
||||
android:text="ABHA-ID: XXXX-8734" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/blood"
|
||||
style="@style/title1_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/userImage3"
|
||||
android:text="Blood Group: O +ve" />
|
||||
<TextView
|
||||
android:id="@+id/sicklecell"
|
||||
style="@style/title1_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="8sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/userImage3"
|
||||
android:text="Sickle-Cell: Normal (HbA)" />
|
||||
<TextView
|
||||
android:id="@+id/issueDate"
|
||||
style="@style/title1_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="70dp"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/userImage3"
|
||||
android:text="Issue Date: Oct 2,2023" />
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/digitalcard"
|
||||
android:backgroundTint="#00008B"
|
||||
app:cardBackgroundColor="#00008B"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/digital_card"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/userdetails" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:elevation="12dp"
|
||||
android:indeterminate="true"
|
||||
android:indeterminateDrawable="@drawable/progressbar_drawable"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
@@ -147,35 +147,8 @@
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toEndOf="@id/et_abha_id"
|
||||
app:layout_constraintTop_toTopOf="@id/et_abha_id" />
|
||||
<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/btn_placebuffer" />
|
||||
|
||||
|
||||
|
||||
<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:visibility="gone"
|
||||
android:id="@+id/btn_submit"
|
||||
@@ -205,6 +178,61 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_submit" />
|
||||
|
||||
<!-- <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"-->
|
||||
<!-- android:layout_marginHorizontal="24dp"-->
|
||||
<!-- android:layout_marginTop="16dp"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/tv_subtitle4">-->
|
||||
|
||||
<!-- <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>-->
|
||||
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/btn_kit"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_margin="10dp"-->
|
||||
<!-- android:text="@string/new_kit"-->
|
||||
<!-- android:textColor="@color/white"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent" />-->
|
||||
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/btn_buffer"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text="@string/new_buffer"-->
|
||||
<!-- android:textColor="@color/white"-->
|
||||
<!-- android:layout_margin="10dp"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toStartOf="@id/btn_kit"/>-->
|
||||
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/btn_read"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text="@string/read"-->
|
||||
<!-- android:layout_margin="16dp"-->
|
||||
<!-- android:clickable="false"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/btn_set_reference"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent" />-->
|
||||
|
||||
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
<string name="sickle_find">Sickle Find</string>
|
||||
<string name="submit">Submit</string>
|
||||
<string name="diagnostics">Device Diagnostics</string>
|
||||
<string name="place_buffer">Start</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>
|
||||
@@ -158,7 +158,6 @@
|
||||
<string name="is_patient_married_yes_no">Is Patient Married? (Yes/No)</string>
|
||||
<string name="category">Category</string>
|
||||
<string name="blood_group">Blood Group</string>
|
||||
<string name="digital_card">Digital Counselling Card</string>
|
||||
<string name="patient_medical_records">Patient Medical Records</string>
|
||||
<string name="patient_address_details">Patient Address Details</string>
|
||||
<string name="district">District</string>
|
||||
|
||||
@@ -3,7 +3,7 @@ buildscript {
|
||||
kotlin_version = '1.8.21'
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.1.1'
|
||||
classpath 'com.android.tools.build:gradle:8.0.2'
|
||||
classpath 'com.google.gms:google-services:4.4.0'
|
||||
classpath 'com.google.firebase:firebase-appdistribution-gradle:4.0.1'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user