Integrated testing with patient registration. [Test Mode - USBSerial]
This commit is contained in:
@@ -13,8 +13,8 @@ android {
|
||||
applicationId "com.example.hpos"
|
||||
minSdk 21
|
||||
targetSdk 33
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
versionCode 2
|
||||
versionName "2.0.1"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@@ -55,7 +55,14 @@ dependencies {
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.2'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.5.2'
|
||||
|
||||
// Firebase
|
||||
implementation 'com.google.firebase:firebase-firestore-ktx:24.4.1'
|
||||
implementation 'com.google.firebase:firebase-storage-ktx:20.1.0'
|
||||
implementation 'com.google.android.gms:play-services-location:21.0.1'
|
||||
// implementation 'androidx.core:core-ktx:+'
|
||||
|
||||
// Testing
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.HPOS"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".presentation.KitScanActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".presentation.dashboard.DashboardActivity"
|
||||
android:exported="false"
|
||||
@@ -50,9 +53,9 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".presentation.testRight.TestRightActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false"
|
||||
android:parentActivityName=".presentation.MainActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan">
|
||||
|
||||
<!-- <intent-filter> -->
|
||||
@@ -66,8 +69,8 @@
|
||||
</activity> <!-- android:theme="@style/Theme.HPOS.ActionBar" -->
|
||||
<activity
|
||||
android:name=".presentation.MainActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true">
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
|
||||
</intent-filter>
|
||||
@@ -76,12 +79,11 @@
|
||||
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
|
||||
android:resource="@xml/device_filter" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.journeyapps.barcodescanner.CaptureActivity"
|
||||
android:screenOrientation="portrait"
|
||||
tools:replace="android:screenOrientation"
|
||||
android:stateNotNeeded="true"/>
|
||||
android:stateNotNeeded="true"
|
||||
tools:replace="android:screenOrientation" />
|
||||
|
||||
<meta-data
|
||||
android:name="preloaded_fonts"
|
||||
|
||||
@@ -8,4 +8,7 @@ class MyApplication : Application() {
|
||||
// fun getSampleDetails() : PatientDetails = sampleDetails
|
||||
// fun setSampleDetails(sample: SampleDetails) {sampleDetails = sample}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 1. firestore Database cache limit - full
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.example.hpos.data
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.example.hpos.data.model.test.TestDetails
|
||||
import com.example.hpos.data.model.test.TestRightDeviceConstants
|
||||
import com.example.hpos.data.model.test.TestType
|
||||
|
||||
@@ -24,4 +25,8 @@ object DataHolder {
|
||||
|
||||
/* (For reference/baseline) Contains pixel no. -> Intensity of light falling on that pixel */
|
||||
val intensityReferenceArray = ArrayList<Double>()
|
||||
|
||||
var selectedTest: TestDetails? = null
|
||||
|
||||
var testExp: Boolean = true
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.example.hpos.data
|
||||
|
||||
import com.example.hpos.data.model.patient.PatientDetails
|
||||
import com.example.hpos.data.model.test.TestDetails
|
||||
import com.google.firebase.firestore.FirebaseFirestore
|
||||
import com.google.firebase.firestore.Query
|
||||
import com.google.firebase.firestore.ktx.firestore
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import com.google.firebase.storage.FirebaseStorage
|
||||
import kotlinx.coroutines.tasks.await
|
||||
|
||||
class DatabaseRepository : Repository {
|
||||
|
||||
private val db: FirebaseFirestore = Firebase.firestore
|
||||
private val storage = FirebaseStorage.getInstance().reference
|
||||
|
||||
suspend fun addPatientToDatabase(data: PatientDetails) : Response<String> {
|
||||
return try {
|
||||
db.collection("patientData")
|
||||
.document(data.id)
|
||||
.set(data)
|
||||
.await()
|
||||
|
||||
Response.Success(data.id)
|
||||
} catch (e: Exception) {
|
||||
Response.Error(e)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getAllPatientsFromDatabase(): Response<List<PatientDetails>> {
|
||||
return try {
|
||||
val querySnapshot = db.collection("patientData").get().await()
|
||||
|
||||
val patientList = mutableListOf<PatientDetails>()
|
||||
for (doc in querySnapshot.documents){
|
||||
val patient = doc.toObject(PatientDetails::class.java)
|
||||
patient?.let {
|
||||
patientList.add(it)
|
||||
}
|
||||
}
|
||||
Response.Success(patientList)
|
||||
|
||||
} catch (e: Exception) {
|
||||
Response.Error(e)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun addTestToDatabase(data: TestDetails) : Response<String> {
|
||||
return try {
|
||||
db.collection("testData")
|
||||
.document(data.testID)
|
||||
.set(data)
|
||||
.await()
|
||||
|
||||
Response.Success(data.testID)
|
||||
} catch (e: Exception) {
|
||||
Response.Error(e)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getAllTestsFromDatabase(): List<TestDetails> {
|
||||
val testList = mutableListOf<TestDetails>()
|
||||
return try {
|
||||
val querySnapshot = db.collection("testData").orderBy("registeredTime", Query.Direction.DESCENDING).get().await()
|
||||
|
||||
for (doc in querySnapshot.documents){
|
||||
val patient = doc.toObject(TestDetails::class.java)
|
||||
patient?.let {
|
||||
testList.add(it)
|
||||
}
|
||||
}
|
||||
// Response.Success(testList)
|
||||
testList
|
||||
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
testList
|
||||
// Response.Error(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// suspend fun updateTestData(id: String, newTest: TestDetails, isUpdate): Boolean {
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.example.hpos.data
|
||||
|
||||
import com.example.hpos.data.model.test.TestInfo
|
||||
|
||||
interface Repository {
|
||||
suspend fun saveToDatabase(info: TestInfo)
|
||||
// suspend fun addToDatabase(data: PatientDetails)
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.example.hpos.data
|
||||
|
||||
import com.example.hpos.data.model.test.TestInfo
|
||||
|
||||
class RepositoryImpl : Repository {
|
||||
|
||||
override suspend fun saveToDatabase(info: TestInfo) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
7
app/src/main/java/com/example/hpos/data/Response.kt
Normal file
7
app/src/main/java/com/example/hpos/data/Response.kt
Normal file
@@ -0,0 +1,7 @@
|
||||
package com.example.hpos.data
|
||||
|
||||
sealed class Response<out R> {
|
||||
data class Success<out T>(val data: T) : Response<T>()
|
||||
data class Error(val exception: Exception) : Response<Nothing>()
|
||||
// object Loading : Response<Nothing>()
|
||||
}
|
||||
@@ -11,7 +11,7 @@ object Constants {
|
||||
|
||||
const val TEST_RIGHT_TOTAL_PIXEL = 3694
|
||||
|
||||
const val MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE = 9999
|
||||
const val MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE = 40
|
||||
|
||||
const val RANGE_IN_RESULT_CALCULATIONS = 10
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.example.hpos.data.model
|
||||
|
||||
data class Location(
|
||||
var latitude: Double?,
|
||||
var longitude: Double?
|
||||
) {
|
||||
constructor() : this(null, null)
|
||||
}
|
||||
@@ -18,7 +18,7 @@ data class PatientDetails(
|
||||
var address: Address?,
|
||||
var category: Category?,
|
||||
var registerDate: Date?,
|
||||
val uploadDate: Date?
|
||||
var uploadDate: Date?
|
||||
) {
|
||||
constructor() : this(
|
||||
"",
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.example.hpos.data.model.test
|
||||
|
||||
import com.example.hpos.data.model.Location
|
||||
import java.util.Date
|
||||
|
||||
data class TestDetails(
|
||||
val testID: String,
|
||||
var testStatus: Status,
|
||||
val patientID: String,
|
||||
val patientName: String,
|
||||
val patientAge: Int?,
|
||||
|
||||
var resultRatio: Double?,
|
||||
var result: TestRightResultType?,
|
||||
|
||||
val reportPath: String?,
|
||||
val csvPath: String?,
|
||||
val logPath: String?,
|
||||
|
||||
// Meta Data
|
||||
var deviceId: String?,
|
||||
val mobileId: String,
|
||||
var kitSerial: String?,
|
||||
val location: Location?,
|
||||
val appVersion: String,
|
||||
|
||||
val registeredTime: Date?,
|
||||
var uploadTime: Date?
|
||||
) {
|
||||
constructor() : this(
|
||||
"",
|
||||
Status.PENDING,
|
||||
"",
|
||||
"",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"",
|
||||
null,
|
||||
null,
|
||||
"",
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
|
||||
enum class Status {
|
||||
COMPLETED,
|
||||
PENDING,
|
||||
INPROGRESS
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package com.example.hpos.domain
|
||||
import android.util.Log
|
||||
import com.example.hpos.data.LocalFileRepository
|
||||
import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.data.model.PatientData
|
||||
import com.example.hpos.data.model.test.TestDetails
|
||||
import com.example.hpos.data.model.test.TestRightCalculationData
|
||||
import java.util.Collections.sort
|
||||
|
||||
@@ -98,7 +98,7 @@ class SaveRawData(private val localFileRepository: LocalFileRepository) {
|
||||
folderPath: String,
|
||||
fileName: String,
|
||||
calculationData: TestRightCalculationData,
|
||||
patientData: PatientData
|
||||
testDetails: TestDetails?
|
||||
) {
|
||||
// val fileObj = File(folderPath, fileName)
|
||||
// val writer = FileWriter(fileObj)
|
||||
@@ -110,18 +110,18 @@ class SaveRawData(private val localFileRepository: LocalFileRepository) {
|
||||
val fullPath = folderPath + fileName
|
||||
localFileRepository.saveTextToDisk(
|
||||
fullPath,
|
||||
getLogStringFromObjWithPatientData(calculationData, patientData)
|
||||
getLogStringFromObjWithPatientData(calculationData, testDetails)
|
||||
)
|
||||
}
|
||||
|
||||
private fun getLogStringFromObjWithPatientData(
|
||||
calculationData: TestRightCalculationData,
|
||||
patientData: PatientData
|
||||
testDetails: TestDetails?
|
||||
): String {
|
||||
var outputString = "Test calculation logs ==>\n"
|
||||
outputString += "Name = ${patientData.name}\n"
|
||||
outputString += "Age = ${patientData.age}\n"
|
||||
outputString += "Gender = ${patientData.gender}\n"
|
||||
outputString += "Name = ${testDetails?.patientName}\n"
|
||||
outputString += "ID = ${testDetails?.patientID}\n"
|
||||
// outputString += "Gender = ${patientData.gender}\n"
|
||||
outputString += "Absorbance one = ${
|
||||
String.format(
|
||||
"%.3f",
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.example.hpos.presentation
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.example.hpos.data.DataHolder
|
||||
import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.databinding.ActivityKitScanBinding
|
||||
import com.example.hpos.presentation.dashboard.DashboardActivity
|
||||
import com.example.hpos.presentation.testRight.TestRightActivity
|
||||
import com.journeyapps.barcodescanner.ScanContract
|
||||
import com.journeyapps.barcodescanner.ScanIntentResult
|
||||
import com.journeyapps.barcodescanner.ScanOptions
|
||||
|
||||
class KitScanActivity : AppCompatActivity() {
|
||||
|
||||
private val TAG = "KitScanActivity"
|
||||
private lateinit var binding: ActivityKitScanBinding
|
||||
|
||||
private val barcodeLauncher = registerForActivityResult(
|
||||
ScanContract()
|
||||
) { result: ScanIntentResult ->
|
||||
if (result.contents.isNullOrEmpty()) {
|
||||
Toast.makeText(this, "Cancelled: Unable to scan, Try Again!!", Toast.LENGTH_LONG).show()
|
||||
} else {
|
||||
Log.d(TAG, result.contents)
|
||||
processScannedData(result.contents)
|
||||
}
|
||||
}
|
||||
|
||||
private fun processScannedData(contents: String) {
|
||||
binding.nameEditText.setText(contents)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
binding = ActivityKitScanBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
if (DataHolder.sampleReadCounter <= Constants.MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE && DataHolder.isReferenceTaken){
|
||||
moveToNext()
|
||||
}
|
||||
|
||||
setSupportActionBar(binding.toolbar)
|
||||
|
||||
binding.btnScanNow.setOnClickListener {
|
||||
startScanningNow()
|
||||
}
|
||||
|
||||
binding.btnGo.setOnClickListener {
|
||||
if (binding.nameEditText.text.toString().trim().isNotEmpty() && checkDataNotNull()) {
|
||||
DataHolder.selectedTest!!.kitSerial = binding.nameEditText.text.toString()
|
||||
moveToNext()
|
||||
} else {
|
||||
Toast.makeText(this, "Invalid KIT Number", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun moveToNext() {
|
||||
val i = Intent(applicationContext, TestRightActivity::class.java)
|
||||
startActivity(i)
|
||||
}
|
||||
|
||||
private fun startScanningNow() {
|
||||
val options = ScanOptions()
|
||||
options.setDesiredBarcodeFormats(ScanOptions.QR_CODE)
|
||||
options.setPrompt("Scan a barcode")
|
||||
options.setCameraId(0) // Use a specific camera of the device
|
||||
|
||||
options.setBeepEnabled(true)
|
||||
options.setBarcodeImageEnabled(true)
|
||||
|
||||
options.setPrompt("Start Scanning")
|
||||
options.setOrientationLocked(false)
|
||||
// options.setTimeout(10000) // in ms
|
||||
|
||||
barcodeLauncher.launch(options)
|
||||
}
|
||||
|
||||
private fun checkDataNotNull(): Boolean {
|
||||
return if (DataHolder.selectedTest == null) {
|
||||
Toast.makeText(
|
||||
applicationContext,
|
||||
"Please Select patient before starting test",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
|
||||
val i = Intent(applicationContext, DashboardActivity::class.java)
|
||||
startActivity(i)
|
||||
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,13 +18,11 @@ import com.example.hpos.data.DataHolder
|
||||
import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.data.model.test.TestType
|
||||
import com.example.hpos.databinding.ActivityMainBinding
|
||||
import com.example.hpos.presentation.testRight.TestRightActivity
|
||||
import com.example.hpos.util.MyViewModelFactory
|
||||
import com.hoho.android.usbserial.driver.UsbSerialProber
|
||||
|
||||
|
||||
class MainActivity : AppCompatActivity()
|
||||
{
|
||||
class MainActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var binding: ActivityMainBinding
|
||||
private lateinit var viewModel: MainViewModel
|
||||
@@ -52,7 +50,7 @@ class MainActivity : AppCompatActivity()
|
||||
setContentView(binding.root)
|
||||
viewModel = ViewModelProvider(
|
||||
this,
|
||||
MyViewModelFactory(applicationContext)
|
||||
MyViewModelFactory()
|
||||
)[MainViewModel::class.java]
|
||||
|
||||
setSupportActionBar(binding.myToolbar)
|
||||
@@ -87,13 +85,18 @@ class MainActivity : AppCompatActivity()
|
||||
|
||||
binding.cvItem1.setOnClickListener {
|
||||
DataHolder.selectedTestType = TestType.SICKLECERT
|
||||
val i = Intent(applicationContext, TestRightActivity::class.java)
|
||||
|
||||
// val i = Intent(applicationContext, TestRightActivity::class.java)
|
||||
// startActivity(i)
|
||||
val i = Intent(applicationContext, KitScanActivity::class.java)
|
||||
startActivity(i)
|
||||
}
|
||||
|
||||
binding.cvItem2.setOnClickListener {
|
||||
DataHolder.selectedTestType = TestType.SICKLEFIND
|
||||
val i = Intent(applicationContext, TestRightActivity::class.java)
|
||||
// val i = Intent(applicationContext, TestRightActivity::class.java)
|
||||
// startActivity(i)
|
||||
val i = Intent(applicationContext, KitScanActivity::class.java)
|
||||
startActivity(i)
|
||||
}
|
||||
|
||||
@@ -107,18 +110,18 @@ class MainActivity : AppCompatActivity()
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Scan: Remove this line
|
||||
binding.cvItem3.setOnClickListener {
|
||||
val i = Intent(applicationContext, TestRightActivity::class.java)
|
||||
startActivity(i)
|
||||
}
|
||||
// binding.cvItem3.setOnClickListener {
|
||||
// val i = Intent(applicationContext, TestRightActivity::class.java)
|
||||
// startActivity(i)
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||
menuInflater.inflate(R.menu.my_menu, menu)
|
||||
myMenu = menu
|
||||
checkAndUpdateUsbConnection()
|
||||
// Todo: Uncomment this
|
||||
// checkAndUpdateUsbConnection()
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -3,37 +3,119 @@ package com.example.hpos.presentation
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.RadioButton
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.example.hpos.R
|
||||
import com.example.hpos.data.model.PatientData
|
||||
import com.example.hpos.data.model.test.Status
|
||||
import com.example.hpos.data.model.test.TestDetails
|
||||
import com.example.hpos.presentation.dashboard.ItemClickListener
|
||||
|
||||
|
||||
class RVAdapter : RecyclerView.Adapter<RVAdapter.ViewHolder>() {
|
||||
|
||||
private val dataset = ArrayList<PatientData>()
|
||||
// private lateinit var binding: TableItemBinding
|
||||
private val dataset = ArrayList<TestDetails>()
|
||||
|
||||
var itemClickListener: ItemClickListener? = null
|
||||
companion object {var selectedPosition = -1}
|
||||
|
||||
// private var lastChecked: CheckBox? = null
|
||||
// private var lastCheckedPos = 0
|
||||
|
||||
// This keeps track of the currently selected position
|
||||
// var selectedPosition by Delegates.observable(-1) { property, oldPos, newPos ->
|
||||
// if (newPos in dataset.indices) {
|
||||
// notifyItemChanged(oldPos)
|
||||
// notifyItemChanged(newPos)
|
||||
// }
|
||||
// }
|
||||
|
||||
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val tvId: TextView
|
||||
val tvName: TextView
|
||||
val tvStatus: TextView
|
||||
val radioButton: RadioButton
|
||||
|
||||
init {
|
||||
tvId = view.findViewById(R.id.tv_id)
|
||||
tvName = view.findViewById(R.id.tv_name)
|
||||
tvStatus = view.findViewById(R.id.tv_status)
|
||||
radioButton = view.findViewById(R.id.radioButton)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
return ViewHolder(
|
||||
LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.table_item, parent, false)
|
||||
)
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.table_item, parent, false)
|
||||
|
||||
return ViewHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val idString = "ID: " + dataset[position].patientID
|
||||
holder.tvId.text = idString
|
||||
holder.tvName.text = dataset[position].patientName
|
||||
holder.tvStatus.text = dataset[position].testStatus.toString()
|
||||
|
||||
if (dataset[position].testStatus == Status.PENDING) {
|
||||
holder.radioButton.isChecked = (position
|
||||
== selectedPosition)
|
||||
} else {
|
||||
holder.radioButton.isEnabled = false
|
||||
}
|
||||
|
||||
holder.radioButton.setOnCheckedChangeListener { compoundButton, b ->
|
||||
// check condition
|
||||
if (b) {
|
||||
// When checked update selected position
|
||||
selectedPosition = holder.adapterPosition
|
||||
itemClickListener!!.onClick(position)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return dataset.size
|
||||
}
|
||||
|
||||
fun updateDataSet(newDataSet: ArrayList<PatientData>) {
|
||||
fun updateDataSet(newDataSet: ArrayList<TestDetails>) {
|
||||
dataset.clear()
|
||||
dataset.addAll(newDataSet)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// inner class ViewHolder(itemView: TableItemBinding) : RecyclerView.ViewHolder(itemView.root) {
|
||||
// fun bind(item : TestDetails){
|
||||
// binding.apply {
|
||||
// tvId.text = item.patientID
|
||||
// tvName.text = item.patientName
|
||||
// tvStatus.text = item.testStatus.toString()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
// val inflater =LayoutInflater.from(parent.context)
|
||||
// binding = TableItemBinding.inflate(inflater,parent,false)
|
||||
// return ViewHolder(binding)
|
||||
// }
|
||||
//
|
||||
// override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
// holder.bind(dataset[position])
|
||||
// }
|
||||
//
|
||||
// override fun getItemCount(): Int {
|
||||
// return dataset.size
|
||||
// }
|
||||
//
|
||||
// fun updateDataSet(newDataSet: ArrayList<TestDetails>) {
|
||||
// dataset.clear()
|
||||
// dataset.addAll(newDataSet)
|
||||
// notifyDataSetChanged()
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -8,17 +8,18 @@ import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.example.hpos.data.DataHolder
|
||||
import com.example.hpos.databinding.ActivitySplashBinding
|
||||
import com.example.hpos.presentation.dashboard.DashboardActivity
|
||||
import com.example.hpos.util.MyUtils
|
||||
import com.google.firebase.firestore.FirebaseFirestoreSettings
|
||||
import com.google.firebase.firestore.ktx.firestore
|
||||
import com.google.firebase.ktx.Firebase
|
||||
|
||||
|
||||
/**
|
||||
@@ -31,6 +32,7 @@ class SplashActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivitySplashBinding
|
||||
var permissionStorage = false
|
||||
var permissionLocation = false
|
||||
var permissionLocation2 = false
|
||||
var permissionCamera = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@@ -38,8 +40,11 @@ class SplashActivity : AppCompatActivity() {
|
||||
binding = ActivitySplashBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
setupFirestoreCache()
|
||||
|
||||
checkForStoragePermissions()
|
||||
checkForLocationPermission()
|
||||
checkForLocationPermission2()
|
||||
// Keep this in last permission check, as checking all given or not after this
|
||||
checkForCameraPermission()
|
||||
|
||||
@@ -48,9 +53,16 @@ class SplashActivity : AppCompatActivity() {
|
||||
|
||||
}
|
||||
|
||||
private fun setupFirestoreCache() {
|
||||
val settings = FirebaseFirestoreSettings.Builder()
|
||||
.setCacheSizeBytes(FirebaseFirestoreSettings.CACHE_SIZE_UNLIMITED)
|
||||
.build()
|
||||
Firebase.firestore.firestoreSettings = settings
|
||||
}
|
||||
|
||||
private fun checkAllPermissionsGiven() {
|
||||
// Log.d("surya_permission", "inside checkAllPermissionsGiven")
|
||||
if (permissionStorage && permissionCamera && permissionLocation)
|
||||
if (permissionStorage && permissionCamera && permissionLocation && permissionLocation2)
|
||||
moveToLandingPage()
|
||||
}
|
||||
|
||||
@@ -176,6 +188,31 @@ class SplashActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkForLocationPermission2() {
|
||||
if (ContextCompat.checkSelfPermission(applicationContext, Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
== PackageManager.PERMISSION_DENIED
|
||||
) {
|
||||
val requestPermissionLauncher =
|
||||
registerForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted: Boolean ->
|
||||
if (isGranted) {
|
||||
permissionLocation2 = true
|
||||
checkAllPermissionsGiven()
|
||||
} else {
|
||||
Toast.makeText(
|
||||
this,
|
||||
"You must grant permission to Location to use the app",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
|
||||
requestPermissionLauncher.launch(Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
} else {
|
||||
permissionLocation2 = true
|
||||
checkAllPermissionsGiven()
|
||||
}
|
||||
}
|
||||
|
||||
private fun moveToLandingPage() {
|
||||
createAppFolder()
|
||||
// val i = Intent(applicationContext, MainActivity::class.java)
|
||||
|
||||
@@ -2,19 +2,18 @@ package com.example.hpos.presentation.dashboard
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import com.google.android.material.navigation.NavigationView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.drawerlayout.widget.DrawerLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.ui.AppBarConfiguration
|
||||
import androidx.navigation.ui.navigateUp
|
||||
import androidx.navigation.ui.setupActionBarWithNavController
|
||||
import androidx.navigation.ui.setupWithNavController
|
||||
import androidx.drawerlayout.widget.DrawerLayout
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.example.hpos.R
|
||||
import com.example.hpos.databinding.ActivityDashboardBinding
|
||||
import com.example.hpos.presentation.testRight.TestRightViewModel
|
||||
import com.example.hpos.util.MyViewModelFactory
|
||||
import com.google.android.material.navigation.NavigationView
|
||||
|
||||
class DashboardActivity : AppCompatActivity() {
|
||||
|
||||
@@ -48,7 +47,7 @@ class DashboardActivity : AppCompatActivity() {
|
||||
|
||||
viewModel = ViewModelProvider(
|
||||
this,
|
||||
MyViewModelFactory(this.applicationContext)
|
||||
MyViewModelFactory()
|
||||
)[DashboardViewModel::class.java]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,40 @@
|
||||
package com.example.hpos.presentation.dashboard
|
||||
|
||||
import android.content.Context
|
||||
import android.provider.Settings
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.example.hpos.BuildConfig
|
||||
import com.example.hpos.data.DatabaseRepository
|
||||
import com.example.hpos.data.Response
|
||||
import com.example.hpos.data.model.AadharCard
|
||||
import com.example.hpos.data.model.Location
|
||||
import com.example.hpos.data.model.patient.PatientDetails
|
||||
import com.example.hpos.data.model.test.Status
|
||||
import com.example.hpos.data.model.test.TestDetails
|
||||
import com.example.hpos.util.MyUtils
|
||||
import com.example.hpos.util.MyUtils.fetchYOBFromDOB
|
||||
import com.example.hpos.util.MyUtils.mapToGender
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.Calendar
|
||||
|
||||
class DashboardViewModel : ViewModel() {
|
||||
//class DashboardViewModel(val repository: DatabaseRepository) : ViewModel() {
|
||||
class DashboardViewModel() : ViewModel() {
|
||||
|
||||
private val TAG = "DashboardViewModel"
|
||||
lateinit var aadharCard: AadharCard
|
||||
lateinit var patientDetails: PatientDetails
|
||||
lateinit var testDetails: TestDetails
|
||||
var deviceLocation = Location(null, null)
|
||||
|
||||
val repository = DatabaseRepository()
|
||||
|
||||
val dataUploadStatus = MutableLiveData<Response<String>>()
|
||||
// val allTestDetails = MutableLiveData<Response<List<TestDetails>>>()
|
||||
val allTestDetails = MutableLiveData<List<TestDetails>>()
|
||||
|
||||
var temp = 1
|
||||
|
||||
|
||||
fun initializePatientDetails(patient: PatientDetails) {
|
||||
@@ -38,18 +64,63 @@ class DashboardViewModel : ViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun createTest(context: Context) {
|
||||
val mTestId = MyUtils.generateTestIdForPatient(patientDetails.id)
|
||||
val mMobileId = Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID)
|
||||
|
||||
testDetails = TestDetails(
|
||||
testID = mTestId,
|
||||
testStatus = Status.PENDING,
|
||||
patientID = patientDetails.id,
|
||||
patientName = patientDetails.name!!,
|
||||
patientAge = patientDetails.yob,
|
||||
resultRatio = null,
|
||||
result = null,
|
||||
reportPath = null,
|
||||
csvPath = null,
|
||||
logPath = null,
|
||||
deviceId = null,
|
||||
mobileId = mMobileId,
|
||||
kitSerial = null,
|
||||
location = deviceLocation,
|
||||
appVersion = BuildConfig.VERSION_CODE.toString(),
|
||||
registeredTime = Calendar.getInstance().time,
|
||||
uploadTime = Calendar.getInstance().time
|
||||
)
|
||||
|
||||
pushTestDetailsToDb()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ------- Cloud Actions ------------------------------------------
|
||||
|
||||
fun pushPatientDetailsToCloud() {
|
||||
// Synchronous Call Require
|
||||
TODO("Not yet implemented")
|
||||
fun pushPatientDetailsToDb() {
|
||||
patientDetails.uploadDate = Calendar.getInstance().time
|
||||
|
||||
viewModelScope.launch {
|
||||
val response = repository.addPatientToDatabase(patientDetails)
|
||||
dataUploadStatus.value = response
|
||||
}
|
||||
}
|
||||
|
||||
fun createTest() {
|
||||
TODO("Not yet implemented")
|
||||
private fun pushTestDetailsToDb() {
|
||||
testDetails.uploadTime = Calendar.getInstance().time
|
||||
|
||||
viewModelScope.launch {
|
||||
val response = repository.addTestToDatabase(testDetails)
|
||||
dataUploadStatus.value = response
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun fetchAllTestData() {
|
||||
viewModelScope.launch {
|
||||
val response = repository.getAllTestsFromDatabase()
|
||||
allTestDetails.postValue(response)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.example.hpos.databinding.FragmentGalleryBinding
|
||||
@@ -29,10 +28,10 @@ class GalleryFragment : Fragment() {
|
||||
_binding = FragmentGalleryBinding.inflate(inflater, container, false)
|
||||
val root: View = binding.root
|
||||
|
||||
val textView: TextView = binding.textGallery
|
||||
galleryViewModel.text.observe(viewLifecycleOwner) {
|
||||
textView.text = it
|
||||
}
|
||||
// val textView: TextView = binding.textGallery
|
||||
// galleryViewModel.text.observe(viewLifecycleOwner) {
|
||||
//// textView.text = it
|
||||
// }
|
||||
return root
|
||||
}
|
||||
|
||||
|
||||
@@ -1,42 +1,93 @@
|
||||
package com.example.hpos.presentation.dashboard
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.example.hpos.R
|
||||
import com.example.hpos.data.DataHolder
|
||||
import com.example.hpos.data.model.patient.PatientDetails
|
||||
import com.example.hpos.databinding.FragmentHomeBinding
|
||||
import com.example.hpos.presentation.dashboard.ui.home.HomeViewModel
|
||||
import com.example.hpos.presentation.RVAdapter
|
||||
|
||||
class HomeFragment : Fragment() {
|
||||
|
||||
val TAG = "HomeFragment"
|
||||
private var _binding: FragmentHomeBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
private val viewModel: DashboardViewModel by activityViewModels()
|
||||
// private val viewModel: DashboardViewModel by activityViewModels{ MyViewModelFactory() }
|
||||
|
||||
private lateinit var rvAdapter: RVAdapter
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = FragmentHomeBinding.inflate(inflater, container, false)
|
||||
try {
|
||||
_binding = FragmentHomeBinding.inflate(inflater, container, false)
|
||||
// DataHolder.selectedTest = TestDetails()
|
||||
|
||||
return binding.root
|
||||
rvAdapter = RVAdapter()
|
||||
val itemClickListener = object : ItemClickListener {
|
||||
override fun onClick(pos: Int) {
|
||||
// binding.recyclerView.post(Runnable { rvAdapter.notifyDataSetChanged() })
|
||||
rvAdapter.notifyDataSetChanged()
|
||||
DataHolder.selectedTest = viewModel.allTestDetails.value?.get(pos)
|
||||
}
|
||||
}
|
||||
rvAdapter.itemClickListener = itemClickListener
|
||||
|
||||
binding.recyclerView.layoutManager = LinearLayoutManager(requireContext())
|
||||
binding.recyclerView.adapter = rvAdapter
|
||||
|
||||
// Toast.makeText(requireActivity(), viewModel.temp, Toast.LENGTH_SHORT).show()
|
||||
// viewModel.temp++
|
||||
// Log.d(TAG, "viewmodel temp = ${viewModel.temp}")
|
||||
|
||||
return binding.root
|
||||
} catch (e: Exception){
|
||||
e.printStackTrace()
|
||||
Log.e(TAG, "onCreateView", e);
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setupObservers()
|
||||
viewModel.fetchAllTestData()
|
||||
|
||||
binding.btnAdd.setOnClickListener {
|
||||
viewModel.initializePatientDetails(PatientDetails())
|
||||
findNavController().navigate(R.id.action_nav_home_to_registerOneScanAbhaFragment)
|
||||
}
|
||||
binding.btnTest.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_nav_home_to_mainActivity)
|
||||
if (DataHolder.selectedTest != null)
|
||||
findNavController().navigate(R.id.action_nav_home_to_mainActivity)
|
||||
else
|
||||
Toast.makeText(requireContext(), "Select One Record to start testing", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupObservers() {
|
||||
viewModel.allTestDetails.observe(viewLifecycleOwner) {
|
||||
rvAdapter.updateDataSet(ArrayList(it))
|
||||
// when(it) {
|
||||
// is Response.Success -> {
|
||||
// rvAdapter.updateDataSet(ArrayList(it.data))
|
||||
// }
|
||||
// is Response.Error -> {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.example.hpos.presentation.dashboard
|
||||
|
||||
interface ItemClickListener {
|
||||
fun onClick(pos: Int)
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.example.hpos.databinding.FragmentSlideshowBinding
|
||||
@@ -29,10 +28,10 @@ class SlideshowFragment : Fragment() {
|
||||
_binding = FragmentSlideshowBinding.inflate(inflater, container, false)
|
||||
val root: View = binding.root
|
||||
|
||||
val textView: TextView = binding.textSlideshow
|
||||
slideshowViewModel.text.observe(viewLifecycleOwner) {
|
||||
textView.text = it
|
||||
}
|
||||
// val textView: TextView = binding.textSlideshow
|
||||
// slideshowViewModel.text.observe(viewLifecycleOwner) {
|
||||
// textView.text = it
|
||||
// }
|
||||
return root
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.journeyapps.barcodescanner.ScanContract
|
||||
import com.journeyapps.barcodescanner.ScanIntentResult
|
||||
import com.journeyapps.barcodescanner.ScanOptions
|
||||
import org.json.JSONObject
|
||||
import java.lang.Exception
|
||||
|
||||
|
||||
class RegisterOneScanAbhaFragment : Fragment() {
|
||||
@@ -47,17 +46,18 @@ class RegisterOneScanAbhaFragment : Fragment() {
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
binding = FragmentRegisterOneScanAbhaBinding.inflate(inflater, container, false)
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
// Toast.makeText(requireContext(), viewModel.temp, Toast.LENGTH_SHORT).show()
|
||||
viewModel.temp++
|
||||
Log.d(TAG, "viewmodel temp = ${viewModel.temp}")
|
||||
|
||||
binding.btnScanNow.setOnClickListener {
|
||||
// Todo: Remove this, add later
|
||||
// viewModel.patientDetails.name = "Surya"
|
||||
// viewModel.patientDetails.gender = PatientDetails.Gender.MALE
|
||||
// moveToRegisterThree()
|
||||
startScanningNow()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,36 +1,62 @@
|
||||
package com.example.hpos.presentation.dashboard.register
|
||||
|
||||
import android.Manifest
|
||||
import android.content.pm.PackageManager
|
||||
import android.location.Location
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.example.hpos.R
|
||||
import com.example.hpos.data.model.PatientData
|
||||
import com.example.hpos.data.Response
|
||||
import com.example.hpos.data.model.patient.PatientDetails
|
||||
import com.example.hpos.databinding.FragmentRegisterOneScanAbhaBinding
|
||||
import com.example.hpos.databinding.FragmentRegisterThreeEnterPatientDetailsBinding
|
||||
import com.example.hpos.presentation.dashboard.DashboardViewModel
|
||||
import com.example.hpos.util.MyUtils
|
||||
import com.example.hpos.util.MyUtils.mapToCategory
|
||||
import com.example.hpos.util.MyUtils.mapToGender
|
||||
import com.example.hpos.util.MyUtils.mapYesNoStringToBool
|
||||
import com.google.android.gms.location.FusedLocationProviderClient
|
||||
import com.google.android.gms.location.LocationCallback
|
||||
import com.google.android.gms.location.LocationRequest
|
||||
import com.google.android.gms.location.LocationResult
|
||||
import com.google.android.gms.location.LocationServices
|
||||
import java.util.Calendar
|
||||
|
||||
|
||||
class RegisterThreeEnterPatientDetails : Fragment() {
|
||||
|
||||
private val TAG = "RegisterThreeEnterPatientDetails"
|
||||
private val TAG = "RegisterThreeEnterPat"
|
||||
private lateinit var binding: FragmentRegisterThreeEnterPatientDetailsBinding
|
||||
private val viewModel: DashboardViewModel by activityViewModels()
|
||||
|
||||
private lateinit var fusedLocationClient: FusedLocationProviderClient
|
||||
private lateinit var locationCallback: LocationCallback
|
||||
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
binding = FragmentRegisterThreeEnterPatientDetailsBinding.inflate(inflater, container, false)
|
||||
|
||||
fusedLocationClient = LocationServices.getFusedLocationProviderClient(requireActivity())
|
||||
locationCallback = object : LocationCallback() {
|
||||
override fun onLocationResult(locationResult: LocationResult) {
|
||||
locationResult.lastLocation?.let { location ->
|
||||
viewModel.deviceLocation = com.example.hpos.data.model.Location(location.latitude, location.longitude)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getLocation()
|
||||
|
||||
binding =
|
||||
FragmentRegisterThreeEnterPatientDetailsBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@@ -38,12 +64,14 @@ class RegisterThreeEnterPatientDetails : Fragment() {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
prefillTexts()
|
||||
|
||||
setupObservers()
|
||||
|
||||
binding.btnSubmit.setOnClickListener {
|
||||
val mPatient = validateAndReturnPatientData()
|
||||
if(mPatient != null){
|
||||
if (mPatient != null) {
|
||||
viewModel.patientDetails = mPatient
|
||||
viewModel.pushPatientDetailsToCloud()
|
||||
viewModel.createTest()
|
||||
viewModel.pushPatientDetailsToDb()
|
||||
viewModel.createTest(requireContext())
|
||||
moveToNextPage()
|
||||
} else {
|
||||
Toast.makeText(requireContext(), "Fields can't be empty", Toast.LENGTH_SHORT).show()
|
||||
@@ -51,8 +79,36 @@ class RegisterThreeEnterPatientDetails : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupObservers() {
|
||||
viewModel.dataUploadStatus.observe(viewLifecycleOwner) {
|
||||
when (it) {
|
||||
is Response.Success -> {
|
||||
Log.d(TAG, "Patient details pushed to DB successfully")
|
||||
|
||||
// Directly pushing because of limitation of offline
|
||||
// Toast.makeText(
|
||||
// requireContext(),
|
||||
// "Patient Details Added successfully",
|
||||
// Toast.LENGTH_SHORT
|
||||
// ).show()
|
||||
//
|
||||
// viewModel.createTest(requireContext())
|
||||
}
|
||||
|
||||
is Response.Error -> {
|
||||
it.exception.printStackTrace()
|
||||
Toast.makeText(
|
||||
requireContext(),
|
||||
"Failed to add Patient Details, please try again.",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun moveToNextPage() {
|
||||
findNavController().navigate(R.id.action_registerThreeEnterPatientDetails_to_mainActivity)
|
||||
findNavController().navigate(R.id.action_registerThreeEnterPatientDetails_to_nav_home)
|
||||
}
|
||||
|
||||
private fun prefillTexts() {
|
||||
@@ -67,11 +123,15 @@ class RegisterThreeEnterPatientDetails : Fragment() {
|
||||
}
|
||||
|
||||
private fun validateAndReturnPatientData(): PatientDetails? {
|
||||
if (viewModel.patientDetails.id.isEmpty()){
|
||||
Toast.makeText(requireContext(), "Unable to get \"ABHA ID\" or \"AADHAAR NO\", please try again", Toast.LENGTH_LONG).show()
|
||||
if (viewModel.patientDetails.id.isEmpty()) {
|
||||
Toast.makeText(
|
||||
requireContext(),
|
||||
"Unable to get \"ABHA ID\" or \"AADHAAR NO\", please try again",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
|
||||
if (viewModel.patientDetails.address == null){
|
||||
if (viewModel.patientDetails.address == null) {
|
||||
viewModel.patientDetails.address = PatientDetails.Address()
|
||||
}
|
||||
|
||||
@@ -85,6 +145,9 @@ class RegisterThreeEnterPatientDetails : Fragment() {
|
||||
if (binding.etYob.text.isNullOrEmpty()) {
|
||||
binding.etYob.error = getString(R.string.yob_error)
|
||||
return null
|
||||
} else if (binding.etYob.text.toString().toInt() <= 1900 || binding.etYob.text.toString().toInt() > 2023) {
|
||||
binding.etYob.error = getString(R.string.yob_error_2)
|
||||
return null
|
||||
} else {
|
||||
viewModel.patientDetails.yob = binding.etYob.text.toString().toInt()
|
||||
}
|
||||
@@ -114,7 +177,8 @@ class RegisterThreeEnterPatientDetails : Fragment() {
|
||||
binding.etIsMarried.error = getString(R.string.this_error)
|
||||
return null
|
||||
} else {
|
||||
viewModel.patientDetails.isMarried = binding.etIsMarried.text.toString().mapYesNoStringToBool()
|
||||
viewModel.patientDetails.isMarried =
|
||||
binding.etIsMarried.text.toString().mapYesNoStringToBool()
|
||||
}
|
||||
|
||||
if (binding.etCategory.text.isNullOrEmpty()) {
|
||||
@@ -165,4 +229,81 @@ class RegisterThreeEnterPatientDetails : Fragment() {
|
||||
viewModel.patientDetails.registerDate = Calendar.getInstance().time
|
||||
return viewModel.patientDetails
|
||||
}
|
||||
|
||||
// private fun getLocation() {
|
||||
// locationManager = requireActivity().getSystemService(Context.LOCATION_SERVICE) as LocationManager
|
||||
// if ((ContextCompat.checkSelfPermission(requireContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
|
||||
// ActivityCompat.requestPermissions(requireActivity(), arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), locationPermissionCode)
|
||||
// }
|
||||
// locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 5f, this)
|
||||
// }
|
||||
|
||||
// private fun getLocation() {
|
||||
// fusedLocationClient = LocationServices.getFusedLocationProviderClient(requireActivity())
|
||||
// locationCallback = object : LocationCallback() {
|
||||
// override fun onLocationResult(locationResult: LocationResult) {
|
||||
// locationResult.lastLocation?.let { location ->
|
||||
// val latitude = location.latitude
|
||||
// val longitude = location.longitude
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
private fun requestLocationUpdates() {
|
||||
val locationRequest = LocationRequest.create().apply {
|
||||
interval = 10000 // Interval for receiving location updates (in milliseconds)
|
||||
fastestInterval = 5000 // Fastest interval for location updates (in milliseconds)
|
||||
priority = LocationRequest.PRIORITY_HIGH_ACCURACY // Location accuracy priority
|
||||
}
|
||||
|
||||
if (ActivityCompat.checkSelfPermission(
|
||||
requireContext(),
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
fusedLocationClient.requestLocationUpdates(locationRequest, locationCallback, null)
|
||||
}
|
||||
|
||||
private fun getLocation() {
|
||||
if (ActivityCompat.checkSelfPermission(
|
||||
requireContext(),
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
// Handle location permission request if needed
|
||||
Toast.makeText(requireContext(), "Please enable location services", Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
|
||||
fusedLocationClient.lastLocation
|
||||
.addOnSuccessListener { location: Location? ->
|
||||
location?.let {
|
||||
viewModel.deviceLocation = com.example.hpos.data.model.Location(it.latitude, it.longitude)
|
||||
} ?: run {
|
||||
requestLocationUpdates()
|
||||
}
|
||||
}
|
||||
.addOnFailureListener { exception: Exception ->
|
||||
exception.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private fun stopLocationUpdates() {
|
||||
fusedLocationClient.removeLocationUpdates(locationCallback)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
getLocation()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
stopLocationUpdates()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,11 +2,11 @@ package com.example.hpos.presentation.dashboard.register
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.example.hpos.R
|
||||
@@ -100,7 +100,7 @@ class RegisterTwoAadhaarFragment : Fragment() {
|
||||
|
||||
} catch (e: QrCodeException) {
|
||||
e.printStackTrace()
|
||||
Toast.makeText(requireContext(), "Unable to Fetch data, please try again!!", Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(requireContext(), "Unable to Fetch data, please scan again or enter manually!!", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
package com.example.hpos.presentation.testRight
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.content.*
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.ServiceConnection
|
||||
import android.hardware.usb.UsbDevice
|
||||
import android.hardware.usb.UsbDeviceConnection
|
||||
import android.hardware.usb.UsbManager
|
||||
import android.os.Bundle
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import android.view.*
|
||||
import android.view.Menu
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
@@ -20,7 +25,6 @@ import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.databinding.ActivityTestRightBinding
|
||||
import com.example.hpos.util.MyViewModelFactory
|
||||
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
||||
import com.hoho.android.usbserial.driver.UsbSerialProber
|
||||
|
||||
|
||||
class TestRightActivity : AppCompatActivity() {
|
||||
@@ -58,7 +62,9 @@ class TestRightActivity : AppCompatActivity() {
|
||||
val binder = service as UsbService.UsbServiceBinder
|
||||
mService = binder.getService()
|
||||
viewModel.isServiceConnected = true
|
||||
mConnection.let { mService.connect(mDriver, mConnection!!) }
|
||||
|
||||
// Todo: Uncomment this
|
||||
// mConnection.let { mService.connect(mDriver, mConnection!!) }
|
||||
moveToNext()
|
||||
}
|
||||
|
||||
@@ -73,19 +79,14 @@ class TestRightActivity : AppCompatActivity() {
|
||||
setContentView(binding.root)
|
||||
viewModel = ViewModelProvider(
|
||||
this,
|
||||
MyViewModelFactory(this.applicationContext)
|
||||
MyViewModelFactory()
|
||||
)[TestRightViewModel::class.java]
|
||||
|
||||
setSupportActionBar(binding.myToolbar)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
|
||||
// TODO Scan: Remove this line
|
||||
// supportFragmentManager.beginTransaction()
|
||||
// .replace(binding.flMain.id, TestRightExpScanner()).commit()
|
||||
|
||||
setupListener()
|
||||
|
||||
// TODO Scan: uncomment this line
|
||||
connectUsb(false)
|
||||
}
|
||||
|
||||
@@ -109,32 +110,40 @@ class TestRightActivity : AppCompatActivity() {
|
||||
// .replace(binding.flMain.id, TestRightExpSample()).commit()
|
||||
// }
|
||||
|
||||
// Todo: Comment this
|
||||
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)
|
||||
|
||||
if (availableDrivers.isEmpty()) {
|
||||
onErrorReported("No Device is Connected")
|
||||
} else {
|
||||
mDriver = availableDrivers[0]
|
||||
|
||||
if (mDriver.device.productId != Constants.DEVICE_PRODUCT_ID || mDriver.device.vendorId != Constants.DEVICE_VENDOR_ID){
|
||||
Toast.makeText(this, "Device Connected is not supported", Toast.LENGTH_SHORT).show()
|
||||
onBackPressed()
|
||||
return
|
||||
}
|
||||
DataHolder.deviceSerialNumber = mDriver.device.serialNumber.toString()
|
||||
mConnection = manager.openDevice(mDriver.device)
|
||||
|
||||
if (mConnection == null) {
|
||||
requestUserPermission(manager, mDriver.device)
|
||||
} else {
|
||||
setupService()
|
||||
}
|
||||
}
|
||||
setupService()
|
||||
}
|
||||
|
||||
// Todo: Uncomment this
|
||||
// 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)
|
||||
//
|
||||
// if (availableDrivers.isEmpty()) {
|
||||
// onErrorReported("No Device is Connected")
|
||||
// } else {
|
||||
// mDriver = availableDrivers[0]
|
||||
//
|
||||
// if (mDriver.device.productId != Constants.DEVICE_PRODUCT_ID || mDriver.device.vendorId != Constants.DEVICE_VENDOR_ID){
|
||||
// Toast.makeText(this, "Device Connected is not supported", Toast.LENGTH_SHORT).show()
|
||||
// onBackPressed()
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// viewModel.testDetails?.deviceId = mDriver.device.serialNumber.toString()
|
||||
// DataHolder.deviceSerialNumber = mDriver.device.serialNumber.toString()
|
||||
// mConnection = manager.openDevice(mDriver.device)
|
||||
//
|
||||
// if (mConnection == null) {
|
||||
// requestUserPermission(manager, mDriver.device)
|
||||
// } else {
|
||||
// setupService()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/*
|
||||
* Request user permission. The response will be received in the BroadcastReceiver
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.core.view.children
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.example.hpos.R
|
||||
@@ -256,6 +255,8 @@ class TestRightExpReference : Fragment() {
|
||||
Log.d(TAG, "sendCmdToFetchLightIntensities() called")
|
||||
viewModel.progressBar.postValue(true)
|
||||
val fullReadOutput = StringBuilder()
|
||||
|
||||
DataHolder.testExp = true
|
||||
(activity as TestRightActivity).mService.eventDrivenWrite(TestRightCommands.printAll,
|
||||
object : UsbServiceListener {
|
||||
override fun onUsbRead(data: ByteArray?) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.example.hpos.presentation.testRight
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
@@ -15,10 +16,9 @@ import com.example.hpos.data.PreferenceUtility
|
||||
import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.data.constant.TestRightCommands
|
||||
import com.example.hpos.data.model.ErrorMessage
|
||||
import com.example.hpos.data.model.PatientData
|
||||
import com.example.hpos.data.model.test.TestRightResultType
|
||||
import com.example.hpos.data.model.test.TestType
|
||||
import com.example.hpos.databinding.FragmentTestRightExpSampleBinding
|
||||
import com.example.hpos.presentation.MainActivity
|
||||
import com.example.hpos.presentation.UsbServiceListener
|
||||
import com.example.hpos.presentation.utils.MyDialogListener
|
||||
import com.example.hpos.presentation.utils.UIUtils
|
||||
@@ -74,9 +74,9 @@ class TestRightExpSample : Fragment() {
|
||||
}
|
||||
|
||||
binding.btnSubmit.setOnClickListener {
|
||||
val details = validateAndReturnPatientData()
|
||||
if (details != null) {
|
||||
viewModel.patientDetails = details
|
||||
// val details = validateAndReturnTestData()
|
||||
// if (details != null) {
|
||||
// viewModel.patientDetails = details
|
||||
|
||||
UIUtils.createAlertDialog(
|
||||
requireContext(),
|
||||
@@ -90,42 +90,26 @@ class TestRightExpSample : Fragment() {
|
||||
startAcquiring()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
binding.etNameBlock.setOnClickListener { binding.etName.isErrorEnabled = false }
|
||||
binding.etAgeBlock.setOnClickListener { binding.etAge.isErrorEnabled = false }
|
||||
binding.etGenderBlock.setOnClickListener { binding.ddGender.isErrorEnabled = false }
|
||||
}
|
||||
|
||||
private fun validateAndReturnPatientData(): PatientData? {
|
||||
val name = binding.etName.editText?.text?.trim()
|
||||
if (name.isNullOrEmpty()) {
|
||||
binding.etName.error = getString(R.string.name_error)
|
||||
return null
|
||||
} else {
|
||||
val regex = Regex("[|\\\\?*<\":>+\\[\\]'/]")
|
||||
if (regex.containsMatchIn(name)){
|
||||
binding.etName.error = getString(R.string.name_error_2)
|
||||
return null
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
val age = binding.etAge.editText?.text?.trim()
|
||||
if (age.isNullOrEmpty()) {
|
||||
binding.etAge.error = getString(R.string.age_error)
|
||||
return null
|
||||
} else if (age.toString().toInt() < 0 || age.toString().toInt() > 199) {
|
||||
binding.etAge.error = getString(R.string.age_error_out_of_bound)
|
||||
return null
|
||||
binding.tvSkip.setOnClickListener {
|
||||
DataHolder.sampleReadCounter = 0
|
||||
DataHolder.isReferenceTaken = false
|
||||
val i = Intent(requireContext(), MainActivity::class.java)
|
||||
startActivity(i)
|
||||
}
|
||||
val gender = binding.ddGender.editText?.text
|
||||
if (gender.isNullOrEmpty()) {
|
||||
binding.ddGender.error = getString(R.string.gender_error)
|
||||
return null
|
||||
}
|
||||
return PatientData(name.toString(), age.toString().toInt(), gender.toString(), TestRightResultType.UNDEFINED)
|
||||
|
||||
// binding.etNameBlock.setOnClickListener { binding.etName.isErrorEnabled = false }
|
||||
// binding.etAgeBlock.setOnClickListener { binding.etAge.isErrorEnabled = false }
|
||||
// binding.etGenderBlock.setOnClickListener { binding.ddGender.isErrorEnabled = false }
|
||||
}
|
||||
|
||||
// private fun validateAndReturnTestData(): TestDetails? {
|
||||
//
|
||||
// return PatientData(name.toString(), age.toString().toInt(), gender.toString(), TestRightResultType.UNDEFINED)
|
||||
// }
|
||||
|
||||
/**
|
||||
* Executing the commands sequentially each after successfully executing one.
|
||||
* 1. command run
|
||||
@@ -178,6 +162,8 @@ class TestRightExpSample : Fragment() {
|
||||
Log.d(TAG, "sendCmdToFetchLightIntensities() called")
|
||||
viewModel.progressBar.postValue(true)
|
||||
val fullReadOutput = StringBuilder()
|
||||
|
||||
DataHolder.testExp = false
|
||||
(activity as TestRightActivity).mService.eventDrivenWrite(TestRightCommands.printAll,
|
||||
object : UsbServiceListener {
|
||||
override fun onUsbRead(data: ByteArray?) {
|
||||
@@ -256,26 +242,46 @@ class TestRightExpSample : Fragment() {
|
||||
}
|
||||
|
||||
private fun saveDataLocally() {
|
||||
val patientName = viewModel.patientDetails.name
|
||||
val patientName = viewModel.testDetails?.patientName
|
||||
|
||||
// if (patientName.length > 5){
|
||||
// patientName = patientName.substring(0, 5)
|
||||
// }
|
||||
|
||||
val id = PreferenceUtility.generateId(requireContext())
|
||||
|
||||
// OLD ------------------------------
|
||||
// val prefixCsv: String = if (DataHolder.selectedTestType == TestType.SICKLECERT)
|
||||
// "HPOSSC_${DataHolder.deviceSerialNumber}_${patientName}_"
|
||||
// else
|
||||
// "HPOSSF_${DataHolder.deviceSerialNumber}_${patientName}_"
|
||||
|
||||
// NEW ------------------------------
|
||||
val prefixCsv: String = if (DataHolder.selectedTestType == TestType.SICKLECERT)
|
||||
"HPOSSC_${DataHolder.deviceSerialNumber}_${patientName}_"
|
||||
"HPOSSC_${viewModel.testDetails?.testID}"
|
||||
else
|
||||
"HPOSSF_${DataHolder.deviceSerialNumber}_${patientName}_"
|
||||
"HPOSSF_${viewModel.testDetails?.testID}"
|
||||
|
||||
// val prefixCsv = "HPOSSC_${DataHolder.deviceSerialNumber}_${patientName}_"
|
||||
val fileExtensionCsv = ".csv"
|
||||
val fileNameCsv = prefixCsv + id + fileExtensionCsv
|
||||
|
||||
// OLD ------------------------------
|
||||
// val fileNameCsv = prefixCsv + id + fileExtensionCsv
|
||||
// NEW ------------------------------
|
||||
val fileNameCsv = prefixCsv + fileExtensionCsv
|
||||
|
||||
saveCsv(fileNameCsv)
|
||||
|
||||
val prefixTxt = "log_${DataHolder.deviceSerialNumber}_${patientName}_"
|
||||
// OLD ------------------------------
|
||||
// val prefixTxt = "log_${DataHolder.deviceSerialNumber}_${patientName}_"
|
||||
// val fileExtensionTxt = ".txt"
|
||||
// val fileNameTxt = prefixTxt + id + fileExtensionTxt
|
||||
|
||||
// NEW ------------------------------
|
||||
val prefixTxt = "log_${viewModel.testDetails?.testID}"
|
||||
val fileExtensionTxt = ".txt"
|
||||
val fileNameTxt = prefixTxt + id + fileExtensionTxt
|
||||
val fileNameTxt = prefixTxt + fileExtensionTxt
|
||||
|
||||
saveLog(fileNameTxt)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
package com.example.hpos.presentation.testRight
|
||||
|
||||
import android.Manifest
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.example.hpos.R
|
||||
import com.example.hpos.databinding.FragmentTestRightExpSampleBinding
|
||||
import com.example.hpos.databinding.FragmentTestRightExpScannerBinding
|
||||
import com.journeyapps.barcodescanner.ScanContract
|
||||
import com.journeyapps.barcodescanner.ScanIntentResult
|
||||
import com.journeyapps.barcodescanner.ScanOptions
|
||||
|
||||
class TestRightExpScanner : Fragment() {
|
||||
|
||||
private lateinit var binding: FragmentTestRightExpScannerBinding
|
||||
private val viewModel: TestRightViewModel by activityViewModels()
|
||||
|
||||
val MY_CAMERA_REQUEST_CODE = 100
|
||||
private val TAG = "TestRightExpScanner"
|
||||
|
||||
val requestCameraPermission = registerForActivityResult( ActivityResultContracts.RequestPermission()) { isGranted ->
|
||||
if (isGranted){
|
||||
startCamera()
|
||||
} else {
|
||||
Toast.makeText(requireContext(), "Camera Permission is Required to Scan", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private val barcodeLauncher = registerForActivityResult(ScanContract()) { result: ScanIntentResult ->
|
||||
if (result.contents == null) {
|
||||
Toast.makeText(requireContext(), "Unsuccessful, Please Scan Again!! ", Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
viewModel.processEncodedScannedData(result.contents)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
binding = FragmentTestRightExpScannerBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
setupListeners()
|
||||
|
||||
}
|
||||
|
||||
private fun setupListeners() {
|
||||
binding.btnScanAadhaar.setOnClickListener {
|
||||
scanAadhaarCard()
|
||||
}
|
||||
binding.btnScanAbha.setOnClickListener {
|
||||
scanAbhaCard()
|
||||
}
|
||||
}
|
||||
|
||||
private fun scanAadhaarCard() {
|
||||
// Toast.makeText(requireContext(), "Scan Aadhaar Clicked", Toast.LENGTH_SHORT).show();
|
||||
requestCameraPermission.launch(Manifest.permission.CAMERA)
|
||||
}
|
||||
|
||||
private fun scanAbhaCard() {
|
||||
Toast.makeText(requireContext(), "Scan Abha Clicked", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
private fun startCamera() {
|
||||
Toast.makeText(requireContext(), "SUCESS CAMERA START", Toast.LENGTH_SHORT).show();
|
||||
|
||||
val options = ScanOptions()
|
||||
options.setDesiredBarcodeFormats(ScanOptions.QR_CODE)
|
||||
options.setPrompt("Scan a barcode")
|
||||
options.setCameraId(0) // Use a specific camera of the device
|
||||
|
||||
options.setBeepEnabled(true)
|
||||
options.setBarcodeImageEnabled(true)
|
||||
|
||||
options.setPrompt("Start Scanning")
|
||||
options.setOrientationLocked(false)
|
||||
// options.setTimeout(1000) // in ms
|
||||
|
||||
barcodeLauncher.launch(options)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,9 +16,9 @@ import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.data.model.test.TestRightResultType
|
||||
import com.example.hpos.data.model.test.TestType
|
||||
import com.example.hpos.databinding.FragmentTestRightResultsBinding
|
||||
import com.example.hpos.presentation.MainActivity
|
||||
import com.example.hpos.presentation.dashboard.DashboardActivity
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import java.util.Date
|
||||
|
||||
class TestRightResults : Fragment() {
|
||||
|
||||
@@ -40,32 +40,36 @@ class TestRightResults : Fragment() {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setupListeners()
|
||||
updateResults()
|
||||
// saveCsv()
|
||||
// saveLog()
|
||||
|
||||
viewModel.addResultTestToDb()
|
||||
}
|
||||
|
||||
private fun setupListeners() {
|
||||
binding.ivHome.setOnClickListener {
|
||||
val i = Intent(requireContext().applicationContext, MainActivity::class.java)
|
||||
val i = Intent(requireContext().applicationContext, DashboardActivity::class.java)
|
||||
startActivity(i)
|
||||
}
|
||||
binding.ivNext.setOnClickListener {
|
||||
moveToSamplePage()
|
||||
val i = Intent(requireContext().applicationContext, DashboardActivity::class.java)
|
||||
startActivity(i)
|
||||
// moveToSamplePage()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateResults() {
|
||||
binding.tvName.text = getString(R.string.name_in_textview, viewModel.patientDetails.name)
|
||||
binding.tvName.text = getString(R.string.name_in_textview, viewModel.testDetails?.patientName)
|
||||
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)
|
||||
getString(R.string.age_in_textview, viewModel.testDetails?.patientAge.toString())
|
||||
// binding.tvGender.text =
|
||||
// getString(R.string.gender_in_textview, viewModel.patientDetails.gender)
|
||||
binding.tvId.text = getString(R.string.patient_id_in_tv, viewModel.testDetails?.patientID)
|
||||
|
||||
|
||||
//TODO: remove
|
||||
// viewModel.patientDetails.results = TestRightResultType.NEGATIVEBORDERLINE
|
||||
|
||||
if (DataHolder.selectedTestType == TestType.SICKLECERT){
|
||||
when (viewModel.patientDetails.results) {
|
||||
when (viewModel.testDetails?.result) {
|
||||
TestRightResultType.NORMAL -> {
|
||||
binding.resultNormal.visibility = View.VISIBLE
|
||||
}
|
||||
@@ -90,7 +94,7 @@ class TestRightResults : Fragment() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
when (viewModel.patientDetails.results) {
|
||||
when (viewModel.testDetails?.result) {
|
||||
TestRightResultType.SICKLECELLDISEASE -> {
|
||||
binding.resultDisease.visibility = View.VISIBLE
|
||||
binding.resultDisease.text = "Positive"
|
||||
@@ -105,10 +109,10 @@ class TestRightResults : Fragment() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (viewModel.patientDetails.age < 5) {
|
||||
binding.tvRecommended.visibility = View.VISIBLE
|
||||
binding.tvRecommended.text = getString(R.string.recommended_age)
|
||||
}
|
||||
// if (viewModel.patientDetails.age < 5) {
|
||||
// binding.tvRecommended.visibility = View.VISIBLE
|
||||
// binding.tvRecommended.text = getString(R.string.recommended_age)
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,20 +4,28 @@ import android.content.Context
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.example.hpos.data.DataHolder
|
||||
import com.example.hpos.data.DatabaseRepository
|
||||
import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.data.model.*
|
||||
import com.example.hpos.data.model.CalculationVariableForTest
|
||||
import com.example.hpos.data.model.ErrorMessage
|
||||
import com.example.hpos.data.model.test.Status
|
||||
import com.example.hpos.data.model.test.TestRightCalculationData
|
||||
import com.example.hpos.data.model.test.TestRightDeviceConstants
|
||||
import com.example.hpos.domain.*
|
||||
import com.example.hpos.domain.ResultCalculationWithMaxImpl
|
||||
import com.example.hpos.domain.SaveRawData
|
||||
import com.example.hpos.domain.SaveRawDataTest
|
||||
import com.example.hpos.domain.SickleFindResultCaluculationWithMaxImpl
|
||||
import com.example.hpos.domain.TestRightResultCalculation
|
||||
import com.example.hpos.util.MyUtils
|
||||
import kotlinx.coroutines.launch
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
import java.util.Date
|
||||
import kotlin.math.log10
|
||||
import kotlin.math.pow
|
||||
|
||||
class TestRightViewModel(private val saveRawData: SaveRawData, private val saveRawDataTest: SaveRawDataTest) : ViewModel() {
|
||||
class TestRightViewModel(private val saveRawData: SaveRawData, private val saveRawDataTest: SaveRawDataTest, private val repository: DatabaseRepository) : ViewModel() {
|
||||
|
||||
private val TAG = "TestRightViewModel"
|
||||
|
||||
@@ -28,7 +36,9 @@ class TestRightViewModel(private val saveRawData: SaveRawData, private val saveR
|
||||
val errorTriggered = MutableLiveData<ErrorMessage>()
|
||||
var numberOfSampleRun = 0
|
||||
|
||||
lateinit var patientDetails: PatientData
|
||||
// lateinit var patientDetails: PatientData
|
||||
|
||||
val testDetails = DataHolder.selectedTest
|
||||
|
||||
// var deviceConstant: TestRightDeviceConstants? = null
|
||||
private lateinit var calculationData: TestRightCalculationData
|
||||
@@ -241,7 +251,11 @@ class TestRightViewModel(private val saveRawData: SaveRawData, private val saveR
|
||||
val resultCalculation: TestRightResultCalculation = ResultCalculationWithMaxImpl()
|
||||
calculationData = resultCalculation.getResults(wavelengthToAbsorbance)
|
||||
// patientDetails.results = resultCalculation.getResults(wavelengthToAbsorbance)
|
||||
patientDetails.results = calculationData.result
|
||||
// patientDetails.results = calculationData.result
|
||||
|
||||
testDetails?.result = calculationData.result
|
||||
testDetails?.resultRatio = calculationData.ratioValue
|
||||
testDetails?.testStatus = Status.COMPLETED
|
||||
|
||||
}
|
||||
|
||||
@@ -250,7 +264,8 @@ class TestRightViewModel(private val saveRawData: SaveRawData, private val saveR
|
||||
val resultCalculation: TestRightResultCalculation =
|
||||
SickleFindResultCaluculationWithMaxImpl()
|
||||
calculationData = resultCalculation.getResults(wavelengthToAbsorbance)
|
||||
patientDetails.results = calculationData.result
|
||||
testDetails?.result = calculationData.result
|
||||
testDetails?.testStatus = Status.COMPLETED
|
||||
|
||||
}
|
||||
|
||||
@@ -347,7 +362,7 @@ class TestRightViewModel(private val saveRawData: SaveRawData, private val saveR
|
||||
folderPath!!,
|
||||
fileName,
|
||||
calculationData,
|
||||
patientDetails
|
||||
testDetails
|
||||
)
|
||||
} else {
|
||||
folderPath = MyUtils.createAppFolder(appContext)
|
||||
@@ -359,7 +374,7 @@ class TestRightViewModel(private val saveRawData: SaveRawData, private val saveR
|
||||
folderPath,
|
||||
fileName,
|
||||
calculationData,
|
||||
patientDetails
|
||||
testDetails
|
||||
)
|
||||
} else {
|
||||
// errorTriggered.postValue("Unable to save Log, Please try again")
|
||||
@@ -403,9 +418,14 @@ class TestRightViewModel(private val saveRawData: SaveRawData, private val saveR
|
||||
|
||||
// Scanner Fragment Related Members
|
||||
|
||||
fun processEncodedScannedData(contents: String) {
|
||||
// fun processEncodedScannedData(contents: String) {
|
||||
//
|
||||
// }
|
||||
|
||||
fun addResultTestToDb() {
|
||||
viewModelScope.launch {
|
||||
repository.addTestToDatabase(testDetails!!)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -6,12 +6,11 @@ import android.hardware.usb.UsbDeviceConnection
|
||||
import android.os.Binder
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.data.DataHolder
|
||||
import com.example.hpos.data.constant.TestRightCommands
|
||||
import com.example.hpos.presentation.UsbServiceListener
|
||||
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
||||
import com.hoho.android.usbserial.driver.UsbSerialPort
|
||||
import com.hoho.android.usbserial.util.SerialInputOutputManager
|
||||
import java.io.IOException
|
||||
|
||||
|
||||
@@ -33,37 +32,29 @@ class UsbService : Service() {
|
||||
return binder
|
||||
}
|
||||
|
||||
// fun connect(driver: UsbSerialDriver, connection: UsbDeviceConnection) {
|
||||
var listener: UsbServiceListener? = null
|
||||
fun connect(driver: UsbSerialDriver, connection: UsbDeviceConnection) {
|
||||
// Todo: Uncomment this
|
||||
// mPort = driver.ports[0] // Most devices have just one port (port 0)
|
||||
// mPort.open(connection)
|
||||
// mPort.setParameters(115200, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE)
|
||||
//
|
||||
// isUsbConnected = true
|
||||
// Log.d(TAG, "My Usb Connected ${mPort.driver}")
|
||||
// }
|
||||
|
||||
var listener: UsbServiceListener? = null
|
||||
fun connect(driver: UsbSerialDriver, connection: UsbDeviceConnection) {
|
||||
mPort = driver.ports[0] // Most devices have just one port (port 0)
|
||||
mPort.open(connection)
|
||||
mPort.setParameters(115200, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE)
|
||||
|
||||
isUsbConnected = true
|
||||
Log.d(TAG, "My Usb Connected ${mPort.driver}")
|
||||
|
||||
val usbIoManager = SerialInputOutputManager(mPort,
|
||||
object : SerialInputOutputManager.Listener{
|
||||
override fun onNewData(data: ByteArray?) {
|
||||
// Log.e(TAG, "onNewData() called inside eventDrivenWrite()")
|
||||
listener?.onUsbRead(data)
|
||||
}
|
||||
override fun onRunError(e: Exception?) {
|
||||
Log.e(TAG, "onRunError() called inside eventDrivenWrite()")
|
||||
listener?.onUsbError(e)
|
||||
}
|
||||
|
||||
})
|
||||
usbIoManager.start();
|
||||
// Log.d(TAG, "My Usb Connected ${mPort.driver}")
|
||||
//
|
||||
// val usbIoManager = SerialInputOutputManager(mPort,
|
||||
// object : SerialInputOutputManager.Listener{
|
||||
// override fun onNewData(data: ByteArray?) {
|
||||
//// Log.e(TAG, "onNewData() called inside eventDrivenWrite()")
|
||||
// listener?.onUsbRead(data)
|
||||
// }
|
||||
// override fun onRunError(e: Exception?) {
|
||||
// Log.e(TAG, "onRunError() called inside eventDrivenWrite()")
|
||||
// listener?.onUsbError(e)
|
||||
// }
|
||||
//
|
||||
// })
|
||||
// usbIoManager.start();
|
||||
}
|
||||
|
||||
fun disconnect() {
|
||||
@@ -74,21 +65,46 @@ class UsbService : Service() {
|
||||
}
|
||||
}
|
||||
|
||||
// Todo: comment this
|
||||
fun eventDrivenWrite(command: TestRightCommands, listener: UsbServiceListener) {
|
||||
this.listener = listener
|
||||
try {
|
||||
when (command) {
|
||||
TestRightCommands.autoset -> {
|
||||
this.listener!!.onUsbRead("OK".toByteArray())
|
||||
}
|
||||
TestRightCommands.led2Set50 -> {
|
||||
this.listener!!.onUsbRead("OK".toByteArray())
|
||||
}
|
||||
TestRightCommands.run -> {
|
||||
this.listener!!.onUsbRead("OK [0]".toByteArray())
|
||||
}
|
||||
TestRightCommands.read -> {
|
||||
this.listener!!.onUsbRead(InputData().inputRead.toByteArray())
|
||||
}
|
||||
TestRightCommands.printAll -> {
|
||||
if (DataHolder.testExp) {
|
||||
for (each in InputData().printForReference.lines()) {
|
||||
this.listener!!.onUsbRead((each + "\n").toByteArray())
|
||||
}
|
||||
} else {
|
||||
for (each in InputData().printForSample.lines()) {
|
||||
this.listener!!.onUsbRead((each + "\n").toByteArray())
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
this.listener!!.onUsbRead("OK".toByteArray())
|
||||
}
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
listener.onUsbError(e)
|
||||
}
|
||||
}
|
||||
|
||||
// Todo: Uncomment this
|
||||
// fun eventDrivenWrite(command: TestRightCommands, listener: UsbServiceListener) {
|
||||
// val usbIoManager = SerialInputOutputManager(mPort,
|
||||
// object : SerialInputOutputManager.Listener{
|
||||
// override fun onNewData(data: ByteArray?) {
|
||||
// Log.e(TAG, "onNewData() called inside eventDrivenWrite() :: command = ${command.command}")
|
||||
// listener.onUsbRead(data)
|
||||
// }
|
||||
// override fun onRunError(e: Exception?) {
|
||||
// Log.e(TAG, "onRunError() called inside eventDrivenWrite()")
|
||||
// listener.onUsbError(e)
|
||||
// }
|
||||
//
|
||||
// })
|
||||
// usbIoManager.start();
|
||||
//
|
||||
// this.listener = listener
|
||||
// try {
|
||||
// mPort.write(command.command.toByteArray(), Constants.WRITE_TIMEOUT_MILLIS)
|
||||
// } catch (e: IOException) {
|
||||
@@ -96,15 +112,6 @@ class UsbService : Service() {
|
||||
// }
|
||||
// }
|
||||
|
||||
fun eventDrivenWrite(command: TestRightCommands, listener: UsbServiceListener) {
|
||||
this.listener = listener
|
||||
try {
|
||||
mPort.write(command.command.toByteArray(), Constants.WRITE_TIMEOUT_MILLIS)
|
||||
} catch (e: IOException) {
|
||||
listener.onUsbError(e)
|
||||
}
|
||||
}
|
||||
|
||||
// fun write(command: TestRightCommands){
|
||||
// mPort.write(command.command.toByteArray(), Constants.WRITE_TIMEOUT_MILLIS)
|
||||
// }
|
||||
|
||||
@@ -6,6 +6,9 @@ import com.example.hpos.R
|
||||
import com.example.hpos.data.model.patient.PatientDetails
|
||||
import java.io.File
|
||||
import java.net.InetAddress
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
|
||||
object MyUtils {
|
||||
@@ -34,6 +37,11 @@ object MyUtils {
|
||||
}
|
||||
}
|
||||
|
||||
fun generateTestIdForPatient(patientId: String): String {
|
||||
val dateFormat = SimpleDateFormat("HHmm_ddMMyyyy", Locale.getDefault())
|
||||
return patientId + "_" + dateFormat.format(Date())
|
||||
}
|
||||
|
||||
fun String.mapToGender(): PatientDetails.Gender {
|
||||
return if (this.lowercase() == "m"|| this.lowercase() == "male") {
|
||||
PatientDetails.Gender.MALE
|
||||
@@ -60,6 +68,11 @@ object MyUtils {
|
||||
return this.substring(startIndex).toInt()
|
||||
}
|
||||
|
||||
fun Int.calculateAgeFromYOB(): Int {
|
||||
val currentY = SimpleDateFormat("yyyy_HHmmss").format(Date()).toInt()
|
||||
return (currentY - this)
|
||||
}
|
||||
|
||||
fun String.mapYesNoStringToBool(): Boolean {
|
||||
return this.lowercase() == "yes"
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.example.hpos.util
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.example.hpos.data.DatabaseRepository
|
||||
import com.example.hpos.data.LocalFileRepository
|
||||
import com.example.hpos.data.datasource.LocalFileDataSource
|
||||
import com.example.hpos.domain.SaveRawData
|
||||
@@ -11,16 +11,17 @@ import com.example.hpos.presentation.MainViewModel
|
||||
import com.example.hpos.presentation.dashboard.DashboardViewModel
|
||||
import com.example.hpos.presentation.testRight.TestRightViewModel
|
||||
|
||||
class MyViewModelFactory(private val context: Context) : ViewModelProvider.Factory {
|
||||
class MyViewModelFactory : ViewModelProvider.Factory {
|
||||
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||
if (modelClass.isAssignableFrom(MainViewModel::class.java))
|
||||
return MainViewModel() as T
|
||||
else if (modelClass.isAssignableFrom(TestRightViewModel::class.java)) {
|
||||
val repository = LocalFileRepository(LocalFileDataSource())
|
||||
return TestRightViewModel(SaveRawData(repository), SaveRawDataTest(repository)) as T
|
||||
return TestRightViewModel(SaveRawData(repository), SaveRawDataTest(repository), DatabaseRepository()) as T
|
||||
} else if (modelClass.isAssignableFrom(DashboardViewModel::class.java)) {
|
||||
// val repository = LocalFileRepository(LocalFileDataSource())
|
||||
// return DashboardViewModel(DatabaseRepository()) as T
|
||||
return DashboardViewModel() as T
|
||||
} else
|
||||
throw IllegalArgumentException("Unknown ViewModel class");
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.drawerlayout.widget.DrawerLayout 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"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:openDrawer="start">
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<include
|
||||
android:id="@+id/app_bar_dashboard"
|
||||
|
||||
137
app/src/main/res/layout/activity_kit_scan.xml
Normal file
137
app/src/main/res/layout/activity_kit_scan.xml
Normal file
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".presentation.KitScanActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/app_bar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:theme="@style/Theme.HPOS.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/Theme.HPOS.PopupOverlay" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
style="@style/title1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/scan_qr_code_of_the_kit"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/app_bar_layout" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_scan_now"
|
||||
android:layout_width="258dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_margin="24dp"
|
||||
android:drawableLeft="@drawable/baseline_qr_code_scanner_24"
|
||||
android:text="@string/scan_now"
|
||||
android:textColor="@color/black"
|
||||
app:backgroundTint="@color/blue_app_light"
|
||||
app:cornerRadius="100dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title" />
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/seperator1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="48dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_scan_now">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvText1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="@string/or"
|
||||
android:textColor="@color/gray" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_toLeftOf="@id/tvText1"
|
||||
android:background="@color/gray" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_toRightOf="@id/tvText1"
|
||||
android:background="@color/gray" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title2"
|
||||
style="@style/title1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="48dp"
|
||||
android:text="@string/enter_kit_serial_number_manually"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/seperator1" />
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/et_abha_id"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="20dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/btn_go"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title2">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/name_edit_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLength="16"
|
||||
android:inputType="text"
|
||||
android:hint="@string/serial_number" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_go"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="24dp"
|
||||
android:text="@string/go"
|
||||
app:cornerRadius="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/et_abha_id"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toEndOf="@id/et_abha_id"
|
||||
app:layout_constraintTop_toTopOf="@id/et_abha_id" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<fragment
|
||||
android:id="@+id/nav_host_fragment_content_dashboard"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
class="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:defaultNavHost="true"
|
||||
@@ -17,4 +17,5 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navGraph="@navigation/dashboard_navigation" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -33,6 +33,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="16dp"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Instructions"
|
||||
android:text="@string/baseline_instruction"
|
||||
android:layout_margin="16dp"
|
||||
style="@style/title1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -43,160 +43,160 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_subtitle1"
|
||||
style="@style/title2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/step3"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tv_subtitle1"-->
|
||||
<!-- style="@style/title2"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginHorizontal="24dp"-->
|
||||
<!-- android:layout_marginTop="16dp"-->
|
||||
<!-- android:text="@string/step3"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/tv_title" />-->
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_scan_aadhaar"
|
||||
android:layout_width="216dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:clickable="false"
|
||||
android:text="@string/scan_aadhaar_card"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_subtitle1" />
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/btn_scan_aadhaar"-->
|
||||
<!-- android:layout_width="216dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginHorizontal="16dp"-->
|
||||
<!-- android:clickable="false"-->
|
||||
<!-- android:text="@string/scan_aadhaar_card"-->
|
||||
<!-- android:textColor="@color/white"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/tv_subtitle1" />-->
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/cv_sample_details"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:cardElevation="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_scan_aadhaar">
|
||||
<!-- <com.google.android.material.card.MaterialCardView-->
|
||||
<!-- android:id="@+id/cv_sample_details"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginHorizontal="24dp"-->
|
||||
<!-- android:layout_marginTop="16dp"-->
|
||||
<!-- app:cardElevation="8dp"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/btn_scan_aadhaar">-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent">-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title_sample"
|
||||
style="@style/title2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:drawablePadding="8dp"
|
||||
android:text="@string/enter_patient_details"
|
||||
app:drawableStartCompat="@drawable/ic_baseline_create_24"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tv_title_sample"-->
|
||||
<!-- style="@style/title2"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_margin="16dp"-->
|
||||
<!-- android:drawablePadding="8dp"-->
|
||||
<!-- android:text="@string/enter_patient_details"-->
|
||||
<!-- app:drawableStartCompat="@drawable/ic_baseline_create_24"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/et_name"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:hint="@string/patient_name"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title_sample">
|
||||
<!-- <com.google.android.material.textfield.TextInputLayout-->
|
||||
<!-- android:id="@+id/et_name"-->
|
||||
<!-- style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_margin="16dp"-->
|
||||
<!-- android:hint="@string/patient_name"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/tv_title_sample">-->
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/et_name_block"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textPersonName" />
|
||||
<!-- <com.google.android.material.textfield.TextInputEditText-->
|
||||
<!-- android:id="@+id/et_name_block"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:inputType="textPersonName" />-->
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<!-- </com.google.android.material.textfield.TextInputLayout>-->
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/et_age"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:hint="@string/age"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/et_name">
|
||||
<!-- <com.google.android.material.textfield.TextInputLayout-->
|
||||
<!-- android:id="@+id/et_age"-->
|
||||
<!-- style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_margin="16dp"-->
|
||||
<!-- android:hint="@string/age"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/et_name">-->
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/et_age_block"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number" />
|
||||
<!-- <com.google.android.material.textfield.TextInputEditText-->
|
||||
<!-- android:id="@+id/et_age_block"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:inputType="number" />-->
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<!-- </com.google.android.material.textfield.TextInputLayout>-->
|
||||
|
||||
|
||||
<!-- <com.google.android.material.textfield.TextInputLayout-->
|
||||
<!-- android:id="@+id/et_gender"-->
|
||||
<!-- style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_margin="16dp"-->
|
||||
<!-- android:hint="@string/gender"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/et_age">-->
|
||||
<!-- <!– <com.google.android.material.textfield.TextInputLayout–>-->
|
||||
<!-- <!– android:id="@+id/et_gender"–>-->
|
||||
<!-- <!– style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"–>-->
|
||||
<!-- <!– android:layout_width="match_parent"–>-->
|
||||
<!-- <!– android:layout_height="wrap_content"–>-->
|
||||
<!-- <!– android:layout_margin="16dp"–>-->
|
||||
<!-- <!– android:hint="@string/gender"–>-->
|
||||
<!-- <!– app:layout_constraintBottom_toBottomOf="parent"–>-->
|
||||
<!-- <!– app:layout_constraintEnd_toEndOf="parent"–>-->
|
||||
<!-- <!– app:layout_constraintStart_toStartOf="parent"–>-->
|
||||
<!-- <!– app:layout_constraintTop_toBottomOf="@id/et_age">–>-->
|
||||
|
||||
<!-- <com.google.android.material.textfield.TextInputEditText-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content" />-->
|
||||
<!-- <!– <com.google.android.material.textfield.TextInputEditText–>-->
|
||||
<!-- <!– android:layout_width="match_parent"–>-->
|
||||
<!-- <!– android:layout_height="wrap_content" />–>-->
|
||||
|
||||
<!-- </com.google.android.material.textfield.TextInputLayout>-->
|
||||
<!-- <!– </com.google.android.material.textfield.TextInputLayout>–>-->
|
||||
|
||||
|
||||
<!-- style="@style/Widget.Material3.TextInputLayout.FilledBox.ExposedDropdownMenu"-->
|
||||
<!-- <!– style="@style/Widget.Material3.TextInputLayout.FilledBox.ExposedDropdownMenu"–>-->
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/dd_gender"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:hint="@string/gender"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/et_age">
|
||||
<!-- <com.google.android.material.textfield.TextInputLayout-->
|
||||
<!-- android:id="@+id/dd_gender"-->
|
||||
<!-- style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_margin="16dp"-->
|
||||
<!-- android:hint="@string/gender"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/et_age">-->
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/et_gender_block"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/gender"
|
||||
android:inputType="none"
|
||||
android:labelFor="@id/dd_gender"
|
||||
app:simpleItems="@array/gender" />
|
||||
<!-- <AutoCompleteTextView-->
|
||||
<!-- android:id="@+id/et_gender_block"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:hint="@string/gender"-->
|
||||
<!-- android:inputType="none"-->
|
||||
<!-- android:labelFor="@id/dd_gender"-->
|
||||
<!-- app:simpleItems="@array/gender" />-->
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<!-- </com.google.android.material.textfield.TextInputLayout>-->
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:id="@+id/cb_item1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:text="@string/is_patient_under_any_medication"
|
||||
app:layout_constraintTop_toBottomOf="@id/dd_gender"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
<!-- <com.google.android.material.checkbox.MaterialCheckBox-->
|
||||
<!-- android:id="@+id/cb_item1"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginTop="16dp"-->
|
||||
<!-- android:layout_marginHorizontal="16dp"-->
|
||||
<!-- android:text="@string/is_patient_under_any_medication"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/dd_gender"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"/>-->
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:id="@+id/cb_item2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:text="@string/is_patient_undergoing_any_blood_transfusion"
|
||||
app:layout_constraintTop_toBottomOf="@id/cb_item1"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
<!-- <com.google.android.material.checkbox.MaterialCheckBox-->
|
||||
<!-- android:id="@+id/cb_item2"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginHorizontal="16dp"-->
|
||||
<!-- android:text="@string/is_patient_undergoing_any_blood_transfusion"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/cb_item1"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"/>-->
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
|
||||
<!-- </com.google.android.material.card.MaterialCardView>-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_subtitle2"
|
||||
@@ -204,11 +204,11 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/step4"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cv_sample_details" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_subtitle3"
|
||||
@@ -216,7 +216,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/step5"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -261,6 +261,22 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_skip"
|
||||
style="@style/title1_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="36dp"
|
||||
android:text="@string/set_baseline_reference_again"
|
||||
android:textColor="@color/blue_app_dark"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_submit" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
@@ -1,133 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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=".presentation.testRight.TestRightExpScanner">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/btn_update_reference"-->
|
||||
<!-- android:layout_width="216dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginHorizontal="24dp"-->
|
||||
<!-- android:layout_marginTop="24dp"-->
|
||||
<!-- android:clickable="false"-->
|
||||
<!-- android:text="@string/update_reference"-->
|
||||
<!-- android:textColor="@color/white"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
|
||||
<!-- android:id="@+id/cl_instructions"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/btn_update_reference">-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
style="@style/title1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/patient_details"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_scan_aadhaar"
|
||||
android:layout_width="216dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:clickable="false"
|
||||
android:drawableLeft="@drawable/ic_baseline_camera_alt_24"
|
||||
android:text="@string/scan_aadhaar_card"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_subtitle1"
|
||||
style="@style/title2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:text="@string/or"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_scan_aadhaar" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_scan_abha"
|
||||
android:layout_width="216dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:clickable="false"
|
||||
android:drawableLeft="@drawable/ic_baseline_camera_alt_24"
|
||||
android:text="@string/scan_abha_card"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_subtitle1" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_subtitle2"
|
||||
style="@style/title2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:text="@string/or"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_scan_abha" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_enter_manually"
|
||||
android:layout_width="216dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:clickable="false"
|
||||
android:text="Enter Manually"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" />
|
||||
|
||||
|
||||
<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>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
@@ -34,26 +34,39 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_id"
|
||||
style="@style/title2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="14dp"
|
||||
android:text="@string/patient_id_in_tv"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
style="@style/title2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:text="@string/name_in_textview"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gender"
|
||||
style="@style/title2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="@string/gender_in_textview"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_name" />
|
||||
android:text="@string/name_in_textview"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_id"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tv_gender"-->
|
||||
<!-- style="@style/title2"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginHorizontal="16dp"-->
|
||||
<!-- android:layout_marginTop="4dp"-->
|
||||
<!-- android:text="@string/gender_in_textview"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/tv_name" />-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_age"
|
||||
@@ -64,7 +77,7 @@
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="@string/age_in_textview"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_gender" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_name" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/nav_header_height"
|
||||
android:background="@drawable/side_nav_bar"
|
||||
android:background="@color/blue_app"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
@@ -18,7 +18,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/nav_header_desc"
|
||||
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
||||
app:srcCompat="@mipmap/ic_launcher_round" />
|
||||
app:srcCompat="@mipmap/hpos_icon" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/blue_app_light"
|
||||
android:padding="8dp"
|
||||
android:layout_margin="8dp">
|
||||
|
||||
<RadioButton
|
||||
<androidx.appcompat.widget.AppCompatRadioButton
|
||||
android:id="@+id/radioButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_id"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_name" />
|
||||
app:layout_constraintTop_toTopOf="@id/tv_name"
|
||||
tools:checked="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
@@ -33,7 +36,7 @@
|
||||
style="@style/title1_2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ID: 12345678901234"
|
||||
android:text="ID: 12321312312"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintStart_toEndOf="@id/radioButton"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_name"/>
|
||||
@@ -41,6 +44,7 @@
|
||||
<TextView
|
||||
android:id="@+id/tv_status"
|
||||
style="@style/title1_1"
|
||||
android:textSize="16sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/pending"
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
<item
|
||||
android:id="@+id/nav_settings"
|
||||
android:icon="@drawable/baseline_settings_24"
|
||||
android:title="@string/menu_slideshow" />
|
||||
android:title="@string/menu_settings" />
|
||||
</group>
|
||||
</menu>
|
||||
@@ -21,13 +21,13 @@
|
||||
<fragment
|
||||
android:id="@+id/nav_profile"
|
||||
android:name="com.example.hpos.presentation.dashboard.GalleryFragment"
|
||||
android:label="@string/menu_gallery"
|
||||
android:label="@string/profile"
|
||||
tools:layout="@layout/fragment_gallery" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/nav_settings"
|
||||
android:name="com.example.hpos.presentation.dashboard.SlideshowFragment"
|
||||
android:label="@string/menu_slideshow"
|
||||
android:label="@string/action_settings"
|
||||
tools:layout="@layout/fragment_slideshow" />
|
||||
<fragment
|
||||
android:id="@+id/registerOneScanAbhaFragment"
|
||||
@@ -53,8 +53,8 @@
|
||||
android:name="com.example.hpos.presentation.dashboard.register.RegisterThreeEnterPatientDetails"
|
||||
android:label="Registration (3/3)" >
|
||||
<action
|
||||
android:id="@+id/action_registerThreeEnterPatientDetails_to_mainActivity"
|
||||
app:destination="@id/mainActivity" />
|
||||
android:id="@+id/action_registerThreeEnterPatientDetails_to_nav_home"
|
||||
app:destination="@id/nav_home" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/registerOneCreateAbha"
|
||||
|
||||
@@ -57,13 +57,14 @@
|
||||
|
||||
|
||||
<!-- Instructions Text -->
|
||||
<string name="Instructions">Instructions</string>
|
||||
<string name="Instructions">Testing Instructions</string>
|
||||
<string name="step1"><b><u>Step 1</u> : </b> Place the cuvette containing reference/baseline sample for referencing.</string>
|
||||
<string name="step2"><b><u>Step 2</u> : </b> Press the button below to start the device reading values.</string>
|
||||
|
||||
<string name="step3"><b><u>Step 1</u> : </b> Enter the sample details to start.</string>
|
||||
<string name="step4"><b><u>Step 2</u> : </b> Place the cuvette containing sample for experiment.</string>
|
||||
<string name="step5"><b><u>Step 3</u> : </b> Press the button below to start the device reading values.</string>
|
||||
<!-- <string name="step4"><b><u>Step 1</u> : </b> Place the cuvette containing sample for experiment.</string>-->
|
||||
<string name="step4"><b><u>Step 1</u> : </b> Place the cuvette containing blood sample mixed with kit solution.</string>
|
||||
<string name="step5"><b><u>Step 2</u> : </b> Press the button below to start the device reading values.</string>
|
||||
|
||||
|
||||
<string name="acquire">Acquire</string>
|
||||
@@ -77,6 +78,7 @@
|
||||
<string name="age_error_out_of_bound">Age should be valid</string>
|
||||
|
||||
<string name="yob_error">Year of birth can\'t be empty</string>
|
||||
<string name="yob_error_2">Invalid Year of Birth</string>
|
||||
<string name="mobile_error">Mobile Number can\'t be empty</string>
|
||||
<string name="this_error">This can\'t be empty</string>
|
||||
<!-- <string name="this_error">This can\'t be empty</string>-->
|
||||
@@ -125,19 +127,20 @@
|
||||
<string name="scan_now">Scan Now</string>
|
||||
<string name="enter_abha_number_manualy">Enter ABHA number manualy</string>
|
||||
<string name="abha_id">ABHA ID</string>
|
||||
<string name="patient_id_in_tv"><b>Patient ID</b> : %1$s</string>
|
||||
<string name="go">GO</string>
|
||||
<string name="click_here">Click Here</string>
|
||||
<string name="title_activity_dashboard">DashboardActivity</string>
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
<string name="nav_header_title">Android Studio</string>
|
||||
<string name="nav_header_subtitle">android.studio@android.com</string>
|
||||
<string name="nav_header_title">HPOS</string>
|
||||
<string name="nav_header_subtitle">sminnovations.in</string>
|
||||
<string name="nav_header_desc">Navigation header</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
|
||||
<string name="menu_home">Home</string>
|
||||
<string name="menu_gallery">Gallery</string>
|
||||
<string name="menu_slideshow">Slideshow</string>
|
||||
<string name="menu_settings">Settings</string>
|
||||
<string name="profile">Profile</string>
|
||||
<string name="year_of_birth">Year of Birth</string>
|
||||
<string name="father_s_name_husband_s_name">Father\'s Name / Husband\'s Name</string>
|
||||
@@ -156,7 +159,14 @@
|
||||
<string name="scan_patient_aadhaar_card">Scan Patient Aadhaar Card</string>
|
||||
<string name="enter_aadhaar_number_manualy">Enter Aadhaar number manualy</string>
|
||||
<string name="aadhaar_number">Aadhaar Number</string>
|
||||
<string name="aadhaar_in_tv"><b>Aadhaar Number</b></string>
|
||||
<string name="please_use_official_abha_app_to_create_abha_id_and_come_back">Please use “Official ABHA App" to create ABHA ID, and come back.</string>
|
||||
<string name="please_enter_aadhaar">Please Enter Aadhaar Number to continue</string>
|
||||
<string name="scan_qr_code_of_the_kit">Scan QR Code of the KIT</string>
|
||||
<string name="enter_kit_serial_number_manually">Enter KIT Serial Number manually</string>
|
||||
<string name="serial_number">Serial Number</string>
|
||||
<string name="set_baseline_reference_again">Set Baseline/Reference again?</string>
|
||||
<string name="baseline_instruction">Baseline Instruction</string>
|
||||
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user