WORKING COMMIT
This commit is contained in:
6
.idea/kotlinc.xml
generated
Normal file
6
.idea/kotlinc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="KotlinJpsPluginSettings">
|
||||||
|
<option name="version" value="1.8.21" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
BIN
app/release/hpos-app.apk
Normal file
BIN
app/release/hpos-app.apk
Normal file
Binary file not shown.
20
app/release/output-metadata.json
Normal file
20
app/release/output-metadata.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"artifactType": {
|
||||||
|
"type": "APK",
|
||||||
|
"kind": "Directory"
|
||||||
|
},
|
||||||
|
"applicationId": "com.example.hpos",
|
||||||
|
"variantName": "release",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "SINGLE",
|
||||||
|
"filters": [],
|
||||||
|
"attributes": [],
|
||||||
|
"versionCode": 1,
|
||||||
|
"versionName": "1.0",
|
||||||
|
"outputFile": "app-release.apk"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"elementType": "File"
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
android:name=".MyApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
android:fullBackupContent="@xml/backup_rules"
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
<activity
|
<activity
|
||||||
android:name=".presentation.KitScanActivity"
|
android:name=".presentation.KitScanActivity"
|
||||||
|
android:noHistory="true"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".presentation.dashboard.DashboardActivity"
|
android:name=".presentation.dashboard.DashboardActivity"
|
||||||
@@ -56,6 +58,7 @@
|
|||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:parentActivityName=".presentation.MainActivity"
|
android:parentActivityName=".presentation.MainActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
|
android:noHistory="true"
|
||||||
android:windowSoftInputMode="adjustPan">
|
android:windowSoftInputMode="adjustPan">
|
||||||
|
|
||||||
<!-- <intent-filter> -->
|
<!-- <intent-filter> -->
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
package com.example.hpos
|
package com.example.hpos
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.SupervisorJob
|
||||||
|
|
||||||
class MyApplication : Application() {
|
class MyApplication : Application() {
|
||||||
|
|
||||||
|
val applicationScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
||||||
|
|
||||||
// private val sampleDetails = PatientDetails("Change it later");
|
// private val sampleDetails = PatientDetails("Change it later");
|
||||||
// fun getSampleDetails() : PatientDetails = sampleDetails
|
// fun getSampleDetails() : PatientDetails = sampleDetails
|
||||||
// fun setSampleDetails(sample: SampleDetails) {sampleDetails = sample}
|
// fun setSampleDetails(sample: SampleDetails) {sampleDetails = sample}
|
||||||
|
|||||||
@@ -1,4 +1,47 @@
|
|||||||
package com.example.hpos.data
|
package com.example.hpos.data
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
|
import com.example.hpos.data.model.Response
|
||||||
|
import com.example.hpos.data.repository.DatabaseRepository
|
||||||
|
import com.example.hpos.util.MyUtils
|
||||||
|
import kotlinx.coroutines.GlobalScope
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import java.lang.Thread.sleep
|
||||||
|
|
||||||
class FileUploader {
|
class FileUploader {
|
||||||
|
|
||||||
|
private val TAG = "FileUploader"
|
||||||
|
val repository = DatabaseRepository()
|
||||||
|
|
||||||
|
suspend fun start() {
|
||||||
|
|
||||||
|
val listOfFiles = repository.getAllFromPendingQueue()
|
||||||
|
|
||||||
|
for (each in listOfFiles){
|
||||||
|
// Checking internet connectivity & mobile as same or not
|
||||||
|
if (MyUtils.isInternetConnected() && each.mobileId == DataHolder.mobileUniqueId) {
|
||||||
|
|
||||||
|
Log.d(TAG, "uploading file ${each.pendingId}")
|
||||||
|
GlobalScope.launch {
|
||||||
|
val response = repository.uploadFileToStorage(each.patientId, each.filePath)
|
||||||
|
|
||||||
|
when (response) {
|
||||||
|
is Response.Success -> {
|
||||||
|
Log.d(TAG, "File Uploaded ${each.pendingId}")
|
||||||
|
repository.removeFromPendingQueue(each.pendingId)
|
||||||
|
}
|
||||||
|
|
||||||
|
is Response.Error -> {
|
||||||
|
Log.d(TAG, response.exception.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.join()
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,15 @@
|
|||||||
package com.example.hpos.data.model
|
package com.example.hpos.data.model
|
||||||
|
|
||||||
|
import java.util.Calendar
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
data class PendingUploads(
|
data class PendingUploads(
|
||||||
|
// Filename
|
||||||
val pendingId: String,
|
val pendingId: String,
|
||||||
val mobileId: String,
|
val mobileId: String,
|
||||||
val patientId: String,
|
val patientId: String,
|
||||||
val filePath: String,
|
val filePath: String,
|
||||||
val timeAdded: Date
|
val timeAdded: Date
|
||||||
)
|
) {
|
||||||
|
constructor(): this("", "", "", "", Calendar.getInstance().time)
|
||||||
|
}
|
||||||
|
|||||||
@@ -83,11 +83,11 @@ class DatabaseRepository : Repository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun uploadFileToStorage(id: String, filePath: String): Response<Boolean> {
|
suspend fun uploadFileToStorage(patientID: String, filePath: String): Response<Boolean> {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
val file = Uri.fromFile(File(filePath))
|
val file = Uri.fromFile(File(filePath))
|
||||||
val riversRef = storage.reference.child("$id/${file.lastPathSegment}")
|
val riversRef = storage.reference.child("$patientID/${file.lastPathSegment}")
|
||||||
riversRef.putFile(file).await()
|
riversRef.putFile(file).await()
|
||||||
return Response.Success(true)
|
return Response.Success(true)
|
||||||
|
|
||||||
@@ -111,10 +111,29 @@ class DatabaseRepository : Repository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun removeFromPendingQueue(pendingId: String): Response<Boolean> {
|
suspend fun getAllFromPendingQueue(): List<PendingUploads> {
|
||||||
|
val pendingList = mutableListOf<PendingUploads>()
|
||||||
|
return try {
|
||||||
|
val querySnapshot = db.collection("pendingUploads").orderBy("timeAdded").get().await()
|
||||||
|
|
||||||
|
for (doc in querySnapshot.documents){
|
||||||
|
val pendingFile = doc.toObject(PendingUploads::class.java)
|
||||||
|
pendingFile?.let {
|
||||||
|
pendingList.add(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pendingList
|
||||||
|
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
pendingList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun removeFromPendingQueue(fileName: String): Response<Boolean> {
|
||||||
return try {
|
return try {
|
||||||
db.collection("pendingUploads")
|
db.collection("pendingUploads")
|
||||||
.document(pendingId)
|
.document(fileName)
|
||||||
.delete()
|
.delete()
|
||||||
.await()
|
.await()
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.os.Bundle
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.example.hpos.R
|
||||||
import com.example.hpos.data.DataHolder
|
import com.example.hpos.data.DataHolder
|
||||||
import com.example.hpos.data.constant.Constants
|
import com.example.hpos.data.constant.Constants
|
||||||
import com.example.hpos.databinding.ActivityKitScanBinding
|
import com.example.hpos.databinding.ActivityKitScanBinding
|
||||||
@@ -51,7 +52,8 @@ class KitScanActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
binding.btnGo.setOnClickListener {
|
binding.btnGo.setOnClickListener {
|
||||||
if (binding.nameEditText.text.toString().trim().isNotEmpty() && checkDataNotNull()) {
|
val serialNumber = binding.nameEditText.text.toString().trim()
|
||||||
|
if (serialNumber.isNotEmpty() && checkDataNotNull() && isSerialValid(serialNumber)) {
|
||||||
DataHolder.selectedTest!!.kitSerial = binding.nameEditText.text.toString()
|
DataHolder.selectedTest!!.kitSerial = binding.nameEditText.text.toString()
|
||||||
moveToNext()
|
moveToNext()
|
||||||
} else {
|
} else {
|
||||||
@@ -60,6 +62,14 @@ class KitScanActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun isSerialValid(s: String): Boolean {
|
||||||
|
if (s.length != 17){
|
||||||
|
binding.nameEditText.error = getString(R.string.invalid_kit)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
private fun moveToNext() {
|
private fun moveToNext() {
|
||||||
val i = Intent(applicationContext, TestRightActivity::class.java)
|
val i = Intent(applicationContext, TestRightActivity::class.java)
|
||||||
startActivity(i)
|
startActivity(i)
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
menuInflater.inflate(R.menu.my_menu, menu)
|
menuInflater.inflate(R.menu.my_menu, menu)
|
||||||
myMenu = menu
|
myMenu = menu
|
||||||
// Todo: Uncomment this
|
// Todo: Uncomment this
|
||||||
// checkAndUpdateUsbConnection()
|
checkAndUpdateUsbConnection()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package com.example.hpos.presentation
|
package com.example.hpos.presentation
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.RadioButton
|
import android.widget.RadioButton
|
||||||
|
import android.widget.RadioGroup
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.example.hpos.R
|
import com.example.hpos.R
|
||||||
@@ -36,12 +38,14 @@ class RVAdapter : RecyclerView.Adapter<RVAdapter.ViewHolder>() {
|
|||||||
val tvName: TextView
|
val tvName: TextView
|
||||||
val tvStatus: TextView
|
val tvStatus: TextView
|
||||||
val radioButton: RadioButton
|
val radioButton: RadioButton
|
||||||
|
val radioGroup: RadioGroup
|
||||||
|
|
||||||
init {
|
init {
|
||||||
tvId = view.findViewById(R.id.tv_id)
|
tvId = view.findViewById(R.id.tv_id)
|
||||||
tvName = view.findViewById(R.id.tv_name)
|
tvName = view.findViewById(R.id.tv_name)
|
||||||
tvStatus = view.findViewById(R.id.tv_status)
|
tvStatus = view.findViewById(R.id.tv_status)
|
||||||
radioButton = view.findViewById(R.id.radioButton)
|
radioButton = view.findViewById(R.id.radioButton)
|
||||||
|
radioGroup = view.findViewById(R.id.radio_group)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,21 +57,24 @@ class RVAdapter : RecyclerView.Adapter<RVAdapter.ViewHolder>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
|
Log.d("RVAdapter", "onBindViewHolder called() : pos = ${position}")
|
||||||
val idString = "ID: " + dataset[position].patientID
|
val idString = "ID: " + dataset[position].patientID
|
||||||
holder.tvId.text = idString
|
holder.tvId.text = idString
|
||||||
holder.tvName.text = dataset[position].patientName
|
holder.tvName.text = dataset[position].patientName
|
||||||
holder.tvStatus.text = dataset[position].testStatus.toString()
|
holder.tvStatus.text = dataset[position].testStatus.toString()
|
||||||
|
|
||||||
|
holder.radioGroup.clearCheck()
|
||||||
if (dataset[position].testStatus == Status.PENDING) {
|
if (dataset[position].testStatus == Status.PENDING) {
|
||||||
holder.radioButton.isChecked = (position
|
holder.radioButton.isChecked = (position == selectedPosition)
|
||||||
== selectedPosition)
|
|
||||||
} else {
|
} else {
|
||||||
holder.radioButton.isEnabled = false
|
holder.radioButton.isEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.radioButton.setOnCheckedChangeListener { compoundButton, b ->
|
holder.radioButton.setOnCheckedChangeListener { compoundButton, b ->
|
||||||
|
Log.d("RVAdapter", "setOnCheckedChangeListener called() : pos = ${position}")
|
||||||
// check condition
|
// check condition
|
||||||
if (b) {
|
if (b) {
|
||||||
|
Log.d("RVAdapter", "setOnCheckedChangeListener called() -> b true : pos = ${position}")
|
||||||
// When checked update selected position
|
// When checked update selected position
|
||||||
selectedPosition = holder.adapterPosition
|
selectedPosition = holder.adapterPosition
|
||||||
itemClickListener!!.onClick(position)
|
itemClickListener!!.onClick(position)
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package com.example.hpos.presentation
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.RadioButton
|
||||||
|
import android.widget.RadioGroup
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.example.hpos.R
|
||||||
|
import com.example.hpos.data.model.test.Status
|
||||||
|
import com.example.hpos.data.model.test.TestDetails
|
||||||
|
import com.example.hpos.presentation.dashboard.ItemClickListener
|
||||||
|
|
||||||
|
class RecyclerViewAdapter : RecyclerView.Adapter<RecyclerViewAdapter.ViewHolder>() {
|
||||||
|
|
||||||
|
private val dataset = ArrayList<TestDetails>()
|
||||||
|
|
||||||
|
var itemClickListener: ItemClickListener? = null
|
||||||
|
|
||||||
|
var selectedPosition = -1
|
||||||
|
var prev = -1
|
||||||
|
|
||||||
|
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||||
|
val tvId: TextView = view.findViewById(R.id.tv_id)
|
||||||
|
val tvName: TextView = view.findViewById(R.id.tv_name)
|
||||||
|
val tvStatus: TextView = view.findViewById(R.id.tv_status)
|
||||||
|
val radioButton: RadioButton = view.findViewById(R.id.radioButton)
|
||||||
|
val radioGroup: RadioGroup = view.findViewById(R.id.radio_group)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
|
val view = LayoutInflater.from(parent.context)
|
||||||
|
.inflate(R.layout.table_item, parent, false)
|
||||||
|
|
||||||
|
return ViewHolder(view)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
|
Log.d("RVAdapter", "onBindViewHolder called() : pos = ${position}")
|
||||||
|
val idString = "ID: " + dataset[position].patientID
|
||||||
|
holder.tvId.text = idString
|
||||||
|
holder.tvName.text = dataset[position].patientName
|
||||||
|
holder.tvStatus.text = dataset[position].testStatus.toString()
|
||||||
|
|
||||||
|
|
||||||
|
Log.d("RVAdapter", "For ${dataset[position].patientName}, selected = $selectedPosition")
|
||||||
|
|
||||||
|
holder.radioGroup.clearCheck()
|
||||||
|
if (dataset[position].testStatus == Status.PENDING) {
|
||||||
|
holder.radioButton.isEnabled = true
|
||||||
|
holder.radioButton.isChecked = (position == selectedPosition)
|
||||||
|
Log.d("RVAdapter", "inside pending if")
|
||||||
|
} else {
|
||||||
|
holder.radioButton.isChecked = false
|
||||||
|
holder.radioButton.isEnabled = false
|
||||||
|
Log.d("RVAdapter", "inside pending else")
|
||||||
|
}
|
||||||
|
|
||||||
|
holder.radioButton.setOnClickListener {
|
||||||
|
setSelectedItem(position)
|
||||||
|
}
|
||||||
|
holder.itemView.setOnClickListener {
|
||||||
|
setSelectedItem(position)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setSelectedItem(position: Int) {
|
||||||
|
Log.d("RVAdapter", "setOnCheckedChangeListener called() -> b true : pos = $position")
|
||||||
|
|
||||||
|
if (position != selectedPosition && dataset[position].testStatus == Status.PENDING) {
|
||||||
|
prev = selectedPosition
|
||||||
|
selectedPosition = position
|
||||||
|
itemClickListener!!.onClick(position)
|
||||||
|
|
||||||
|
if (prev != -1) {
|
||||||
|
notifyItemChanged(prev)
|
||||||
|
}
|
||||||
|
notifyItemChanged(position)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount(): Int {
|
||||||
|
return dataset.size
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateDataSet(newDataSet: ArrayList<TestDetails>) {
|
||||||
|
dataset.clear()
|
||||||
|
dataset.addAll(newDataSet)
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,13 +13,17 @@ import androidx.activity.result.contract.ActivityResultContracts
|
|||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
import com.example.hpos.MyApplication
|
||||||
import com.example.hpos.data.DataHolder
|
import com.example.hpos.data.DataHolder
|
||||||
|
import com.example.hpos.data.FileUploader
|
||||||
import com.example.hpos.databinding.ActivitySplashBinding
|
import com.example.hpos.databinding.ActivitySplashBinding
|
||||||
import com.example.hpos.presentation.dashboard.DashboardActivity
|
import com.example.hpos.presentation.dashboard.DashboardActivity
|
||||||
import com.example.hpos.util.MyUtils
|
import com.example.hpos.util.MyUtils
|
||||||
import com.google.firebase.firestore.FirebaseFirestoreSettings
|
import com.google.firebase.firestore.FirebaseFirestoreSettings
|
||||||
import com.google.firebase.firestore.ktx.firestore
|
import com.google.firebase.firestore.ktx.firestore
|
||||||
import com.google.firebase.ktx.Firebase
|
import com.google.firebase.ktx.Firebase
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,7 +45,6 @@ class SplashActivity : AppCompatActivity() {
|
|||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
setupFirestoreCache()
|
setupFirestoreCache()
|
||||||
setupStaticConstants()
|
|
||||||
|
|
||||||
checkForStoragePermissions()
|
checkForStoragePermissions()
|
||||||
checkForLocationPermission()
|
checkForLocationPermission()
|
||||||
@@ -52,6 +55,22 @@ class SplashActivity : AppCompatActivity() {
|
|||||||
// Log.d("surya_permission", "passed first")
|
// Log.d("surya_permission", "passed first")
|
||||||
checkAllPermissionsGiven()
|
checkAllPermissionsGiven()
|
||||||
|
|
||||||
|
setupStaticConstants()
|
||||||
|
|
||||||
|
startWorker()
|
||||||
|
|
||||||
|
// GlobalScope.launch(Dispatchers.IO) {
|
||||||
|
// FileUploader().uploadFiles(listOf())
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun startWorker() {
|
||||||
|
if (MyUtils.isInternetConnected()) {
|
||||||
|
(applicationContext as MyApplication).applicationScope.launch(Dispatchers.IO) {
|
||||||
|
FileUploader().start()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupStaticConstants() {
|
private fun setupStaticConstants() {
|
||||||
|
|||||||
@@ -59,4 +59,5 @@ class DashboardActivity : AppCompatActivity() {
|
|||||||
val navController = findNavController(R.id.nav_host_fragment_content_dashboard)
|
val navController = findNavController(R.id.nav_host_fragment_content_dashboard)
|
||||||
return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp()
|
return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -10,11 +10,13 @@ import androidx.fragment.app.Fragment
|
|||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE
|
||||||
import com.example.hpos.R
|
import com.example.hpos.R
|
||||||
import com.example.hpos.data.DataHolder
|
import com.example.hpos.data.DataHolder
|
||||||
import com.example.hpos.data.model.patient.PatientDetails
|
import com.example.hpos.data.model.patient.PatientDetails
|
||||||
import com.example.hpos.databinding.FragmentHomeBinding
|
import com.example.hpos.databinding.FragmentHomeBinding
|
||||||
import com.example.hpos.presentation.RVAdapter
|
import com.example.hpos.presentation.RVAdapter
|
||||||
|
import com.example.hpos.presentation.RecyclerViewAdapter
|
||||||
|
|
||||||
class HomeFragment : Fragment() {
|
class HomeFragment : Fragment() {
|
||||||
|
|
||||||
@@ -24,7 +26,8 @@ class HomeFragment : Fragment() {
|
|||||||
private val viewModel: DashboardViewModel by activityViewModels()
|
private val viewModel: DashboardViewModel by activityViewModels()
|
||||||
// private val viewModel: DashboardViewModel by activityViewModels{ MyViewModelFactory() }
|
// private val viewModel: DashboardViewModel by activityViewModels{ MyViewModelFactory() }
|
||||||
|
|
||||||
private lateinit var rvAdapter: RVAdapter
|
// private lateinit var rvAdapter: RVAdapter
|
||||||
|
private lateinit var rvAdapter: RecyclerViewAdapter
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater,
|
||||||
@@ -33,13 +36,12 @@ class HomeFragment : Fragment() {
|
|||||||
): View {
|
): View {
|
||||||
try {
|
try {
|
||||||
_binding = FragmentHomeBinding.inflate(inflater, container, false)
|
_binding = FragmentHomeBinding.inflate(inflater, container, false)
|
||||||
// DataHolder.selectedTest = TestDetails()
|
|
||||||
|
|
||||||
rvAdapter = RVAdapter()
|
DataHolder.selectedTest = null
|
||||||
|
rvAdapter = RecyclerViewAdapter()
|
||||||
val itemClickListener = object : ItemClickListener {
|
val itemClickListener = object : ItemClickListener {
|
||||||
override fun onClick(pos: Int) {
|
override fun onClick(pos: Int) {
|
||||||
// binding.recyclerView.post(Runnable { rvAdapter.notifyDataSetChanged() })
|
Log.d(TAG, "onclick called in ItemClickListener")
|
||||||
rvAdapter.notifyDataSetChanged()
|
|
||||||
DataHolder.selectedTest = viewModel.allTestDetails.value?.get(pos)
|
DataHolder.selectedTest = viewModel.allTestDetails.value?.get(pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,10 +72,15 @@ class HomeFragment : Fragment() {
|
|||||||
findNavController().navigate(R.id.action_nav_home_to_registerOneScanAbhaFragment)
|
findNavController().navigate(R.id.action_nav_home_to_registerOneScanAbhaFragment)
|
||||||
}
|
}
|
||||||
binding.btnTest.setOnClickListener {
|
binding.btnTest.setOnClickListener {
|
||||||
if (DataHolder.selectedTest != null)
|
if (DataHolder.selectedTest != null) {
|
||||||
findNavController().navigate(R.id.action_nav_home_to_mainActivity)
|
findNavController().navigate(R.id.action_nav_home_to_mainActivity)
|
||||||
else
|
} else {
|
||||||
Toast.makeText(requireContext(), "Select One Record to start testing", Toast.LENGTH_SHORT).show()
|
Toast.makeText(
|
||||||
|
requireContext(),
|
||||||
|
"Select One Record to start testing",
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.FragmentManager
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import com.example.hpos.R
|
import com.example.hpos.R
|
||||||
@@ -46,7 +47,6 @@ class RegisterOneScanAbhaFragment : Fragment() {
|
|||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View {
|
): View {
|
||||||
binding = FragmentRegisterOneScanAbhaBinding.inflate(inflater, container, false)
|
binding = FragmentRegisterOneScanAbhaBinding.inflate(inflater, container, false)
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,7 +145,9 @@ class RegisterThreeEnterPatientDetails : Fragment() {
|
|||||||
if (binding.etYob.text.isNullOrEmpty()) {
|
if (binding.etYob.text.isNullOrEmpty()) {
|
||||||
binding.etYob.error = getString(R.string.yob_error)
|
binding.etYob.error = getString(R.string.yob_error)
|
||||||
return null
|
return null
|
||||||
} else if (binding.etYob.text.toString().toInt() <= 1900 || binding.etYob.text.toString().toInt() > 2023) {
|
} else if (binding.etYob.text.toString().toInt() <= 1900 || binding.etYob.text.toString()
|
||||||
|
.toInt() > 2023
|
||||||
|
) {
|
||||||
binding.etYob.error = getString(R.string.yob_error_2)
|
binding.etYob.error = getString(R.string.yob_error_2)
|
||||||
return null
|
return null
|
||||||
} else {
|
} else {
|
||||||
@@ -162,7 +164,10 @@ class RegisterThreeEnterPatientDetails : Fragment() {
|
|||||||
if (binding.etMobile.text.isNullOrEmpty()) {
|
if (binding.etMobile.text.isNullOrEmpty()) {
|
||||||
binding.etMobile.error = getString(R.string.mobile_error)
|
binding.etMobile.error = getString(R.string.mobile_error)
|
||||||
return null
|
return null
|
||||||
} else {
|
} else if (binding.etMobile.text.toString().length != 10) {
|
||||||
|
binding.etMobile.error = getString(R.string.mobile_error)
|
||||||
|
return null
|
||||||
|
}else {
|
||||||
viewModel.patientDetails.mobile = binding.etMobile.text.toString()
|
viewModel.patientDetails.mobile = binding.etMobile.text.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,7 @@ import com.example.hpos.data.constant.Constants
|
|||||||
import com.example.hpos.databinding.ActivityTestRightBinding
|
import com.example.hpos.databinding.ActivityTestRightBinding
|
||||||
import com.example.hpos.util.MyViewModelFactory
|
import com.example.hpos.util.MyViewModelFactory
|
||||||
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
||||||
|
import com.hoho.android.usbserial.driver.UsbSerialProber
|
||||||
|
|
||||||
|
|
||||||
class TestRightActivity : AppCompatActivity() {
|
class TestRightActivity : AppCompatActivity() {
|
||||||
@@ -64,7 +65,7 @@ class TestRightActivity : AppCompatActivity() {
|
|||||||
viewModel.isServiceConnected = true
|
viewModel.isServiceConnected = true
|
||||||
|
|
||||||
// Todo: Uncomment this
|
// Todo: Uncomment this
|
||||||
// mConnection.let { mService.connect(mDriver, mConnection!!) }
|
mConnection.let { mService.connect(mDriver, mConnection!!) }
|
||||||
moveToNext()
|
moveToNext()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,38 +112,38 @@ class TestRightActivity : AppCompatActivity() {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// Todo: Comment this
|
// Todo: Comment this
|
||||||
private fun connectUsb(permissionGranted: Boolean) {
|
// private fun connectUsb(permissionGranted: Boolean) {
|
||||||
setupService()
|
// setupService()
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Todo: Uncomment this
|
// Todo: Uncomment this
|
||||||
// private fun connectUsb(permissionGranted: Boolean) {
|
private fun connectUsb(permissionGranted: Boolean) {
|
||||||
// Log.d(TAG, "connectUsb() called, permission variable = $permissionGranted")
|
Log.d(TAG, "connectUsb() called, permission variable = $permissionGranted")
|
||||||
// val manager = getSystemService(Context.USB_SERVICE) as UsbManager
|
val manager = getSystemService(Context.USB_SERVICE) as UsbManager
|
||||||
// val availableDrivers = UsbSerialProber.getDefaultProber().findAllDrivers(manager)
|
val availableDrivers = UsbSerialProber.getDefaultProber().findAllDrivers(manager)
|
||||||
//
|
|
||||||
// if (availableDrivers.isEmpty()) {
|
if (availableDrivers.isEmpty()) {
|
||||||
// onErrorReported("No Device is Connected")
|
onErrorReported("No Device is Connected")
|
||||||
// } else {
|
} else {
|
||||||
// mDriver = availableDrivers[0]
|
mDriver = availableDrivers[0]
|
||||||
//
|
|
||||||
// if (mDriver.device.productId != Constants.DEVICE_PRODUCT_ID || mDriver.device.vendorId != Constants.DEVICE_VENDOR_ID){
|
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()
|
Toast.makeText(this, "Device Connected is not supported", Toast.LENGTH_SHORT).show()
|
||||||
// onBackPressed()
|
onBackPressed()
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// viewModel.testDetails?.deviceId = mDriver.device.serialNumber.toString()
|
viewModel.testDetails?.deviceId = mDriver.device.serialNumber.toString()
|
||||||
// DataHolder.deviceSerialNumber = mDriver.device.serialNumber.toString()
|
DataHolder.deviceSerialNumber = mDriver.device.serialNumber.toString()
|
||||||
// mConnection = manager.openDevice(mDriver.device)
|
mConnection = manager.openDevice(mDriver.device)
|
||||||
//
|
|
||||||
// if (mConnection == null) {
|
if (mConnection == null) {
|
||||||
// requestUserPermission(manager, mDriver.device)
|
requestUserPermission(manager, mDriver.device)
|
||||||
// } else {
|
} else {
|
||||||
// setupService()
|
setupService()
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Request user permission. The response will be received in the BroadcastReceiver
|
* Request user permission. The response will be received in the BroadcastReceiver
|
||||||
|
|||||||
@@ -65,8 +65,7 @@ class TestRightExpReference : Fragment() {
|
|||||||
getString(R.string.yes),
|
getString(R.string.yes),
|
||||||
object : MyDialogListener {
|
object : MyDialogListener {
|
||||||
override fun onClickNegativeButton() {
|
override fun onClickNegativeButton() {
|
||||||
// Todo: Only for testing
|
|
||||||
// viewModel.progressBar.postValue(true)
|
|
||||||
}
|
}
|
||||||
override fun onClickPositiveButton() {
|
override fun onClickPositiveButton() {
|
||||||
startTakingReference()
|
startTakingReference()
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.example.hpos.data.model.test.TestType
|
|||||||
import com.example.hpos.databinding.FragmentTestRightResultsBinding
|
import com.example.hpos.databinding.FragmentTestRightResultsBinding
|
||||||
import com.example.hpos.presentation.dashboard.DashboardActivity
|
import com.example.hpos.presentation.dashboard.DashboardActivity
|
||||||
import com.example.hpos.util.MyUtils
|
import com.example.hpos.util.MyUtils
|
||||||
|
import com.example.hpos.util.MyUtils.calculateAgeFromYOB
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
@@ -48,9 +49,9 @@ class TestRightResults : Fragment() {
|
|||||||
viewModel.addFilesToQueue(requireContext())
|
viewModel.addFilesToQueue(requireContext())
|
||||||
|
|
||||||
// Uploading to cloud storage and deleting the from the pending queue when uploaded
|
// Uploading to cloud storage and deleting the from the pending queue when uploaded
|
||||||
// if (MyUtils.isInternetConnected()) {
|
if (MyUtils.isInternetConnected()) {
|
||||||
// viewModel.addFilesToCloud(requireContext())
|
viewModel.addFilesToCloud(requireContext())
|
||||||
// }
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,15 +70,11 @@ class TestRightResults : Fragment() {
|
|||||||
private fun updateResults() {
|
private fun updateResults() {
|
||||||
binding.tvName.text = getString(R.string.name_in_textview, viewModel.testDetails?.patientName)
|
binding.tvName.text = getString(R.string.name_in_textview, viewModel.testDetails?.patientName)
|
||||||
binding.tvAge.text =
|
binding.tvAge.text =
|
||||||
getString(R.string.age_in_textview, viewModel.testDetails?.patientAge.toString())
|
getString(R.string.age_in_textview, viewModel.testDetails?.patientAge?.calculateAgeFromYOB().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)
|
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){
|
if (DataHolder.selectedTestType == TestType.SICKLECERT){
|
||||||
when (viewModel.testDetails?.result) {
|
when (viewModel.testDetails?.result) {
|
||||||
TestRightResultType.NORMAL -> {
|
TestRightResultType.NORMAL -> {
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ import android.os.Binder
|
|||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.example.hpos.data.DataHolder
|
import com.example.hpos.data.DataHolder
|
||||||
|
import com.example.hpos.data.constant.Constants
|
||||||
import com.example.hpos.data.constant.TestRightCommands
|
import com.example.hpos.data.constant.TestRightCommands
|
||||||
import com.example.hpos.presentation.UsbServiceListener
|
import com.example.hpos.presentation.UsbServiceListener
|
||||||
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
||||||
import com.hoho.android.usbserial.driver.UsbSerialPort
|
import com.hoho.android.usbserial.driver.UsbSerialPort
|
||||||
|
import com.hoho.android.usbserial.util.SerialInputOutputManager
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
|
|
||||||
@@ -35,26 +37,26 @@ class UsbService : Service() {
|
|||||||
var listener: UsbServiceListener? = null
|
var listener: UsbServiceListener? = null
|
||||||
fun connect(driver: UsbSerialDriver, connection: UsbDeviceConnection) {
|
fun connect(driver: UsbSerialDriver, connection: UsbDeviceConnection) {
|
||||||
// Todo: Uncomment this
|
// Todo: Uncomment this
|
||||||
// mPort = driver.ports[0] // Most devices have just one port (port 0)
|
mPort = driver.ports[0] // Most devices have just one port (port 0)
|
||||||
// mPort.open(connection)
|
mPort.open(connection)
|
||||||
// mPort.setParameters(115200, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE)
|
mPort.setParameters(115200, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE)
|
||||||
//
|
//
|
||||||
isUsbConnected = true
|
isUsbConnected = true
|
||||||
// Log.d(TAG, "My Usb Connected ${mPort.driver}")
|
Log.d(TAG, "My Usb Connected ${mPort.driver}")
|
||||||
//
|
|
||||||
// val usbIoManager = SerialInputOutputManager(mPort,
|
val usbIoManager = SerialInputOutputManager(mPort,
|
||||||
// object : SerialInputOutputManager.Listener{
|
object : SerialInputOutputManager.Listener{
|
||||||
// override fun onNewData(data: ByteArray?) {
|
override fun onNewData(data: ByteArray?) {
|
||||||
//// Log.e(TAG, "onNewData() called inside eventDrivenWrite()")
|
// Log.e(TAG, "onNewData() called inside eventDrivenWrite()")
|
||||||
// listener?.onUsbRead(data)
|
listener?.onUsbRead(data)
|
||||||
// }
|
}
|
||||||
// override fun onRunError(e: Exception?) {
|
override fun onRunError(e: Exception?) {
|
||||||
// Log.e(TAG, "onRunError() called inside eventDrivenWrite()")
|
Log.e(TAG, "onRunError() called inside eventDrivenWrite()")
|
||||||
// listener?.onUsbError(e)
|
listener?.onUsbError(e)
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// })
|
})
|
||||||
// usbIoManager.start();
|
usbIoManager.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
fun disconnect() {
|
fun disconnect() {
|
||||||
@@ -66,52 +68,52 @@ class UsbService : Service() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Todo: comment this
|
// 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) {
|
// fun eventDrivenWrite(command: TestRightCommands, listener: UsbServiceListener) {
|
||||||
// this.listener = listener
|
// this.listener = listener
|
||||||
// try {
|
// try {
|
||||||
// mPort.write(command.command.toByteArray(), Constants.WRITE_TIMEOUT_MILLIS)
|
// 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) {
|
// } catch (e: IOException) {
|
||||||
// listener.onUsbError(e)
|
// listener.onUsbError(e)
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// Todo: Uncomment this
|
||||||
|
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){
|
// fun write(command: TestRightCommands){
|
||||||
// mPort.write(command.command.toByteArray(), Constants.WRITE_TIMEOUT_MILLIS)
|
// mPort.write(command.command.toByteArray(), Constants.WRITE_TIMEOUT_MILLIS)
|
||||||
// }
|
// }
|
||||||
|
|||||||
11
app/src/main/java/com/example/hpos/test.kt
Normal file
11
app/src/main/java/com/example/hpos/test.kt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.example.hpos
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
|
fun main(){
|
||||||
|
val dateFormat = SimpleDateFormat("MM:HHddMMyyyy", Locale.getDefault())
|
||||||
|
val currentDate = Date()
|
||||||
|
print(dateFormat.format(currentDate))
|
||||||
|
}
|
||||||
@@ -79,7 +79,7 @@ object MyUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Int.calculateAgeFromYOB(): Int {
|
fun Int.calculateAgeFromYOB(): Int {
|
||||||
val currentY = SimpleDateFormat("yyyy_HHmmss").format(Date()).toInt()
|
val currentY = SimpleDateFormat("yyyy").format(Date()).toInt()
|
||||||
return (currentY - this)
|
return (currentY - this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@
|
|||||||
android:id="@+id/name_edit_text"
|
android:id="@+id/name_edit_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:maxLength="16"
|
android:maxLength="17"
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
android:hint="@string/serial_number" />
|
android:hint="@string/serial_number" />
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_gallery"
|
android:id="@+id/text_gallery"
|
||||||
|
style="@style/title1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_margin="24dp"
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
|
android:text="@string/to_be_launched_in_next_version_of_the_app"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
|
android:scrollbars="vertical"
|
||||||
app:layout_constraintBottom_toTopOf="@id/btn_add"
|
app:layout_constraintBottom_toTopOf="@id/btn_add"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_title"
|
app:layout_constraintTop_toBottomOf="@id/tv_title"
|
||||||
tools:listitem="@layout/table_item" />
|
tools:listitem="@layout/table_item" />
|
||||||
|
|||||||
@@ -101,7 +101,8 @@
|
|||||||
android:id="@+id/et_mobile"
|
android:id="@+id/et_mobile"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="Mobile Number"
|
android:hint="Mobile Number (10 digits)"
|
||||||
|
android:maxLength="10"
|
||||||
android:inputType="number" />
|
android:inputType="number" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_slideshow"
|
android:id="@+id/text_slideshow"
|
||||||
|
style="@style/title1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_margin="24dp"
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
|
android:text="@string/to_be_launched_in_next_version_of_the_app"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|||||||
@@ -7,29 +7,36 @@
|
|||||||
android:id="@+id/cl_parent"
|
android:id="@+id/cl_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="8dp"
|
||||||
android:background="@color/blue_app_light"
|
android:background="@color/blue_app_light"
|
||||||
android:padding="8dp"
|
android:padding="8dp">
|
||||||
android:layout_margin="8dp">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatRadioButton
|
<RadioGroup
|
||||||
android:id="@+id/radioButton"
|
android:id="@+id/radio_group"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/tv_id"
|
app:layout_constraintBottom_toBottomOf="@id/tv_id"
|
||||||
app:layout_constraintTop_toTopOf="@id/tv_name"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
tools:checked="true"/>
|
app:layout_constraintTop_toTopOf="@id/tv_name">
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/radioButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:enabled="true"
|
||||||
|
tools:checked="true" />
|
||||||
|
</RadioGroup>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_name"
|
android:id="@+id/tv_name"
|
||||||
style="@style/title1_2"
|
style="@style/title1_2"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:text="V Surya Kumar"
|
android:text="V Surya Kumar"
|
||||||
android:textAlignment="center"
|
android:textAlignment="textStart"
|
||||||
app:layout_constraintStart_toEndOf="@id/radioButton"
|
app:layout_constraintEnd_toStartOf="@+id/tv_status"
|
||||||
app:layout_constraintTop_toTopOf="parent"/>
|
app:layout_constraintStart_toEndOf="@id/radio_group"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_id"
|
android:id="@+id/tv_id"
|
||||||
@@ -37,23 +44,24 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="ID: 12321312312"
|
android:text="ID: 12321312312"
|
||||||
android:textAlignment="center"
|
android:textAlignment="textStart"
|
||||||
app:layout_constraintStart_toEndOf="@id/radioButton"
|
app:layout_constraintEnd_toStartOf="@+id/tv_status"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_name"/>
|
app:layout_constraintStart_toEndOf="@id/radio_group"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_name" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_status"
|
android:id="@+id/tv_status"
|
||||||
style="@style/title1_1"
|
style="@style/title1_1"
|
||||||
android:textSize="16sp"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
android:text="@string/pending"
|
android:text="@string/pending"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:layout_marginEnd="16dp"
|
android:textSize="16sp"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/tv_id"
|
app:layout_constraintBottom_toBottomOf="@id/tv_id"
|
||||||
app:layout_constraintTop_toTopOf="@id/tv_name"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:layout_marginStart="16dp"/>
|
app:layout_constraintTop_toTopOf="@id/tv_name" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
android:id="@+id/nav_home"
|
android:id="@+id/nav_home"
|
||||||
android:name="com.example.hpos.presentation.dashboard.HomeFragment"
|
android:name="com.example.hpos.presentation.dashboard.HomeFragment"
|
||||||
android:label="@string/menu_home"
|
android:label="@string/menu_home"
|
||||||
|
app:popUpToInclusive="true"
|
||||||
|
app:popUpTo="@id/nav_home"
|
||||||
tools:layout="@layout/fragment_home" >
|
tools:layout="@layout/fragment_home" >
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_nav_home_to_registerOneScanAbhaFragment"
|
android:id="@+id/action_nav_home_to_registerOneScanAbhaFragment"
|
||||||
@@ -51,9 +53,11 @@
|
|||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/registerThreeEnterPatientDetails"
|
android:id="@+id/registerThreeEnterPatientDetails"
|
||||||
android:name="com.example.hpos.presentation.dashboard.register.RegisterThreeEnterPatientDetails"
|
android:name="com.example.hpos.presentation.dashboard.register.RegisterThreeEnterPatientDetails"
|
||||||
android:label="Registration (3/3)" >
|
android:label="Registration (3/3)">
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_registerThreeEnterPatientDetails_to_nav_home"
|
android:id="@+id/action_registerThreeEnterPatientDetails_to_nav_home"
|
||||||
|
app:popUpTo="@id/nav_home"
|
||||||
|
app:popUpToInclusive="true"
|
||||||
app:destination="@id/nav_home" />
|
app:destination="@id/nav_home" />
|
||||||
</fragment>
|
</fragment>
|
||||||
<fragment
|
<fragment
|
||||||
@@ -63,6 +67,8 @@
|
|||||||
tools:layout="@layout/fragment_register_one_create_abha" >
|
tools:layout="@layout/fragment_register_one_create_abha" >
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_registerOneCreateAbha_to_registerTwoAadhaarFragment"
|
android:id="@+id/action_registerOneCreateAbha_to_registerTwoAadhaarFragment"
|
||||||
|
app:popUpTo="@id/registerOneCreateAbha"
|
||||||
|
app:popUpToInclusive="true"
|
||||||
app:destination="@id/registerTwoAadhaarFragment" />
|
app:destination="@id/registerTwoAadhaarFragment" />
|
||||||
</fragment>
|
</fragment>
|
||||||
<fragment
|
<fragment
|
||||||
|
|||||||
@@ -80,6 +80,7 @@
|
|||||||
<string name="yob_error">Year of birth can\'t be empty</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="yob_error_2">Invalid Year of Birth</string>
|
||||||
<string name="mobile_error">Mobile Number can\'t be empty</string>
|
<string name="mobile_error">Mobile Number can\'t be empty</string>
|
||||||
|
<string name="mobile_error_invalid">Mobile Number is invalid (Enter 10 Digits)</string>
|
||||||
<string name="this_error">This 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>-->
|
<!-- <string name="this_error">This can\'t be empty</string>-->
|
||||||
|
|
||||||
@@ -167,6 +168,8 @@
|
|||||||
<string name="serial_number">Serial Number</string>
|
<string name="serial_number">Serial Number</string>
|
||||||
<string name="set_baseline_reference_again">Set Baseline/Reference again?</string>
|
<string name="set_baseline_reference_again">Set Baseline/Reference again?</string>
|
||||||
<string name="baseline_instruction">Baseline Instruction</string>
|
<string name="baseline_instruction">Baseline Instruction</string>
|
||||||
|
<string name="to_be_launched_in_next_version_of_the_app">To be launched in next version of the app</string>
|
||||||
|
<string name="invalid_kit">Invalid Kit Serial Number, correct example, SMI/SC/019/01/001</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user