Updates in results page, calculation methods & more. (working)
This commit is contained in:
17
.idea/deploymentTargetDropDown.xml
generated
Normal file
17
.idea/deploymentTargetDropDown.xml
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="SERIAL_NUMBER" />
|
||||
<value value="192.168.0.135:5555" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2023-01-30T07:49:19.748240Z" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/misc.xml
generated
6
.idea/misc.xml
generated
@@ -3,14 +3,18 @@
|
||||
<component name="DesignSurface">
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="app/src/main/res/drawable/ic_baseline_cancel_24.xml" value="0.1965" />
|
||||
<entry key="app/src/main/res/drawable/ic_baseline_check_circle_24.xml" value="0.243" />
|
||||
<entry key="app/src/main/res/drawable/ic_baseline_dot_24.xml" value="0.1785" />
|
||||
<entry key="app/src/main/res/drawable/ic_baseline_file_download_24.xml" value="0.243" />
|
||||
<entry key="app/src/main/res/drawable/ic_baseline_home_24.xml" value="0.243" />
|
||||
<entry key="app/src/main/res/drawable/ic_baseline_new_label_24.xml" value="0.243" />
|
||||
<entry key="app/src/main/res/drawable/progressbar_drawable.xml" value="0.1885" />
|
||||
<entry key="app/src/main/res/drawable/result_background_green.xml" value="0.243" />
|
||||
<entry key="app/src/main/res/drawable/result_background_red.xml" value="0.1785" />
|
||||
<entry key="app/src/main/res/drawable/result_background_tellow.xml" value="0.1785" />
|
||||
<entry key="app/src/main/res/font/inter_bold.xml" value="0.33487179487179486" />
|
||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.25" />
|
||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.32026519775390627" />
|
||||
<entry key="app/src/main/res/layout/activity_splash.xml" value="0.24375" />
|
||||
<entry key="app/src/main/res/layout/activity_test_right.xml" value="0.24375" />
|
||||
<entry key="app/src/main/res/layout/fragment_test_right_exp_reference.xml" value="0.2972222222222222" />
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
package com.example.refactoredapp.data
|
||||
|
||||
import android.os.Environment
|
||||
import com.example.refactoredapp.R
|
||||
import com.example.refactoredapp.data.model.TestRightDeviceConstants
|
||||
|
||||
object DataHolder {
|
||||
var isStoragePermissionGranted = false
|
||||
var isAppFolderCreated = false
|
||||
var appFolderPath = ""
|
||||
// var isReferenceTaken = false
|
||||
var isReferenceTaken = false
|
||||
var sampleReadCounter = 0
|
||||
|
||||
var deviceConstant: TestRightDeviceConstants? = null
|
||||
|
||||
/* Contains wavelength -> pixel no.*/
|
||||
val wavelengthToPixelArray = ArrayList<Double>()
|
||||
|
||||
/* (For reference/baseline) Contains pixel no. -> Intensity of light falling on that pixel */
|
||||
val intensityReferenceArray = ArrayList<Double>()
|
||||
}
|
||||
@@ -11,7 +11,8 @@ import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.example.refactoredapp.data.Constants
|
||||
import com.example.refactoredapp.data.constant.Constants
|
||||
import com.example.refactoredapp.data.DataHolder
|
||||
import com.example.refactoredapp.databinding.ActivityTestRightBinding
|
||||
import com.example.refactoredapp.util.MyViewModelFactory
|
||||
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
||||
@@ -64,7 +65,10 @@ class TestRightActivity : AppCompatActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityTestRightBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
viewModel = ViewModelProvider(this, MyViewModelFactory(this.applicationContext))[TestRightViewModel::class.java]
|
||||
viewModel = ViewModelProvider(
|
||||
this,
|
||||
MyViewModelFactory(this.applicationContext)
|
||||
)[TestRightViewModel::class.java]
|
||||
|
||||
// Connected or not connected icon with livetime status using live data
|
||||
|
||||
@@ -73,12 +77,13 @@ class TestRightActivity : AppCompatActivity() {
|
||||
|
||||
}
|
||||
|
||||
private fun testing() {
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(binding.flMain.id, TestRightExpSample()).commit()
|
||||
}
|
||||
// private fun testing() {
|
||||
// supportFragmentManager.beginTransaction()
|
||||
// .replace(binding.flMain.id, TestRightExpSample()).commit()
|
||||
// }
|
||||
|
||||
private fun connectUsb(permissionGranted: Boolean) {
|
||||
Log.d(TAG, "connectUsb() called, permission variable = $permissionGranted")
|
||||
val manager = getSystemService(Context.USB_SERVICE) as UsbManager
|
||||
val availableDrivers = UsbSerialProber.getDefaultProber().findAllDrivers(manager)
|
||||
|
||||
@@ -88,7 +93,7 @@ class TestRightActivity : AppCompatActivity() {
|
||||
mDriver = availableDrivers[0]
|
||||
mConnection = manager.openDevice(mDriver.device)
|
||||
|
||||
if (mConnection == null){
|
||||
if (mConnection == null) {
|
||||
requestUserPermission(manager, mDriver.device)
|
||||
} else {
|
||||
setupService()
|
||||
@@ -100,14 +105,24 @@ class TestRightActivity : AppCompatActivity() {
|
||||
* Request user permission. The response will be received in the BroadcastReceiver
|
||||
*/
|
||||
private fun requestUserPermission(manager: UsbManager, device: UsbDevice) {
|
||||
Log.d(TAG, String.format("requestUserPermissions", device.vendorId, device.productId))
|
||||
// Log.d(TAG, "requestUserPermissions() called -> vendor id = ${device.vendorId} & product id = ${device.productId}")
|
||||
|
||||
val mPendingIntent = PendingIntent.getBroadcast(
|
||||
this,
|
||||
0,
|
||||
Intent(Constants.ACTION_USB_PERMISSION),
|
||||
0
|
||||
)
|
||||
val mPendingIntent: PendingIntent
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
|
||||
mPendingIntent = PendingIntent.getBroadcast(
|
||||
this,
|
||||
0,
|
||||
Intent(Constants.ACTION_USB_PERMISSION),
|
||||
PendingIntent.FLAG_MUTABLE
|
||||
)
|
||||
} else {
|
||||
mPendingIntent = PendingIntent.getBroadcast(
|
||||
this,
|
||||
0,
|
||||
Intent(Constants.ACTION_USB_PERMISSION),
|
||||
PendingIntent.FLAG_ONE_SHOT
|
||||
)
|
||||
}
|
||||
|
||||
val filter = IntentFilter(Constants.ACTION_USB_PERMISSION)
|
||||
registerReceiver(broadcastReceiver, filter)
|
||||
@@ -120,16 +135,22 @@ class TestRightActivity : AppCompatActivity() {
|
||||
bindService(intent, connection, Context.BIND_AUTO_CREATE)
|
||||
}
|
||||
|
||||
private fun moveToNext(){
|
||||
private fun moveToNext() {
|
||||
if (supportFragmentManager.isDestroyed)
|
||||
return
|
||||
|
||||
if (!viewModel.isReferenceDone)
|
||||
if (DataHolder.sampleReadCounter > Constants.MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE){
|
||||
DataHolder.sampleReadCounter = 0
|
||||
DataHolder.isReferenceTaken = false
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(binding.flMain.id, TestRightExpReference()).commit()
|
||||
else
|
||||
}else if (!DataHolder.isReferenceTaken) {
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(binding.flMain.id, TestRightExpReference()).commit()
|
||||
} else {
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(binding.flMain.id, TestRightExpSample()).commit()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
@@ -5,12 +5,14 @@ import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.example.refactoredapp.R
|
||||
import com.example.refactoredapp.data.Constants
|
||||
import com.example.refactoredapp.data.DataHolder
|
||||
import com.example.refactoredapp.data.constant.Constants
|
||||
import com.example.refactoredapp.data.constant.TestRightCommands
|
||||
import com.example.refactoredapp.databinding.FragmentTestRightExpReferenceBinding
|
||||
import com.example.refactoredapp.presentation.UsbServiceListener
|
||||
@@ -25,8 +27,6 @@ class TestRightExpReference : Fragment() {
|
||||
|
||||
private val TAG = "TestRightExpReference"
|
||||
|
||||
private val fullReadOutput = StringBuilder()
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
@@ -40,41 +40,25 @@ class TestRightExpReference : Fragment() {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setupListeners()
|
||||
|
||||
if (viewModel.isReferenceDone && viewModel.sampleReadCounter <= Constants.MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE)
|
||||
moveToSamplePage()
|
||||
// if (DataHolder.isReferenceTaken)
|
||||
// moveToSamplePage()
|
||||
//
|
||||
if (viewModel.deviceConstant == null) {
|
||||
sendCmdToFetchDeviceConstant()
|
||||
// DataHolder.sampleReadCounter <= Constants.MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE
|
||||
|
||||
if (DataHolder.deviceConstant == null) {
|
||||
viewModel.progressBar.postValue(true)
|
||||
Handler(Looper.getMainLooper()).postDelayed({ sendCmdToFetchDeviceConstant() }, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
private fun testing(commands: TestRightCommands) {
|
||||
viewModel.progressBar.postValue(true)
|
||||
val fullReadOutput = StringBuilder()
|
||||
(activity as TestRightActivity).mService.eventDrivenWrite(TestRightCommands.printInRange,
|
||||
object : UsbServiceListener {
|
||||
override fun onUsbRead(data: ByteArray?) {
|
||||
data?.let {
|
||||
val stringData = String(it)
|
||||
fullReadOutput.append(stringData)
|
||||
Log.d(TAG, fullReadOutput.toString())
|
||||
|
||||
if (stringData.contains("OK", true)) {
|
||||
Log.d(TAG, "onUsbRead() called in sendCmdToFetchLightIntensities()")
|
||||
viewModel.mapIntensityValues(fullReadOutput.toString(), true)
|
||||
viewModel.isReferenceDone = true
|
||||
viewModel.progressBar.postValue(false)
|
||||
moveToSamplePage()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onUsbError(e: Exception?) {
|
||||
Log.e(TAG, "onUsbIoError() called in writeUsbFetchDeviceConstant() -> $e")
|
||||
viewModel.progressBar.postValue(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
// override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
|
||||
// if (viewModel.progressBar.value != null){
|
||||
// return viewModel.progressBar.value!!
|
||||
// } else {
|
||||
// return false
|
||||
// }
|
||||
// }
|
||||
|
||||
private fun setupListeners() {
|
||||
binding.btnSetReference.setOnClickListener {
|
||||
@@ -91,30 +75,24 @@ class TestRightExpReference : Fragment() {
|
||||
|
||||
override fun onClickBtnTwo() {
|
||||
// Todo: Only for testing
|
||||
// testing(TestRightCommands.led2Set50)
|
||||
// testing(TestRightCommands.autoset)
|
||||
// testing(TestRightCommands.run)
|
||||
// requireActivity().runOnUiThread {
|
||||
testing(TestRightCommands.run)
|
||||
// }
|
||||
viewModel.progressBar.postValue(true)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
viewModel.progressBar.observe(viewLifecycleOwner) {
|
||||
// Log.d(TAG, "SURYA OBSERVER Activated outcome = $it")
|
||||
if (it) {
|
||||
binding.progressBar.visibility = View.VISIBLE
|
||||
binding.clParent.alpha = 0.5f
|
||||
binding.btnSetReference.isEnabled = false
|
||||
} else {
|
||||
binding.progressBar.visibility = View.GONE
|
||||
binding.clParent.alpha = 1f
|
||||
binding.btnSetReference.isEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
// binding.btnRead.setOnClickListener {
|
||||
//// Log.d(TAG, "clicked on text")
|
||||
//// val mService = (activity as TestRightActivity).mService
|
||||
//// mService.read()
|
||||
// Log.d(TAG, "FULL STRING IS -> $fullReadOutput")
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,22 +108,33 @@ class TestRightExpReference : Fragment() {
|
||||
// }
|
||||
}
|
||||
|
||||
// private fun sendCmdToFetchDeviceConstant(recursive: Boolean) {
|
||||
private fun sendCmdToFetchDeviceConstant() {
|
||||
Log.d(TAG, "sendCmdToFetchDeviceConstant() called")
|
||||
|
||||
viewModel.progressBar.postValue(true)
|
||||
val fullReadOutput = StringBuilder()
|
||||
|
||||
(activity as TestRightActivity).mService.eventDrivenWrite(TestRightCommands.read,
|
||||
object : UsbServiceListener {
|
||||
override fun onUsbRead(data: ByteArray?) {
|
||||
data?.let {
|
||||
val stringData = String(it)
|
||||
fullReadOutput.append(stringData)
|
||||
|
||||
Log.d(TAG, "fullReadOutput = $fullReadOutput")
|
||||
if (stringData.contains("OK", true)) {
|
||||
Log.d(TAG, "onUsbRead() called in sendCmdToFetchDeviceConstant()")
|
||||
Log.d(
|
||||
TAG,
|
||||
"onUsbRead() called in sendCmdToFetchDeviceConstant() found OK"
|
||||
)
|
||||
viewModel.mapDeviceConstants(fullReadOutput.toString())
|
||||
viewModel.mapPixelNumberToWavelength()
|
||||
viewModel.progressBar.postValue(false)
|
||||
}
|
||||
// else if (recursive && stringData.contains("FINE", true)){
|
||||
// Log.d(TAG, "results = FINE and calling again")
|
||||
// viewModel.progressBar.postValue(false)
|
||||
// sendCmdToFetchDeviceConstant(false)
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,12 +266,12 @@ class TestRightExpReference : Fragment() {
|
||||
data?.let {
|
||||
val stringData = String(it)
|
||||
fullReadOutput.append(stringData)
|
||||
Log.d(TAG, stringData)
|
||||
// Log.d(TAG, stringData)
|
||||
|
||||
if (stringData.contains("OK", true)) {
|
||||
Log.d(TAG, "onUsbRead() called in sendCmdToFetchLightIntensities()")
|
||||
viewModel.mapIntensityValues(fullReadOutput.toString(), true)
|
||||
viewModel.isReferenceDone = true
|
||||
DataHolder.isReferenceTaken = true
|
||||
// viewModel.progressBar.postValue(false)
|
||||
|
||||
Handler(Looper.getMainLooper()).postDelayed(
|
||||
@@ -308,6 +297,65 @@ class TestRightExpReference : Fragment() {
|
||||
.commit()
|
||||
}
|
||||
|
||||
// private fun testWriteConnection() {
|
||||
// Log.d(TAG, "testWriteConnection() called")
|
||||
// viewModel.progressBar.postValue(true)
|
||||
//
|
||||
// val fullReadOutput = StringBuilder()
|
||||
// (activity as TestRightActivity).mService.eventDrivenWrite(TestRightCommands.testByEnter,
|
||||
// object : UsbServiceListener {
|
||||
// override fun onUsbRead(data: ByteArray?) {
|
||||
// data?.let {
|
||||
// val stringData = String(it)
|
||||
// fullReadOutput.append(stringData)
|
||||
// Log.d(TAG, "fullReadOutput = $fullReadOutput")
|
||||
//
|
||||
// Handler(Looper.getMainLooper()).postDelayed(
|
||||
// Runnable {
|
||||
// sendCmdToFetchDeviceConstant()
|
||||
// },
|
||||
// 2000
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onUsbError(e: Exception?) {
|
||||
// Log.e(TAG, "onUsbIoError() called in writeUsbFetchDeviceConstant() -> $e")
|
||||
// viewModel.progressBar.postValue(false)
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
// private fun testing(commands: TestRightCommands) {
|
||||
// viewModel.progressBar.postValue(true)
|
||||
// val fullReadOutput = StringBuilder()
|
||||
// (activity as TestRightActivity).mService.eventDrivenWrite(TestRightCommands.printInRange,
|
||||
// object : UsbServiceListener {
|
||||
// override fun onUsbRead(data: ByteArray?) {
|
||||
// data?.let {
|
||||
// val stringData = String(it)
|
||||
// fullReadOutput.append(stringData)
|
||||
// Log.d(TAG, fullReadOutput.toString())
|
||||
//
|
||||
//
|
||||
// if (stringData.contains("OK", true)) {
|
||||
// Log.d(TAG, "onUsbRead() called in sendCmdToFetchLightIntensities()")
|
||||
// viewModel.mapIntensityValues(fullReadOutput.toString(), true)
|
||||
// DataHolder.isReferenceTaken = true
|
||||
// viewModel.progressBar.postValue(false)
|
||||
// moveToSamplePage()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onUsbError(e: Exception?) {
|
||||
// Log.e(TAG, "onUsbIoError() called in writeUsbFetchDeviceConstant() -> $e")
|
||||
// viewModel.progressBar.postValue(false)
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
// private fun startReadingReference() {
|
||||
// val mService = (activity as TestRightActivity).mService
|
||||
// mService.eventDrivenWrite(TestRightCommands.print_all)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.example.refactoredapp.presentation.testRight
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
@@ -9,7 +10,10 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.example.refactoredapp.R
|
||||
import com.example.refactoredapp.data.DataHolder
|
||||
import com.example.refactoredapp.data.constant.Constants
|
||||
import com.example.refactoredapp.data.model.TestRightResultType
|
||||
import com.example.refactoredapp.databinding.FragmentTestRightResultsBinding
|
||||
import com.example.refactoredapp.presentation.MainActivity
|
||||
import com.example.refactoredapp.util.MyUtils
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
@@ -32,40 +36,92 @@ class TestRightResults : Fragment() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setupListeners()
|
||||
updateResults()
|
||||
saveCsv()
|
||||
saveLog()
|
||||
}
|
||||
|
||||
private fun setupListeners() {
|
||||
binding.ivHome.setOnClickListener {
|
||||
val i = Intent(requireContext().applicationContext, MainActivity::class.java)
|
||||
startActivity(i)
|
||||
}
|
||||
binding.ivNext.setOnClickListener {
|
||||
if (DataHolder.sampleReadCounter > Constants.MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE) {
|
||||
DataHolder.sampleReadCounter = 0
|
||||
DataHolder.isReferenceTaken = false
|
||||
parentFragmentManager.beginTransaction()
|
||||
.replace(R.id.fl_main, TestRightExpReference())
|
||||
.commit()
|
||||
} else {
|
||||
parentFragmentManager.beginTransaction().replace(R.id.fl_main, TestRightExpSample())
|
||||
.commit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun saveLog() {
|
||||
Log.d(TAG, "saveLog() called")
|
||||
|
||||
val sdfDate = SimpleDateFormat("ddMMyyyy HHmmss")
|
||||
val fileName: String = "log_" + sdfDate.format(Date()) + ".txt"
|
||||
|
||||
if (!DataHolder.isAppFolderCreated) {
|
||||
val folderPath = MyUtils().createAppFolder(requireContext().applicationContext)
|
||||
if (folderPath != null) {
|
||||
DataHolder.isAppFolderCreated = true
|
||||
DataHolder.appFolderPath = folderPath
|
||||
viewModel.saveLog(DataHolder.appFolderPath, fileName)
|
||||
}
|
||||
} else {
|
||||
viewModel.saveLog(DataHolder.appFolderPath, fileName)
|
||||
}
|
||||
}
|
||||
|
||||
private fun saveCsv() {
|
||||
Log.d(TAG, "saveCsv() called")
|
||||
|
||||
viewModel.calculateDataForCSV()
|
||||
// viewModel.mapWavelengthToAbsorbance()
|
||||
|
||||
// val fileName = "surya.csv"
|
||||
val sdfDate = SimpleDateFormat("ddMMyyyy HHmmss")
|
||||
val fileName: String = sdfDate.format(Date()) + ".csv"
|
||||
|
||||
if (!DataHolder.isAppFolderCreated){
|
||||
if (!DataHolder.isAppFolderCreated) {
|
||||
val folderPath = MyUtils().createAppFolder(requireContext().applicationContext)
|
||||
if (folderPath != null){
|
||||
if (folderPath != null) {
|
||||
DataHolder.isAppFolderCreated = true
|
||||
DataHolder.appFolderPath = folderPath
|
||||
viewModel.saveRawData(DataHolder.appFolderPath, fileName)
|
||||
viewModel.saveCsv(DataHolder.appFolderPath, fileName)
|
||||
}
|
||||
} else {
|
||||
viewModel.saveRawData(DataHolder.appFolderPath, fileName)
|
||||
viewModel.saveCsv(DataHolder.appFolderPath, fileName)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun updateResults() {
|
||||
binding.tvName.text = getString(R.string.name_in_textview, viewModel.patientDetails.name)
|
||||
binding.tvAge.text = getString(R.string.age_in_textview, viewModel.patientDetails.age.toString())
|
||||
binding.tvGender.text = getString(R.string.gender_in_textview, viewModel.patientDetails.gender)
|
||||
binding.tvAge.text =
|
||||
getString(R.string.age_in_textview, viewModel.patientDetails.age.toString())
|
||||
binding.tvGender.text =
|
||||
getString(R.string.gender_in_textview, viewModel.patientDetails.gender)
|
||||
|
||||
binding.tvResultValue.text = viewModel.patientDetails.results.toString()
|
||||
if (viewModel.patientDetails.results == "Negative"){
|
||||
// Setting color
|
||||
// binding.tvResultValue.text = viewModel.patientDetails.results.toString()
|
||||
when (viewModel.patientDetails.results) {
|
||||
TestRightResultType.NORMAL -> {
|
||||
binding.resultNormal.visibility = View.VISIBLE
|
||||
}
|
||||
TestRightResultType.SICKLECELLDISEASE -> {
|
||||
binding.resultDisease.visibility = View.VISIBLE
|
||||
}
|
||||
TestRightResultType.SICKLECELLTRAIT -> {
|
||||
binding.resultTrait.visibility = View.VISIBLE
|
||||
}
|
||||
else -> {
|
||||
binding.resultUndefined.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
// Log.d(TAG, "\n\n\n\nFor intensity Reference array size = ${viewModel.intensityReferenceArray.size}")
|
||||
@@ -80,6 +136,5 @@ class TestRightResults : Fragment() {
|
||||
// Log.d(TAG,"")
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,15 @@ package com.example.refactoredapp.presentation.testRight
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.example.refactoredapp.data.Constants
|
||||
import com.example.refactoredapp.data.constant.Constants
|
||||
import com.example.refactoredapp.data.DataHolder
|
||||
import com.example.refactoredapp.data.model.PatientData
|
||||
import com.example.refactoredapp.data.model.TestRightCalculationData
|
||||
import com.example.refactoredapp.data.model.TestRightDeviceConstants
|
||||
import com.example.refactoredapp.domain.ResultCalculationWithMaxImpl
|
||||
import com.example.refactoredapp.domain.SaveRawData
|
||||
import com.example.refactoredapp.domain.TestRightResultCalculation
|
||||
import java.lang.Exception
|
||||
import kotlin.math.log10
|
||||
import kotlin.math.pow
|
||||
|
||||
@@ -14,37 +19,44 @@ class TestRightViewModel : ViewModel() {
|
||||
|
||||
private val TAG = "TestRightViewModel"
|
||||
|
||||
var isReferenceDone = false
|
||||
// var isReferenceDone = false
|
||||
var isServiceConnected = false
|
||||
val progressBar = MutableLiveData(false)
|
||||
|
||||
val isUsbConnected = MutableLiveData(false)
|
||||
|
||||
lateinit var patientDetails: PatientData
|
||||
var sampleReadCounter = 0
|
||||
// var sampleReadCounter = 0
|
||||
|
||||
// var deviceConstant: TestRightDeviceConstants? = null
|
||||
private lateinit var calculationData: TestRightCalculationData
|
||||
|
||||
// /* Contains wavelength -> pixel no.*/
|
||||
// val wavelengthToPixelArray = ArrayList<Double>()
|
||||
//
|
||||
// /* (For reference/baseline) Contains pixel no. -> Intensity of light falling on that pixel */
|
||||
// private val intensityReferenceArray = ArrayList<Double>()
|
||||
|
||||
var deviceConstant: TestRightDeviceConstants? = null
|
||||
/* Contains wavelength -> pixel no.*/
|
||||
val wavelengthToPixelArray = ArrayList<ArrayList<Double>>()
|
||||
/* (For reference/baseline) Contains pixel no. -> Intensity of light falling on that pixel */
|
||||
val intensityReferenceArray = ArrayList<ArrayList<Double>>()
|
||||
/* (For exp sample) Contains pixel no. -> Intensity of light falling on that pixel */
|
||||
val intensitySampleArray = ArrayList<ArrayList<Double>>()
|
||||
private val intensitySampleArray = ArrayList<Double>()
|
||||
|
||||
val wavelengthToAbsorbance = ArrayList<ArrayList<Double>>()
|
||||
|
||||
|
||||
fun mapDeviceConstants(string: String) {
|
||||
Log.d(TAG, "mapDeviceConstants() called")
|
||||
// viewModelScope.launch {
|
||||
if (string.isNotEmpty()) {
|
||||
val listOfStrings = string.split(",")
|
||||
if (listOfStrings.size >= 4) {
|
||||
deviceConstant = TestRightDeviceConstants(
|
||||
DataHolder.deviceConstant = TestRightDeviceConstants(
|
||||
listOfStrings[0].trim(),
|
||||
listOfStrings[1].trim(),
|
||||
listOfStrings[2].trim(),
|
||||
listOfStrings[3].trim()
|
||||
)
|
||||
|
||||
mapPixelNumberToWavelength()
|
||||
} else {
|
||||
// Todo: Throws error
|
||||
}
|
||||
@@ -56,18 +68,19 @@ class TestRightViewModel : ViewModel() {
|
||||
|
||||
fun mapPixelNumberToWavelength() {
|
||||
// viewModelScope.launch {
|
||||
if (deviceConstant != null) {
|
||||
DataHolder.wavelengthToPixelArray.clear()
|
||||
if (DataHolder.deviceConstant != null) {
|
||||
for (x in 1..Constants.TEST_RIGHT_TOTAL_PIXEL) {
|
||||
val index = x - 1
|
||||
val wavelength: Double =
|
||||
(deviceConstant!!.a.toDouble() * (x.toDouble().pow((3).toDouble()))) +
|
||||
(deviceConstant!!.b.toDouble() * (x.toDouble().pow((2).toDouble()))) +
|
||||
(deviceConstant!!.c.toDouble() * x) +
|
||||
(deviceConstant!!.d.toDouble())
|
||||
(DataHolder.deviceConstant!!.a.toDouble() * (index.toDouble()
|
||||
.pow((3).toDouble()))) +
|
||||
(DataHolder.deviceConstant!!.b.toDouble() * (index.toDouble()
|
||||
.pow((2).toDouble()))) +
|
||||
(DataHolder.deviceConstant!!.c.toDouble() * index) +
|
||||
(DataHolder.deviceConstant!!.d.toDouble())
|
||||
|
||||
val temp = ArrayList<Double>(2)
|
||||
temp.add(wavelength)
|
||||
temp.add(x.toDouble())
|
||||
wavelengthToPixelArray.add(temp)
|
||||
DataHolder.wavelengthToPixelArray.add(wavelength)
|
||||
}
|
||||
} else {
|
||||
// Todo: Throws error
|
||||
@@ -77,6 +90,10 @@ class TestRightViewModel : ViewModel() {
|
||||
|
||||
fun mapIntensityValues(fullString: String, isReference: Boolean) {
|
||||
// viewModelScope.launch {
|
||||
|
||||
if (isReference) DataHolder.intensityReferenceArray.clear()
|
||||
else intensitySampleArray.clear()
|
||||
|
||||
val listOfString = fullString.split("\n")
|
||||
|
||||
// Log.d(TAG, "inside mapIntensityValues() -> isReference = $isReference")
|
||||
@@ -90,19 +107,20 @@ class TestRightViewModel : ViewModel() {
|
||||
/* Removing trailing spaces and "Buf" from the string then taking lhs & rhs of ':' */
|
||||
val numbers = line.trim()
|
||||
.substring(3).split(":")
|
||||
Log.d(TAG, line)
|
||||
if (numbers.size >= 2) {
|
||||
val temp = ArrayList<Double>(2)
|
||||
temp.add(numbers[0].toDouble())
|
||||
temp.add(numbers[1].toDouble())
|
||||
// val temp = ArrayList<Double>(2)
|
||||
// temp.add(numbers[0].toDouble())
|
||||
// temp.add(numbers[1].toDouble())
|
||||
|
||||
// if(!isReference){
|
||||
// Log.d(TAG, "temp[0] = ${temp[0]} & temp[1] = ${temp[1]}")
|
||||
// }
|
||||
|
||||
if (isReference)
|
||||
intensityReferenceArray.add(temp)
|
||||
DataHolder.intensityReferenceArray.add(numbers[1].toDouble())
|
||||
else
|
||||
intensitySampleArray.add(temp)
|
||||
intensitySampleArray.add(numbers[1].toDouble())
|
||||
} else {
|
||||
// Todo: Error handling
|
||||
}
|
||||
@@ -111,128 +129,101 @@ class TestRightViewModel : ViewModel() {
|
||||
// }
|
||||
}
|
||||
|
||||
// fun mapWavelengthToAbsorbance(){
|
||||
// var indexInReference = intensityReferenceArray.size - 1
|
||||
// var indexInSample = intensitySampleArray.size - 1
|
||||
// for (each in wavelengthToPixelArray){
|
||||
// val wavelength = each[0]
|
||||
// val invertedPixel = (Constants.TEST_RIGHT_TOTAL_PIXEL + 1) - each[1]
|
||||
//
|
||||
// var Io = 0.0
|
||||
// if (intensityReferenceArray[indexInReference][0].toInt() == invertedPixel.toInt()){
|
||||
// Io = intensityReferenceArray[indexInReference][1]
|
||||
// }
|
||||
//
|
||||
// var I = 0.0
|
||||
// if (intensitySampleArray[indexInSample][0].toInt() == invertedPixel.toInt()){
|
||||
// I = intensitySampleArray[indexInSample][1]
|
||||
// }
|
||||
//
|
||||
// val absorbance = log10(Io/I)
|
||||
//
|
||||
// val temp = ArrayList<Double>(2)
|
||||
// temp.add(wavelength)
|
||||
// temp.add(absorbance)
|
||||
// wavelengthToAbsorbance.add(temp)
|
||||
//
|
||||
// indexInReference--
|
||||
// indexInSample--
|
||||
// }
|
||||
// }
|
||||
|
||||
fun calculateDataForCSV(){
|
||||
var indexInReference = intensityReferenceArray.size - 1
|
||||
var indexInSample = intensitySampleArray.size - 1
|
||||
for (each in wavelengthToPixelArray){
|
||||
val wavelength = each[0]
|
||||
val invertedPixel = (Constants.TEST_RIGHT_TOTAL_PIXEL + 1) - each[1]
|
||||
fun mapWavelengthToAbsorbance() {
|
||||
if (DataHolder.intensityReferenceArray.size != intensitySampleArray.size || DataHolder.wavelengthToPixelArray.size != intensitySampleArray.size || DataHolder.wavelengthToPixelArray.size != DataHolder.intensityReferenceArray.size) {
|
||||
throw Exception("Inconsistency in the data, size of arrays are not same. \nintensityReferenceArray.size = ${DataHolder.intensityReferenceArray.size} ; intensitySampleArray.size = ${intensitySampleArray.size} ; wavelengthToPixelArray.size = ${DataHolder.wavelengthToPixelArray.size}")
|
||||
}
|
||||
|
||||
var Io = 0.0
|
||||
if (intensityReferenceArray[indexInReference][0].toInt() == invertedPixel.toInt()){
|
||||
Io = intensityReferenceArray[indexInReference][1]
|
||||
}
|
||||
wavelengthToAbsorbance.clear()
|
||||
// Index pointing to last of the array
|
||||
// var indexInIntensityArrays = intensityReferenceArray.size - 1
|
||||
// for ((index,wavelength) in wavelengthToPixelArray.withIndex()) {
|
||||
for (index in 0 until DataHolder.wavelengthToPixelArray.size) {
|
||||
|
||||
var I = 0.0
|
||||
if (intensitySampleArray[indexInSample][0].toInt() == invertedPixel.toInt()){
|
||||
I = intensitySampleArray[indexInSample][1]
|
||||
}
|
||||
|
||||
val absorbance = log10(Io/I)
|
||||
// Todo: handle indexInIntensityArrays <0
|
||||
|
||||
val invertedPixelIndex = (Constants.TEST_RIGHT_TOTAL_PIXEL) - (index + 1)
|
||||
|
||||
val i0 = DataHolder.intensityReferenceArray[invertedPixelIndex]
|
||||
// if (intensityReferenceArray[indexInIntensityArrays][0].toInt() == invertedPixelIndex.toInt()) {
|
||||
// Io = intensityReferenceArray[indexInIntensityArrays][1]
|
||||
// } else {
|
||||
// // Not needed - As you are calculating index and also checking the size of all 3 array before
|
||||
// throw Exception("Inconsistency in the data, pixel not found in intensity reference array \n pixel in intensityReferenceArray = ${intensityReferenceArray[indexInIntensityArrays][0]} & inverted pixel value = ${invertedPixelIndex.toInt()}")
|
||||
// }
|
||||
|
||||
val i1 = intensitySampleArray[invertedPixelIndex]
|
||||
// if (intensitySampleArray[indexInIntensityArrays][0].toInt() == invertedPixelIndex.toInt()) {
|
||||
// I = intensitySampleArray[indexInIntensityArrays][1]
|
||||
// } else {
|
||||
// // Not needed - As you are calculating index and also checking the size of all 3 array before
|
||||
// throw Exception("Inconsistency in the data, pixel not found in intensity sample array \n pixel in intensitySampleArray = ${intensitySampleArray[indexInIntensityArrays][0]} & inverted pixel value = ${invertedPixelIndex.toInt()}")
|
||||
// }
|
||||
|
||||
// if (I==0.0 || Io == 0.0){
|
||||
// throw Exception("error in data calculation I = $I & Io = $Io")
|
||||
// }
|
||||
|
||||
val absorbance = log10(i0 / i1)
|
||||
val wavelength = DataHolder.wavelengthToPixelArray[index]
|
||||
val temp = ArrayList<Double>(2)
|
||||
temp.add(wavelength)
|
||||
temp.add(absorbance)
|
||||
wavelengthToAbsorbance.add(temp)
|
||||
|
||||
indexInReference--
|
||||
indexInSample--
|
||||
// indexInIntensityArrays--
|
||||
}
|
||||
}
|
||||
|
||||
fun saveRawData(folderPath: String, filename: String) {
|
||||
SaveRawData().saveCsv(folderPath, filename, wavelengthToAbsorbance)
|
||||
}
|
||||
|
||||
fun calculateResults() {
|
||||
Log.d(TAG, "DEBUGGINGGGGG--------------------------------------------------------------------------------")
|
||||
sampleReadCounter++
|
||||
DataHolder.sampleReadCounter++
|
||||
|
||||
var pixelNoWithWave_427 = 0;
|
||||
var pixelNoWithWave_555 = 0;
|
||||
// patientDetails.results = ResultCalculationZeroImpl().getResults(wavelengthToPixelArray, intensityReferenceArray, intensitySampleArray)
|
||||
|
||||
Log.d(TAG, "wavelengthToPixelArray size = ${wavelengthToPixelArray.size}")
|
||||
// println("wavelengthToPixelArray size = ${wavelengthToPixelArray.size}")
|
||||
for (each in wavelengthToPixelArray){
|
||||
var diff = each[0] - 427
|
||||
if (pixelNoWithWave_427 == 0 && diff >= 0 && diff < 1){
|
||||
pixelNoWithWave_427 = each[1].toInt()
|
||||
}
|
||||
|
||||
diff = each[0] - 555
|
||||
if (pixelNoWithWave_555 == 0 && diff >= 0 && diff < 1){
|
||||
pixelNoWithWave_555 = each[1].toInt()
|
||||
}
|
||||
|
||||
if (pixelNoWithWave_427 != 0 && pixelNoWithWave_555 != 0) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Log.d(TAG, "pixelOfInterest_427 = ${pixelNoWithWave_427}")
|
||||
Log.d(TAG, "pixelOfInterest_555 = ${pixelNoWithWave_555}")
|
||||
|
||||
// println("pixelOfInterest_427 = ${pixelNoWithWave_427}")
|
||||
// println("pixelOfInterest_555 = ${pixelNoWithWave_555}")
|
||||
|
||||
val invertedPixel_427 = (Constants.TEST_RIGHT_TOTAL_PIXEL + 1) - pixelNoWithWave_427
|
||||
val invertedPixel_555 = (Constants.TEST_RIGHT_TOTAL_PIXEL + 1) - pixelNoWithWave_555
|
||||
|
||||
var io_427 = 0.0
|
||||
var io_555 = 0.0
|
||||
|
||||
for (each in intensityReferenceArray){
|
||||
if (each[0].toInt() == invertedPixel_427){
|
||||
io_427 = each[1]
|
||||
}
|
||||
if (each[0].toInt() == invertedPixel_555){
|
||||
io_555 = each[1]
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "I0 values are I0_427 = $io_427 , IO_555 = $io_555")
|
||||
// println("I0 values are I0_427 = $io_427 , IO_555 = $io_555")
|
||||
|
||||
var i_427 = 0.0
|
||||
var i_555 = 0.0
|
||||
|
||||
for (each in intensitySampleArray){
|
||||
if (each[0].toInt() == invertedPixel_427){
|
||||
i_427 = each[1]
|
||||
}
|
||||
if (each[0].toInt() == invertedPixel_555){
|
||||
i_555 = each[1]
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "I values are I_427 = $i_427 , I_555 = $i_555")
|
||||
// println("I values are I_427 = $i_427 , I_555 = $i_555")
|
||||
|
||||
val absorbanceAtPixelWithWave_427 = log10(io_427/i_427)
|
||||
val absorbanceAtPixelWithWave_555 = log10(io_555/i_555)
|
||||
Log.d(TAG, "absorbance values are for 427 = $absorbanceAtPixelWithWave_427 , for 555 = $absorbanceAtPixelWithWave_555")
|
||||
// println("absorbance values are for 427 = $absorbanceAtPixelWithWave_427 , for 555 = $absorbanceAtPixelWithWave_555")
|
||||
|
||||
var value = 0.0;
|
||||
if (absorbanceAtPixelWithWave_427 != 0.0 && absorbanceAtPixelWithWave_555 != 0.0) {
|
||||
value = absorbanceAtPixelWithWave_555 / absorbanceAtPixelWithWave_427
|
||||
}
|
||||
Log.d(TAG, "value = $value")
|
||||
// println("value = $value")
|
||||
|
||||
var results: String = ""
|
||||
if (value < 0.24 || value == 0.0) {
|
||||
results = "Normal"
|
||||
} else if (value >= 0.24 && value < 0.30) {
|
||||
results = "Sickle Cell Trait"
|
||||
} else if (value >= 0.30) {
|
||||
results = "Sickle-Cell Disease"
|
||||
}
|
||||
|
||||
Log.d(TAG, "Results = $results")
|
||||
// println("Results = $results")
|
||||
patientDetails.results = results
|
||||
|
||||
val resultCalculation: TestRightResultCalculation = ResultCalculationWithMaxImpl()
|
||||
calculationData = resultCalculation.getResults(wavelengthToAbsorbance)
|
||||
// patientDetails.results = resultCalculation.getResults(wavelengthToAbsorbance)
|
||||
patientDetails.results = calculationData.result
|
||||
|
||||
}
|
||||
|
||||
fun saveCsv(folderPath: String, filename: String) {
|
||||
SaveRawData().saveCsv(folderPath, filename, wavelengthToAbsorbance)
|
||||
}
|
||||
|
||||
fun saveLog(appFolderPath: String, fileName: String) {
|
||||
SaveRawData().saveLog(appFolderPath, fileName, calculationData)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import android.hardware.usb.UsbDeviceConnection
|
||||
import android.os.Binder
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import com.example.refactoredapp.data.Constants
|
||||
import com.example.refactoredapp.data.constant.Constants
|
||||
import com.example.refactoredapp.data.constant.TestRightCommands
|
||||
import com.example.refactoredapp.presentation.UsbServiceListener
|
||||
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
tools:context=".presentation.testRight.TestRightExpReference">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
@@ -91,14 +91,15 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/line" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_result_value"
|
||||
android:id="@+id/result_normal"
|
||||
style="@style/title3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:background="@drawable/result_background_green"
|
||||
android:drawablePadding="4dp"
|
||||
android:text="@string/negative"
|
||||
android:text="@string/normal"
|
||||
android:visibility="gone"
|
||||
app:drawableStartCompat="@drawable/ic_baseline_check_circle_24"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_result"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -106,37 +107,89 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_result"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_result" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/result_disease"
|
||||
style="@style/title3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:background="@drawable/result_background_red"
|
||||
android:drawablePadding="4dp"
|
||||
android:visibility="gone"
|
||||
android:text="@string/sickle_cell_disease"
|
||||
app:drawableStartCompat="@drawable/ic_baseline_cancel_24"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_result"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_result"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_result" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/result_trait"
|
||||
style="@style/title3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:background="@drawable/result_background_red"
|
||||
android:drawablePadding="4dp"
|
||||
android:visibility="gone"
|
||||
android:text="@string/sickle_cell_trait"
|
||||
app:drawableStartCompat="@drawable/ic_baseline_cancel_24"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_result"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_result"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_result" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/result_undefined"
|
||||
style="@style/title3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:background="@drawable/result_background_yellow"
|
||||
android:drawablePadding="4dp"
|
||||
android:visibility="gone"
|
||||
android:text="@string/undefined"
|
||||
app:drawableStartCompat="@drawable/ic_baseline_circle_24"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_result"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_result"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_result" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_download"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="42dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:src="@drawable/ic_baseline_file_download_24"
|
||||
app:layout_constraintStart_toStartOf="@id/cv_sample_details"
|
||||
app:layout_constraintTop_toBottomOf="@id/cv_sample_details" />
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/iv_download"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginTop="42dp"-->
|
||||
<!-- android:layout_marginStart="24dp"-->
|
||||
<!-- android:src="@drawable/ic_baseline_file_download_24"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="@id/cv_sample_details"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/cv_sample_details" />-->
|
||||
|
||||
<TextView
|
||||
style="@style/title3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/download_report"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/gray"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_download"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_download"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_download" />
|
||||
<!-- <TextView-->
|
||||
<!-- style="@style/title3"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text="@string/download_report"-->
|
||||
<!-- android:textAlignment="center"-->
|
||||
<!-- android:textColor="@color/gray"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="@id/iv_download"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="@id/iv_download"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/iv_download" />-->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_home"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="42dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:src="@drawable/ic_baseline_home_24"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_download"
|
||||
app:layout_constraintStart_toStartOf="@id/cv_sample_details"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_next"
|
||||
app:layout_constraintTop_toBottomOf="@id/cv_sample_details" />
|
||||
|
||||
@@ -158,7 +211,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="42dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:src="@drawable/ic_baseline_new_label_24"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_home"
|
||||
app:layout_constraintEnd_toEndOf="@id/cv_sample_details"
|
||||
app:layout_constraintTop_toBottomOf="@id/cv_sample_details" />
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<resources>
|
||||
<string name="app_name">Refactored App</string>
|
||||
<string name="app_name">HPOS</string>
|
||||
|
||||
<string-array name="instrument">
|
||||
<item>TestRight</item>
|
||||
@@ -58,5 +58,14 @@
|
||||
<string name="home">Home</string>
|
||||
<string name="new_test">New Test</string>
|
||||
<string name="start_now">Start Now</string>
|
||||
<string name="hemo_cube">Hemo Cube</string>
|
||||
<string name="hb">Hb</string>
|
||||
<string name="normal">Normal\ \ </string>
|
||||
<string name="sickle_cell_disease">Sickle Cell Disease\ \ </string>
|
||||
<string name="sickle_cell_trait">Sickle Cell Trait\ \ </string>
|
||||
<string name="undefined">Undefined\ \ </string>
|
||||
<string name="sicklecell_nconfirmatory">Sicklecell\nConfirmatory</string>
|
||||
<string name="sicklecell_screening">Sicklecell Screening</string>
|
||||
<string name="thalassemia">Thalassemia</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user