Compare commits
11 Commits
Bufferchec
...
logoutAuto
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
583a94d42a | ||
|
|
0b52dc42b0 | ||
|
|
137eb7dd55 | ||
|
|
12df83db7b | ||
|
|
9849921833 | ||
|
|
8662e03dad | ||
|
|
0408ef3fbd | ||
|
|
7c4717ebb7 | ||
|
|
eb668c631c | ||
|
|
3e362a22fa | ||
|
|
e2c07d6252 |
@@ -20,4 +20,7 @@ interface HemoCubeDao {
|
|||||||
|
|
||||||
@Query("DELETE FROM hemo_cube_test_table WHERE _id = :id")
|
@Query("DELETE FROM hemo_cube_test_table WHERE _id = :id")
|
||||||
suspend fun deleteById(id: String)
|
suspend fun deleteById(id: String)
|
||||||
|
|
||||||
|
@Query("UPDATE hemo_cube_test_table SET localFlag = :newValue WHERE _id = :id")
|
||||||
|
suspend fun updateFieldById(id: String, newValue: Boolean)
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,8 @@ package com.example.hpostesting.presentation.adapter
|
|||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.Context.INPUT_METHOD_SERVICE
|
||||||
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -14,8 +16,6 @@ import com.example.hpostesting.data.DataHolder
|
|||||||
import com.example.hpostesting.data.model.patient.UserData
|
import com.example.hpostesting.data.model.patient.UserData
|
||||||
import com.firebase.ui.firestore.FirestoreRecyclerAdapter
|
import com.firebase.ui.firestore.FirestoreRecyclerAdapter
|
||||||
import com.firebase.ui.firestore.FirestoreRecyclerOptions
|
import com.firebase.ui.firestore.FirestoreRecyclerOptions
|
||||||
import com.google.firebase.firestore.ktx.firestore
|
|
||||||
import com.google.firebase.ktx.Firebase
|
|
||||||
import `in`.sminnovations.hpostesting.R
|
import `in`.sminnovations.hpostesting.R
|
||||||
import `in`.sminnovations.hpostesting.databinding.UserItemViewBinding
|
import `in`.sminnovations.hpostesting.databinding.UserItemViewBinding
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
@@ -23,8 +23,9 @@ import java.util.Calendar
|
|||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import android.widget.AutoCompleteTextView
|
import android.widget.AutoCompleteTextView
|
||||||
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
import androidx.core.content.ContextCompat.getSystemService
|
||||||
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
import androidx.core.content.getSystemService
|
||||||
|
import androidx.fragment.app.FragmentActivity
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
||||||
import com.google.firebase.firestore.FirebaseFirestore
|
import com.google.firebase.firestore.FirebaseFirestore
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ class UserListAdapter(
|
|||||||
options: FirestoreRecyclerOptions<UserData>,
|
options: FirestoreRecyclerOptions<UserData>,
|
||||||
private val view: View,
|
private val view: View,
|
||||||
private val batLevel: Int,
|
private val batLevel: Int,
|
||||||
private val testDetails: HemoCubeTestData? = DataHolder.selectedTest?.toHemoCubeTestData(),
|
private val requireActivity: FragmentActivity
|
||||||
) : FirestoreRecyclerAdapter<UserData, UserListAdapter.OrderItemViewHolder>(options) {
|
) : FirestoreRecyclerAdapter<UserData, UserListAdapter.OrderItemViewHolder>(options) {
|
||||||
|
|
||||||
class OrderItemViewHolder(val binding: UserItemViewBinding) :
|
class OrderItemViewHolder(val binding: UserItemViewBinding) :
|
||||||
@@ -53,7 +54,7 @@ class UserListAdapter(
|
|||||||
userName.text = "Name: ${model.name}"
|
userName.text = "Name: ${model.name}"
|
||||||
userId.text = "User ID:${model._id}"
|
userId.text = "User ID:${model._id}"
|
||||||
if (model.incubationTime == "") {
|
if (model.incubationTime == "") {
|
||||||
// btnStartIncubation.visibility = View.VISIBLE
|
btnBlood.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
userId.text =
|
userId.text =
|
||||||
"User ID:${model._id} \n Time: ${isBetween15And30Minutes(model.incubationTime)} \n Started at: ${
|
"User ID:${model._id} \n Time: ${isBetween15And30Minutes(model.incubationTime)} \n Started at: ${
|
||||||
@@ -63,7 +64,7 @@ class UserListAdapter(
|
|||||||
).parse(model.incubationTime)!!
|
).parse(model.incubationTime)!!
|
||||||
)
|
)
|
||||||
}"
|
}"
|
||||||
btnStartIncubation.visibility = View.GONE
|
btnBlood.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -76,6 +77,18 @@ class UserListAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
holder.binding.btnBlood.setOnClickListener {
|
holder.binding.btnBlood.setOnClickListener {
|
||||||
|
val view: View? = requireActivity.currentFocus
|
||||||
|
|
||||||
|
// on below line checking if view is not null.
|
||||||
|
if (view != null) {
|
||||||
|
// on below line we are creating a variable
|
||||||
|
// for input manager and initializing it.
|
||||||
|
val inputMethodManager =
|
||||||
|
context.getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
|
|
||||||
|
// on below line hiding our keyboard.
|
||||||
|
inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0)
|
||||||
|
}
|
||||||
val inflater = LayoutInflater.from(context)
|
val inflater = LayoutInflater.from(context)
|
||||||
val dialogView = inflater.inflate(R.layout.dialog_custom, null)
|
val dialogView = inflater.inflate(R.layout.dialog_custom, null)
|
||||||
|
|
||||||
@@ -117,6 +130,7 @@ class UserListAdapter(
|
|||||||
"Blood group updated successfully",
|
"Blood group updated successfully",
|
||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
|
btnBlood.visibility = View.GONE
|
||||||
}
|
}
|
||||||
.addOnFailureListener { e ->
|
.addOnFailureListener { e ->
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
@@ -235,11 +249,4 @@ class UserListAdapter(
|
|||||||
|
|
||||||
return diffMillis / (60 * 1000)
|
return diffMillis / (60 * 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,9 @@ import android.os.Bundle
|
|||||||
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.view.inputmethod.InputMethodManager
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
@@ -91,7 +93,6 @@ class HemoCubeBufferCheckFragment : Fragment() {
|
|||||||
binding.btnSubmit.isClickable = false
|
binding.btnSubmit.isClickable = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun observeViewModel() {
|
private fun observeViewModel() {
|
||||||
hemoCubeViewModel.deviceData.observe(viewLifecycleOwner) {
|
hemoCubeViewModel.deviceData.observe(viewLifecycleOwner) {
|
||||||
currentDeviceData = it
|
currentDeviceData = it
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ class HomeFragment : Fragment() {
|
|||||||
|
|
||||||
rvAdapter = view?.let {
|
rvAdapter = view?.let {
|
||||||
UserListAdapter(requireContext(), hemoCubeViewModel, recyclerViewOptions,
|
UserListAdapter(requireContext(), hemoCubeViewModel, recyclerViewOptions,
|
||||||
it, batLevel)
|
it, batLevel, requireActivity())
|
||||||
}!!
|
}!!
|
||||||
binding.rvOrder.adapter = rvAdapter
|
binding.rvOrder.adapter = rvAdapter
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ class HomeFragment : Fragment() {
|
|||||||
batLevel = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
|
batLevel = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
|
||||||
|
|
||||||
rvAdapter = view?.let {
|
rvAdapter = view?.let {
|
||||||
UserListAdapter(requireContext(), hemoCubeViewModel, recyclerViewOptions, it, batLevel)
|
UserListAdapter(requireContext(), hemoCubeViewModel, recyclerViewOptions, it, batLevel, requireActivity())
|
||||||
}!!
|
}!!
|
||||||
binding.rvOrder.adapter = rvAdapter
|
binding.rvOrder.adapter = rvAdapter
|
||||||
rvAdapter.startListening()
|
rvAdapter.startListening()
|
||||||
@@ -258,7 +258,7 @@ class HomeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
|
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
|
||||||
val uploadDataVisibility = if (userDataList.isEmpty()) View.GONE else View.VISIBLE
|
val uploadDataVisibility = if (userDataList.any { !it.localFlag }) View.VISIBLE else View.GONE
|
||||||
binding.uploadData.visibility = uploadDataVisibility
|
binding.uploadData.visibility = uploadDataVisibility
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -297,15 +297,13 @@ class HomeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
|
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
|
||||||
if (userDataList.isEmpty()) {
|
userDataList.forEach { userData ->
|
||||||
dialog.dismiss()
|
if (!userData.localFlag) {
|
||||||
} else {
|
|
||||||
userDataList.forEach { userData ->
|
|
||||||
userData.localFlag = true
|
userData.localFlag = true
|
||||||
hemoCubeViewModel.bulkAddResultTestToDb(userData)
|
hemoCubeViewModel.bulkAddResultTestToDb(userData)
|
||||||
}
|
}
|
||||||
dialog.dismiss()
|
|
||||||
}
|
}
|
||||||
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,25 +64,25 @@ class HemoCubeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun initViews() {
|
private fun initViews() {
|
||||||
// binding.btnSubmit.setOnClickListener {
|
binding.btnSubmit.setOnClickListener {
|
||||||
// val bloodGroupText = binding.etBloodGroup.text.toString()
|
// val bloodGroupText = binding.etBloodGroup.text.toString()
|
||||||
// if (bloodGroupText.isEmpty()) {
|
// if (bloodGroupText.isEmpty()) {
|
||||||
// binding.etBloodGroup.error = "Please enter your blood group"
|
// binding.etBloodGroup.error = "Please enter your blood group"
|
||||||
// } else {
|
// } else {
|
||||||
// activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
// binding.progressBar.visibility = View.VISIBLE
|
binding.progressBar.visibility = View.VISIBLE
|
||||||
// }
|
}
|
||||||
// hemoCubeViewModel.uploadHemoCubeResultToDatabase(
|
hemoCubeViewModel.uploadHemoCubeResultToDatabase(
|
||||||
// isOnline, true, sharedPreferences.getString(Constants.KIT_NUMBER, "")
|
isOnline, true, sharedPreferences.getString(Constants.KIT_NUMBER, "")
|
||||||
// )
|
)
|
||||||
// }
|
// }
|
||||||
// }
|
}
|
||||||
// if (isTestOngoing) {
|
if (isTestOngoing) {
|
||||||
// binding.btnKit.visibility = View.GONE
|
// binding.btnKit.visibility = View.GONE
|
||||||
// binding.btnKit.isEnabled = false
|
// binding.btnKit.isEnabled = false
|
||||||
// binding.btnKit.isClickable = false
|
// binding.btnKit.isClickable = false
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
binding.btnSubmit.isEnabled = false
|
binding.btnSubmit.isEnabled = false
|
||||||
binding.btnSubmit.isClickable = false
|
binding.btnSubmit.isClickable = false
|
||||||
|
|
||||||
@@ -151,14 +151,20 @@ class HemoCubeFragment : Fragment() {
|
|||||||
hemoCubeViewModel.fireBaseUpload.observe(viewLifecycleOwner) { result ->
|
hemoCubeViewModel.fireBaseUpload.observe(viewLifecycleOwner) { result ->
|
||||||
if (result == "Success") {
|
if (result == "Success") {
|
||||||
showToast("Test Results Uploaded Successfully")
|
showToast("Test Results Uploaded Successfully")
|
||||||
// lifecycleScope.launch {
|
val i = Intent(
|
||||||
// checkBloodGroup()
|
requireContext().applicationContext, DashboardActivity::class.java
|
||||||
// }
|
)
|
||||||
|
startActivity(i)
|
||||||
|
(activity as HemocubeActivity).finish()
|
||||||
}
|
}
|
||||||
if (result == "Local") {
|
if (result == "Local") {
|
||||||
showToast("Internet not available, test details stored locally")
|
showToast("Internet not available, test details stored locally")
|
||||||
startActivity(Intent(requireActivity(), DashboardActivity::class.java))
|
startActivity(Intent(requireActivity(), DashboardActivity::class.java))
|
||||||
}
|
}
|
||||||
|
if (result == "Error") {
|
||||||
|
showToast("Error uploading data, test details stored locally")
|
||||||
|
startActivity(Intent(requireActivity(), DashboardActivity::class.java))
|
||||||
|
}
|
||||||
|
|
||||||
binding.progressBar.visibility = View.GONE
|
binding.progressBar.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,14 +73,9 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
|
|
||||||
|
|
||||||
fun uploadHemoCubeResultToDatabaseforbuffercheckN(bufferCheckData: BufferCheckData) =
|
fun uploadHemoCubeResultToDatabaseforbuffercheckN(bufferCheckData: BufferCheckData) =
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
addResultTestToDbforbuffercheck(bufferCheckData)
|
addResultTestToDbforbuffercheck(bufferCheckData)
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun getDeviceData(deviceId: String?) = viewModelScope.launch {
|
fun getDeviceData(deviceId: String?) = viewModelScope.launch {
|
||||||
deviceData.postValue(deviceId?.let { repository.getDeviceDataById(it) })
|
deviceData.postValue(deviceId?.let { repository.getDeviceDataById(it) })
|
||||||
@@ -125,11 +120,14 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
||||||
fireBaseUpload.postValue("Success")
|
fireBaseUpload.postValue("Success")
|
||||||
|
testDetails.localFlag = true
|
||||||
|
hemoCubeDao.insertAll(testDetails)
|
||||||
}
|
}
|
||||||
|
|
||||||
is Response.Error -> {
|
is Response.Error -> {
|
||||||
Log.e("Testdb", "Error uploading data to Firestore: $response")
|
Log.e("Testdb", "Error uploading data to Firestore: $response")
|
||||||
fireBaseUpload.postValue("Error")
|
fireBaseUpload.postValue("Error")
|
||||||
|
hemoCubeDao.insertAll(testDetails)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -170,7 +168,7 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
when (repository.addTestToDatabase(userData)) {
|
when (repository.addTestToDatabase(userData)) {
|
||||||
is Response.Success -> {
|
is Response.Success -> {
|
||||||
fireBaseBulkUpload.postValue("Success")
|
fireBaseBulkUpload.postValue("Success")
|
||||||
deleteById(userData._id)
|
updateLocalFlag(userData._id)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
@@ -180,6 +178,10 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun updateLocalFlag(userId: String) = viewModelScope.launch {
|
||||||
|
hemoCubeDao.updateFieldById(id = userId, true)
|
||||||
|
}
|
||||||
|
|
||||||
fun deleteById(userId: String) = viewModelScope.launch {
|
fun deleteById(userId: String) = viewModelScope.launch {
|
||||||
hemoCubeDao.deleteById(id = userId)
|
hemoCubeDao.deleteById(id = userId)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.example.hpostesting.presentation.hemocube
|
package com.example.hpostesting.presentation.hemocube
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
import android.content.BroadcastReceiver
|
import android.content.BroadcastReceiver
|
||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
@@ -7,6 +8,7 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.content.ServiceConnection
|
import android.content.ServiceConnection
|
||||||
|
import android.content.SharedPreferences
|
||||||
import android.hardware.usb.UsbDevice
|
import android.hardware.usb.UsbDevice
|
||||||
import android.hardware.usb.UsbDeviceConnection
|
import android.hardware.usb.UsbDeviceConnection
|
||||||
import android.hardware.usb.UsbManager
|
import android.hardware.usb.UsbManager
|
||||||
@@ -17,10 +19,14 @@ import android.view.Menu
|
|||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.content.ContentProviderCompat.requireContext
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.view.get
|
import androidx.core.view.get
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
import com.example.hpostesting.data.DataHolder
|
import com.example.hpostesting.data.DataHolder
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
|
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
||||||
|
import com.example.hpostesting.presentation.dashboard.ui.LoginFragment
|
||||||
import com.example.hpostesting.presentation.testRight.UsbService
|
import com.example.hpostesting.presentation.testRight.UsbService
|
||||||
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
||||||
import com.hoho.android.usbserial.driver.UsbSerialProber
|
import com.hoho.android.usbserial.driver.UsbSerialProber
|
||||||
@@ -33,7 +39,7 @@ open class HemocubeActivity : AppCompatActivity() {
|
|||||||
private lateinit var binding: ActivityHemocubeBinding
|
private lateinit var binding: ActivityHemocubeBinding
|
||||||
private val viewModel by viewModels<HemoCubeViewModel>()
|
private val viewModel by viewModels<HemoCubeViewModel>()
|
||||||
private var myMenu: Menu? = null
|
private var myMenu: Menu? = null
|
||||||
|
private lateinit var sharedPreference: SharedPreferences
|
||||||
private lateinit var mDriver: UsbSerialDriver
|
private lateinit var mDriver: UsbSerialDriver
|
||||||
private var mConnection: UsbDeviceConnection? = null
|
private var mConnection: UsbDeviceConnection? = null
|
||||||
lateinit var mService: UsbService
|
lateinit var mService: UsbService
|
||||||
@@ -81,8 +87,11 @@ open class HemocubeActivity : AppCompatActivity() {
|
|||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
setupListener()
|
setupListener()
|
||||||
connectUsb(false)
|
connectUsb(false)
|
||||||
|
applicationContext.getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SuspiciousIndentation")
|
||||||
private fun setupListener() {
|
private fun setupListener() {
|
||||||
DataHolder.usbConnected.observe(this) {
|
DataHolder.usbConnected.observe(this) {
|
||||||
Log.d("USB OBSERVE", "HemoCube called -> $it")
|
Log.d("USB OBSERVE", "HemoCube called -> $it")
|
||||||
@@ -92,6 +101,7 @@ open class HemocubeActivity : AppCompatActivity() {
|
|||||||
} else {
|
} else {
|
||||||
myMenu?.get(0)?.icon =
|
myMenu?.get(0)?.icon =
|
||||||
ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_off_24)
|
ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_off_24)
|
||||||
|
logoutUser()
|
||||||
Toast.makeText(this, "Device is Disconnected", Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, "Device is Disconnected", Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,4 +195,16 @@ open class HemocubeActivity : AppCompatActivity() {
|
|||||||
viewModel.isServiceConnected = false
|
viewModel.isServiceConnected = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun logoutUser() {
|
||||||
|
val intent = Intent(this, DashboardActivity::class.java)
|
||||||
|
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||||
|
startActivity(intent)
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
41
app/src/main/res/layout/activity_buffer_check.xml
Normal file
41
app/src/main/res/layout/activity_buffer_check.xml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?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">
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/cl_parent"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/my_toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
app:titleTextColor="#FFFFFF"
|
||||||
|
android:elevation="4dp"
|
||||||
|
app:menu="@menu/my_menu"
|
||||||
|
android:theme="@style/ToolbarTheme"
|
||||||
|
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/fg_hc_buffer_check"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/my_toolbar"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
tools:context=".presentation.buffercheck.HemocubeBufferCheckActivity">
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</layout>
|
||||||
187
app/src/main/res/layout/fragment_hemo_cube_buffer_check.xml
Normal file
187
app/src/main/res/layout/fragment_hemo_cube_buffer_check.xml
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context="com.example.hpostesting.presentation.buffercheck.HemoCubeBufferCheckFragment">
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/cl_parent"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<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/Instructions"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_subtitle2"
|
||||||
|
style="@style/title2"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="24dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:text="@string/step4"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||||
|
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:id="@+id/tv_subtitle3"-->
|
||||||
|
<!-- style="@style/title2"-->
|
||||||
|
<!-- android:layout_width="0dp"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_marginHorizontal="24dp"-->
|
||||||
|
<!-- android:layout_marginTop="16dp"-->
|
||||||
|
<!-- android:text="@string/step5"-->
|
||||||
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
|
<!-- app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" />-->
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_name"
|
||||||
|
style="@style/title2"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="24dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/btn_submit" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_subtitle4"
|
||||||
|
style="@style/title1_1"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_marginHorizontal="24dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/red"
|
||||||
|
android:textSize="18sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <Button-->
|
||||||
|
<!-- android:visibility="gone"-->
|
||||||
|
<!-- android:id="@+id/btn_samplestart"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_marginHorizontal="16dp"-->
|
||||||
|
<!-- android:layout_marginTop="24dp"-->
|
||||||
|
<!-- android:clickable="false"-->
|
||||||
|
<!-- android:text="@string/Start_Sample"-->
|
||||||
|
<!-- android:textColor="@color/white"-->
|
||||||
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
|
<!-- app:layout_constraintTop_toBottomOf="@id/til_blood_group" />-->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <Button-->
|
||||||
|
<!-- android:id="@+id/btn_placebuffer"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_marginHorizontal="16dp"-->
|
||||||
|
<!-- android:layout_marginTop="24dp"-->
|
||||||
|
<!-- android:clickable="false"-->
|
||||||
|
<!-- android:text="@string/place_buffer"-->
|
||||||
|
<!-- android:textColor="@color/white"-->
|
||||||
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
|
<!-- app:layout_constraintTop_toBottomOf="@id/btn_submit" />-->
|
||||||
|
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_submit"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="16dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:text="@string/submit"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" />
|
||||||
|
|
||||||
|
<!-- <com.google.android.material.textfield.TextInputLayout-->
|
||||||
|
<!-- android:id="@+id/til_blood_group"-->
|
||||||
|
<!-- style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_marginHorizontal="24dp"-->
|
||||||
|
<!-- android:layout_marginTop="16dp"-->
|
||||||
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
|
<!-- app:layout_constraintTop_toBottomOf="@id/tv_subtitle4">-->
|
||||||
|
|
||||||
|
<!-- <AutoCompleteTextView-->
|
||||||
|
<!-- android:id="@+id/et_blood_group"-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:hint="@string/select_blood_group"-->
|
||||||
|
<!-- android:inputType="none"-->
|
||||||
|
<!-- android:labelFor="@id/til_blood_group"-->
|
||||||
|
<!-- app:simpleItems="@array/blood_group" />-->
|
||||||
|
|
||||||
|
<!-- </com.google.android.material.textfield.TextInputLayout>-->
|
||||||
|
|
||||||
|
<!-- <Button-->
|
||||||
|
<!-- android:id="@+id/btn_kit"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_margin="10dp"-->
|
||||||
|
<!-- android:text="@string/new_kit"-->
|
||||||
|
<!-- android:textColor="@color/white"-->
|
||||||
|
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||||
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent" />-->
|
||||||
|
|
||||||
|
<!-- <Button-->
|
||||||
|
<!-- android:id="@+id/btn_buffer"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:text="@string/new_buffer"-->
|
||||||
|
<!-- android:textColor="@color/white"-->
|
||||||
|
<!-- android:layout_margin="10dp"-->
|
||||||
|
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
|
<!-- app:layout_constraintEnd_toStartOf="@id/btn_kit"/>-->
|
||||||
|
|
||||||
|
<!-- <Button-->
|
||||||
|
<!-- android:id="@+id/btn_read"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:text="@string/read"-->
|
||||||
|
<!-- android:layout_margin="16dp"-->
|
||||||
|
<!-- android:clickable="false"-->
|
||||||
|
<!-- app:layout_constraintTop_toBottomOf="@id/btn_set_reference"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent" />-->
|
||||||
|
|
||||||
|
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
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>
|
||||||
|
|
||||||
|
</layout>
|
||||||
@@ -78,6 +78,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="16dp"
|
android:layout_marginHorizontal="16dp"
|
||||||
android:text="@string/start_incubation"
|
android:text="@string/start_incubation"
|
||||||
|
android:visibility="gone"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
app:layout_constraintStart_toEndOf="@+id/btn_blood"
|
app:layout_constraintStart_toEndOf="@+id/btn_blood"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/btn_blood" />
|
app:layout_constraintBottom_toBottomOf="@+id/btn_blood" />
|
||||||
|
|||||||
Reference in New Issue
Block a user