Compare commits
8 Commits
Add_new_de
...
new-archit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
676475f34a | ||
|
|
0b41b5ff7d | ||
|
|
8d0589a169 | ||
|
|
5c0f325d8d | ||
|
|
0dd8e6b805 | ||
|
|
b21f1c8eaa | ||
|
|
0383a63cb4 | ||
|
|
2e0b0be7f4 |
@@ -30,7 +30,11 @@ object DataHolder {
|
||||
|
||||
var selectedTest: UserData? = null
|
||||
|
||||
var kitSerial: String = ""
|
||||
|
||||
var location: UserData.Location? = null
|
||||
|
||||
var testExp: Boolean = true
|
||||
|
||||
|
||||
}
|
||||
@@ -32,26 +32,9 @@ object Constants {
|
||||
const val USER_ID = "usernameId"
|
||||
|
||||
val STATICID = listOf(
|
||||
"VIZ-1000-0001",
|
||||
"VIZ-1000-0002",
|
||||
"VIZ-1000-0003",
|
||||
"VIZ-1000-0004",
|
||||
"VIZ-1000-0005",
|
||||
"VIZ-1000-0006",
|
||||
"VIZ-1000-0007",
|
||||
"VIZ-1000-0008",
|
||||
"VIZ-1000-0009",
|
||||
"VIZ-1000-0010",
|
||||
"VIZ-1000-0011",
|
||||
"VIZ-1000-0012",
|
||||
"VIZ-1000-0013",
|
||||
"VIZ-1000-0014",
|
||||
"VIZ-1000-0015",
|
||||
"VIZ-1000-0016",
|
||||
"VIZ-1000-0017",
|
||||
"VIZ-1000-0018",
|
||||
"VIZ-1000-0019"
|
||||
|
||||
)
|
||||
|
||||
const val password = "SMI@12345"
|
||||
|
||||
@@ -42,9 +42,12 @@ class KitScanActivity : AppCompatActivity() {
|
||||
setContentView(binding.root)
|
||||
|
||||
if (DataHolder.sampleReadCounter <= Constants.MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE && DataHolder.isReferenceTaken){
|
||||
DataHolder.selectedTest!!.kitSerial = DataHolder.kitSerial
|
||||
moveToNext()
|
||||
}
|
||||
|
||||
binding.nameEditText.setText("SMI/SC/")
|
||||
|
||||
setSupportActionBar(binding.toolbar)
|
||||
|
||||
binding.btnScanNow.setOnClickListener {
|
||||
@@ -55,7 +58,8 @@ class KitScanActivity : AppCompatActivity() {
|
||||
binding.btnGo.setOnClickListener {
|
||||
val serialNumber = binding.nameEditText.text.toString().trim()
|
||||
if (serialNumber.isNotEmpty() && checkDataNotNull() && isSerialValid(serialNumber)) {
|
||||
DataHolder.selectedTest!!.kitSerial = binding.nameEditText.text.toString()
|
||||
DataHolder.kitSerial = binding.nameEditText.text.toString()
|
||||
DataHolder.selectedTest?.kitSerial = binding.nameEditText.text.toString()
|
||||
moveToNext()
|
||||
} else {
|
||||
Toast.makeText(this, "Invalid KIT Number", Toast.LENGTH_LONG).show()
|
||||
|
||||
@@ -64,7 +64,7 @@ class MainActivity : AppCompatActivity() {
|
||||
locationCallback = object : LocationCallback() {
|
||||
override fun onLocationResult(locationResult: LocationResult) {
|
||||
locationResult.lastLocation?.let { location ->
|
||||
DataHolder.location = UserData.Location(location.latitude, location.longitude)
|
||||
DataHolder.selectedTest!!.location = UserData.Location(location.latitude, location.longitude)
|
||||
Log.i("Location", DataHolder.location.toString())
|
||||
}
|
||||
}
|
||||
@@ -81,10 +81,16 @@ class MainActivity : AppCompatActivity() {
|
||||
val availableDrivers = UsbSerialProber.getDefaultProber()
|
||||
.findAllDrivers(getSystemService(Context.USB_SERVICE) as UsbManager)
|
||||
if (availableDrivers.isNotEmpty() && availableDrivers[0].device.productId == Constants.DEVICE_PRODUCT_ID && availableDrivers[0].device.vendorId == Constants.DEVICE_VENDOR_ID) {
|
||||
Log.d(TAG, "Device matched -> product = ${availableDrivers[0].device.productId}, vendor = ${availableDrivers[0].device.vendorId}")
|
||||
Log.d(
|
||||
TAG,
|
||||
"Device matched -> product = ${availableDrivers[0].device.productId}, vendor = ${availableDrivers[0].device.vendorId}"
|
||||
)
|
||||
DataHolder.usbConnected.value = true
|
||||
} else if (availableDrivers.isNotEmpty()) {
|
||||
Log.d(TAG, "Device NOT matched -> product = ${availableDrivers[0].device.productId}, vendor = ${availableDrivers[0].device.vendorId}")
|
||||
Log.d(
|
||||
TAG,
|
||||
"Device NOT matched -> product = ${availableDrivers[0].device.productId}, vendor = ${availableDrivers[0].device.vendorId}"
|
||||
)
|
||||
Toast.makeText(this, "Device Not Compatible", Toast.LENGTH_SHORT).show()
|
||||
DataHolder.usbConnected.value = false
|
||||
} else {
|
||||
@@ -108,9 +114,11 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
DataHolder.usbConnected.observe(this) {
|
||||
if (it) {
|
||||
myMenu?.get(0)?.icon = ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_24)
|
||||
myMenu?.get(0)?.icon =
|
||||
ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_24)
|
||||
} else {
|
||||
myMenu?.get(0)?.icon = ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_off_24)
|
||||
myMenu?.get(0)?.icon =
|
||||
ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_off_24)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,14 +135,11 @@ class MainActivity : AppCompatActivity() {
|
||||
val coarseLocationPermissionRequestCode = 101
|
||||
|
||||
if (ContextCompat.checkSelfPermission(
|
||||
this,
|
||||
coarseLocationPermission
|
||||
this, coarseLocationPermission
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
ActivityCompat.requestPermissions(
|
||||
this,
|
||||
arrayOf(coarseLocationPermission),
|
||||
coarseLocationPermissionRequestCode
|
||||
this, arrayOf(coarseLocationPermission), coarseLocationPermissionRequestCode
|
||||
)
|
||||
} else {
|
||||
getLocation()
|
||||
@@ -146,14 +151,11 @@ class MainActivity : AppCompatActivity() {
|
||||
val fineLocationPermissionRequestCode = 102
|
||||
|
||||
if (ContextCompat.checkSelfPermission(
|
||||
this,
|
||||
fineLocationPermission
|
||||
this, fineLocationPermission
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
ActivityCompat.requestPermissions(
|
||||
this,
|
||||
arrayOf(fineLocationPermission),
|
||||
fineLocationPermissionRequestCode
|
||||
this, arrayOf(fineLocationPermission), fineLocationPermissionRequestCode
|
||||
)
|
||||
} else {
|
||||
getLocation()
|
||||
@@ -165,12 +167,9 @@ class MainActivity : AppCompatActivity() {
|
||||
val fineLocationPermission = Manifest.permission.ACCESS_FINE_LOCATION
|
||||
|
||||
if (ActivityCompat.checkSelfPermission(
|
||||
this,
|
||||
coarseLocationPermission
|
||||
) != PackageManager.PERMISSION_GRANTED &&
|
||||
ActivityCompat.checkSelfPermission(
|
||||
this,
|
||||
fineLocationPermission
|
||||
this, coarseLocationPermission
|
||||
) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
|
||||
this, fineLocationPermission
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
// Handle location permission request if needed
|
||||
@@ -180,16 +179,14 @@ class MainActivity : AppCompatActivity() {
|
||||
return
|
||||
}
|
||||
|
||||
fusedLocationClient.lastLocation
|
||||
.addOnSuccessListener { location: Location? ->
|
||||
fusedLocationClient.lastLocation.addOnSuccessListener { location: Location? ->
|
||||
location?.let {
|
||||
DataHolder.location = UserData.Location(location.latitude, location.longitude)
|
||||
Log.i("Location", DataHolder.location.toString())
|
||||
DataHolder.selectedTest!!.location =
|
||||
UserData.Location(location.latitude, location.longitude)
|
||||
} ?: run {
|
||||
requestLocationUpdates()
|
||||
}
|
||||
}
|
||||
.addOnFailureListener { exception: Exception ->
|
||||
}.addOnFailureListener { exception: Exception ->
|
||||
exception.printStackTrace()
|
||||
}
|
||||
}
|
||||
@@ -202,12 +199,9 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
if (ActivityCompat.checkSelfPermission(
|
||||
this,
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
) != PackageManager.PERMISSION_GRANTED &&
|
||||
ActivityCompat.checkSelfPermission(
|
||||
this,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION
|
||||
this, Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
|
||||
this, Manifest.permission.ACCESS_FINE_LOCATION
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
return
|
||||
@@ -226,9 +220,7 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<String>,
|
||||
grantResults: IntArray
|
||||
requestCode: Int, permissions: Array<String>, grantResults: IntArray
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
when (requestCode) {
|
||||
@@ -238,16 +230,19 @@ class MainActivity : AppCompatActivity() {
|
||||
requestFineLocationPermission()
|
||||
} else {
|
||||
// Coarse location permission denied
|
||||
Toast.makeText(this, "Coarse location permission denied", Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(this, "Coarse location permission denied", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
102 -> {
|
||||
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
// Fine location permission granted
|
||||
getLocation()
|
||||
} else {
|
||||
// Fine location permission denied
|
||||
Toast.makeText(this, "Fine location permission denied", Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(this, "Fine location permission denied", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,12 +10,16 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import com.bumptech.glide.Glide
|
||||
import com.example.hpostesting.data.DataHolder
|
||||
import com.example.hpostesting.data.model.patient.UserData
|
||||
import com.example.hpostesting.presentation.testRight.TestRightViewModel
|
||||
import com.firebase.ui.firestore.FirestoreRecyclerAdapter
|
||||
import com.firebase.ui.firestore.FirestoreRecyclerOptions
|
||||
import `in`.sminnovations.hpostesting.R
|
||||
import `in`.sminnovations.hpostesting.databinding.UserItemViewBinding
|
||||
|
||||
class UserListAdapter(options: FirestoreRecyclerOptions<UserData>, private val view: View) :
|
||||
class UserListAdapter(
|
||||
options: FirestoreRecyclerOptions<UserData>,
|
||||
private val view: View
|
||||
) :
|
||||
FirestoreRecyclerAdapter<UserData, UserListAdapter.OrderItemViewHolder>(options) {
|
||||
|
||||
class OrderItemViewHolder(val binding: UserItemViewBinding) :
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.example.hpostesting.presentation.dashboard.ui.gallery.GalleryViewModel
|
||||
import `in`.sminnovations.hpostesting.databinding.FragmentGalleryBinding
|
||||
|
||||
class GalleryFragment : Fragment() {
|
||||
@@ -22,8 +21,6 @@ class GalleryFragment : Fragment() {
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
val galleryViewModel =
|
||||
ViewModelProvider(this).get(GalleryViewModel::class.java)
|
||||
|
||||
_binding = FragmentGalleryBinding.inflate(inflater, container, false)
|
||||
val root: View = binding.root
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -86,7 +85,14 @@ class HomeFragment : Fragment() {
|
||||
}
|
||||
|
||||
private fun loadUserData() {
|
||||
val query = Firebase.firestore.collection("patientData")
|
||||
val query = Firebase.firestore.collection("patientData").whereEqualTo("testStatus", false)
|
||||
query.get().addOnSuccessListener {
|
||||
if (it.documents.isEmpty()) {
|
||||
binding.pendingTest.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.pendingTest.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
val recyclerViewOptions =
|
||||
FirestoreRecyclerOptions.Builder<UserData>().setQuery(query, UserData::class.java)
|
||||
.build()
|
||||
|
||||
@@ -79,18 +79,29 @@ class TestRightExpSample : Fragment() {
|
||||
// if (details != null) {
|
||||
// viewModel.patientDetails = details
|
||||
|
||||
UIUtils.createAlertDialog(
|
||||
requireContext(),
|
||||
getString(R.string.have_you_placed_sample),
|
||||
getString(R.string.please_place_sample),
|
||||
getString(R.string.no),
|
||||
getString(R.string.yes_and_run),
|
||||
object : MyDialogListener {
|
||||
override fun onClickNegativeButton() {}
|
||||
override fun onClickPositiveButton() {
|
||||
startAcquiring()
|
||||
}
|
||||
})
|
||||
UIUtils.createAlertDialog(
|
||||
requireContext(),
|
||||
"WARNING",
|
||||
"Please check if you have placed the sample of this person ${viewModel.testDetails?._id}",
|
||||
getString(R.string.no),
|
||||
"Yes",
|
||||
object : MyDialogListener {
|
||||
override fun onClickNegativeButton() {}
|
||||
override fun onClickPositiveButton() {
|
||||
UIUtils.createAlertDialog(
|
||||
requireContext(),
|
||||
getString(R.string.have_you_placed_sample),
|
||||
getString(R.string.please_place_sample),
|
||||
getString(R.string.no),
|
||||
getString(R.string.yes_and_run),
|
||||
object : MyDialogListener {
|
||||
override fun onClickNegativeButton() {}
|
||||
override fun onClickPositiveButton() {
|
||||
startAcquiring()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -12,13 +12,22 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.example.hpostesting.data.DataHolder
|
||||
import com.example.hpostesting.data.constant.Constants
|
||||
import com.example.hpostesting.data.dao.UserDao
|
||||
import com.example.hpostesting.data.model.test.TestRightResultType
|
||||
import com.example.hpostesting.data.model.test.TestType
|
||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
||||
import com.example.hpostesting.util.MyUtils.calculateAgeFromYOB
|
||||
import com.google.firebase.firestore.FirebaseFirestore
|
||||
import com.google.firebase.firestore.ktx.firestore
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import `in`.sminnovations.hpostesting.R
|
||||
import `in`.sminnovations.hpostesting.databinding.FragmentTestRightResultsBinding
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.tasks.await
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
@AndroidEntryPoint
|
||||
class TestRightResults : Fragment() {
|
||||
@@ -26,7 +35,7 @@ class TestRightResults : Fragment() {
|
||||
private lateinit var binding: FragmentTestRightResultsBinding
|
||||
private val viewModel: TestRightViewModel by activityViewModels()
|
||||
private lateinit var sharedPreference: SharedPreferences
|
||||
|
||||
private var bloodGroup: String = ""
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View {
|
||||
@@ -55,13 +64,50 @@ class TestRightResults : Fragment() {
|
||||
|
||||
private fun setupListeners() {
|
||||
binding.ivHome.setOnClickListener {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val bloodGroupText = binding.etBloodGroup.text.toString()
|
||||
if (bloodGroupText.isNullOrBlank() || bloodGroupText == "Select Blood Group") {
|
||||
withContext(Dispatchers.Main) {
|
||||
binding.etBloodGroup.error = "Please enter your blood group"
|
||||
}
|
||||
withContext(Dispatchers.Main) {
|
||||
Toast.makeText(context, "Please enter your blood group", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
} else {
|
||||
withContext(Dispatchers.Main) {
|
||||
binding.etBloodGroup.error = null
|
||||
}
|
||||
bloodGroup = bloodGroupText
|
||||
checkBloodGroup()
|
||||
}
|
||||
}
|
||||
}
|
||||
binding.ivNext.setOnClickListener {
|
||||
val i = Intent(requireContext().applicationContext, DashboardActivity::class.java)
|
||||
startActivity(i)
|
||||
}
|
||||
binding.ivNext.setOnClickListener {
|
||||
val i = Intent(requireContext().applicationContext, DashboardActivity::class.java)
|
||||
startActivity(i)
|
||||
// moveToSamplePage()
|
||||
}
|
||||
|
||||
private suspend fun checkBloodGroup() {
|
||||
binding.apply {
|
||||
bloodGroup = etBloodGroup.text.toString()
|
||||
val db: FirebaseFirestore = Firebase.firestore
|
||||
val userdata =
|
||||
db.collection("patientData").whereEqualTo("_id", viewModel.testDetails?._id)
|
||||
.get().await()
|
||||
if (userdata.documents.isNotEmpty()) {
|
||||
db.collection("patientData").document(userdata.documents[0].id)
|
||||
.update("bloodGroup", bloodGroup)
|
||||
withContext(Dispatchers.Main) {
|
||||
val i = Intent(
|
||||
requireContext().applicationContext,
|
||||
DashboardActivity::class.java
|
||||
)
|
||||
startActivity(i)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,37 +127,37 @@ class TestRightResults : Fragment() {
|
||||
|
||||
|
||||
if (DataHolder.selectedTestType == TestType.SICKLECERT) {
|
||||
when (viewModel.testDetails?.result) {
|
||||
TestRightResultType.NORMAL -> {
|
||||
binding.resultNormal.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
TestRightResultType.SICKLECELLDISEASE -> {
|
||||
binding.resultDisease.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
TestRightResultType.SICKLECELLTRAIT -> {
|
||||
binding.resultTrait.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
TestRightResultType.POSITIVEBORDERLINE -> {
|
||||
binding.resultPositiveBorderline.visibility = View.VISIBLE
|
||||
binding.tvRecommended.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
TestRightResultType.NEGATIVEBORDERLINE -> {
|
||||
binding.resultNegativeBorderline.visibility = View.VISIBLE
|
||||
binding.tvRecommended.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
else -> {
|
||||
// binding.resultUndefined.visibility = View.VISIBLE
|
||||
Toast.makeText(
|
||||
requireContext().applicationContext, "Please Test Again", Toast.LENGTH_LONG
|
||||
).show()
|
||||
moveToSamplePage()
|
||||
}
|
||||
}
|
||||
// when (viewModel.testDetails?.result) {
|
||||
// TestRightResultType.NORMAL -> {
|
||||
// binding.resultNormal.visibility = View.VISIBLE
|
||||
// }
|
||||
//
|
||||
// TestRightResultType.SICKLECELLDISEASE -> {
|
||||
// binding.resultDisease.visibility = View.VISIBLE
|
||||
// }
|
||||
//
|
||||
// TestRightResultType.SICKLECELLTRAIT -> {
|
||||
// binding.resultTrait.visibility = View.VISIBLE
|
||||
// }
|
||||
//
|
||||
// TestRightResultType.POSITIVEBORDERLINE -> {
|
||||
// binding.resultPositiveBorderline.visibility = View.VISIBLE
|
||||
// binding.tvRecommended.visibility = View.VISIBLE
|
||||
// }
|
||||
//
|
||||
// TestRightResultType.NEGATIVEBORDERLINE -> {
|
||||
// binding.resultNegativeBorderline.visibility = View.VISIBLE
|
||||
// binding.tvRecommended.visibility = View.VISIBLE
|
||||
// }
|
||||
// else -> {
|
||||
//// binding.resultUndefined.visibility = View.VISIBLE
|
||||
// Toast.makeText(
|
||||
// requireContext().applicationContext, "Please Test Again", Toast.LENGTH_LONG
|
||||
// ).show()
|
||||
// moveToSamplePage()
|
||||
// }
|
||||
// }
|
||||
binding.resultNormal.visibility = View.VISIBLE
|
||||
} else {
|
||||
when (viewModel.testDetails?.result) {
|
||||
TestRightResultType.SICKLECELLDISEASE -> {
|
||||
|
||||
@@ -137,7 +137,6 @@ class TestRightViewModel @Inject constructor(
|
||||
if (isReference) DataHolder.intensityReferenceArray.clear()
|
||||
else intensitySampleArray.clear()
|
||||
|
||||
Log.d("SURYAKUMAR", fullString)
|
||||
val listOfString = fullString.split("\n")
|
||||
|
||||
for (line in listOfString) {
|
||||
@@ -437,7 +436,6 @@ class TestRightViewModel @Inject constructor(
|
||||
}
|
||||
|
||||
private fun addResultTestToDb() {
|
||||
testDetails?.location = DataHolder.location
|
||||
testDetails?.testTime = SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||
).format(Calendar.getInstance().time)
|
||||
@@ -521,7 +519,6 @@ class TestRightViewModel @Inject constructor(
|
||||
}
|
||||
|
||||
private fun bulkAddResultTestToDb(userData: UserData) {
|
||||
userData.location = DataHolder.location
|
||||
viewModelScope.launch {
|
||||
userData.reportUploadTime = SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||
|
||||
@@ -24,7 +24,6 @@ class UsbService : Service() {
|
||||
private val TAG = "UsbService"
|
||||
|
||||
inner class UsbServiceBinder : Binder() {
|
||||
// Return this instance of UsbService so clients can call public methods
|
||||
fun getService(): UsbService = this@UsbService
|
||||
}
|
||||
|
||||
@@ -39,14 +38,12 @@ class UsbService : Service() {
|
||||
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?) {
|
||||
|
||||
@@ -5,6 +5,19 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pendingTest"
|
||||
style="@style/title1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:text="@string/all_registered_user_are_tested_successfully"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/internetNotAvailableCL"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:background="@drawable/result_background_green"
|
||||
android:text="@string/normal"
|
||||
android:text="@string/test_completed"
|
||||
android:textAlignment="center"
|
||||
android:visibility="gone"
|
||||
app:drawableStartCompat="@drawable/ic_baseline_check_circle_24"
|
||||
@@ -241,6 +241,28 @@
|
||||
<!-- app:layout_constraintStart_toStartOf="@id/iv_download"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/iv_download" />-->
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/til_blood_group"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cv_sample_details">
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/et_blood_group"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/select_blood_group"
|
||||
android:inputType="none"
|
||||
android:labelFor="@id/til_blood_group"
|
||||
app:simpleItems="@array/blood_group" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_home"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -250,7 +272,7 @@
|
||||
android:src="@drawable/ic_baseline_home_24"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_next"
|
||||
app:layout_constraintStart_toStartOf="@id/cv_sample_details"
|
||||
app:layout_constraintTop_toBottomOf="@id/cv_sample_details" />
|
||||
app:layout_constraintTop_toBottomOf="@id/til_blood_group" />
|
||||
|
||||
<TextView
|
||||
style="@style/title2"
|
||||
@@ -274,7 +296,7 @@
|
||||
android:src="@drawable/ic_baseline_new_label_24"
|
||||
app:layout_constraintEnd_toEndOf="@id/cv_sample_details"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_home"
|
||||
app:layout_constraintTop_toBottomOf="@id/cv_sample_details" />
|
||||
app:layout_constraintTop_toBottomOf="@id/til_blood_group" />
|
||||
|
||||
<TextView
|
||||
style="@style/title2"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<resources>
|
||||
<string name="app_name">HPOS</string>
|
||||
<string name="app_name">HPOS Testing</string>
|
||||
|
||||
<string-array name="instrument">
|
||||
<item>TestRight</item>
|
||||
@@ -130,7 +130,7 @@
|
||||
<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="patient_id_in_tv"><b>User ID</b> : %1$s</string>
|
||||
<string name="go">GO</string>
|
||||
<string name="click_here">Click Here</string>
|
||||
<string name="title_activity_dashboard">DashboardActivity</string>
|
||||
@@ -182,5 +182,8 @@
|
||||
<string name="upload">Upload</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="upload_success_message">Upload done successfully</string>
|
||||
<string name="test_completed">Test Completed</string>
|
||||
<string name="select_blood_group">Select Blood Group</string>
|
||||
<string name="all_registered_user_are_tested_successfully">All registered user are tested successfully</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user