Made some corrections
This commit is contained in:
@@ -33,6 +33,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
private var currentDeviceData: DeviceData? = null
|
private var currentDeviceData: DeviceData? = null
|
||||||
private var resultData: String = ""
|
private var resultData: String = ""
|
||||||
private var isUsingExistingBuffer = false
|
private var isUsingExistingBuffer = false
|
||||||
|
private var isTestOngoing = false
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||||
@@ -60,12 +61,33 @@ class HemoCubeFragment : Fragment() {
|
|||||||
binding.btnSubmit.isEnabled = false
|
binding.btnSubmit.isEnabled = false
|
||||||
binding.btnSubmit.isClickable = false
|
binding.btnSubmit.isClickable = false
|
||||||
|
|
||||||
binding.btnBuffer.setOnClickListener { startBufferProcess() }
|
// binding.btnBuffer.setOnClickListener { startBufferProcess() }
|
||||||
|
|
||||||
binding.btnKit.setOnClickListener {
|
binding.btnKit.setOnClickListener {
|
||||||
resetKitCount()
|
if (isTestOngoing) {
|
||||||
val intent = Intent(context, KitScanActivity::class.java)
|
val title = "WARNING"
|
||||||
startActivity(intent)
|
val message = "There is a on going test, do you want to stop it"
|
||||||
|
val negativeText = getString(R.string.no)
|
||||||
|
val positiveText = "Yes"
|
||||||
|
|
||||||
|
UIUtils.createAlertDialog(requireContext(),
|
||||||
|
title,
|
||||||
|
message,
|
||||||
|
negativeText,
|
||||||
|
positiveText,
|
||||||
|
object : MyDialogListener {
|
||||||
|
override fun onClickNegativeButton() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClickPositiveButton() {
|
||||||
|
resetKitCount()
|
||||||
|
val intent = Intent(context, KitScanActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
|
(activity as HemocubeActivity).finish()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,6 +118,10 @@ class HemoCubeFragment : Fragment() {
|
|||||||
isOnline = isNetworkAvailable
|
isOnline = isNetworkAvailable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hemoCubeViewModel.messages.observe(viewLifecycleOwner) {
|
||||||
|
binding.tvSubtitle4.text = it
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkAndStartProcess() {
|
private fun checkAndStartProcess() {
|
||||||
@@ -170,7 +196,8 @@ class HemoCubeFragment : Fragment() {
|
|||||||
|
|
||||||
private fun handleUsbData(stringData: String, fullReadOutput: StringBuilder) {
|
private fun handleUsbData(stringData: String, fullReadOutput: StringBuilder) {
|
||||||
if (stringData.contains("#")) {
|
if (stringData.contains("#")) {
|
||||||
binding.tvSubtitle4.text = stringData
|
hemoCubeViewModel.messages.postValue(stringData)
|
||||||
|
isTestOngoing = true
|
||||||
}
|
}
|
||||||
|
|
||||||
resultData += fullReadOutput.toString()
|
resultData += fullReadOutput.toString()
|
||||||
@@ -378,6 +405,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
|
|
||||||
private fun resetKitCount() {
|
private fun resetKitCount() {
|
||||||
with(sharedPreferences.edit()) {
|
with(sharedPreferences.edit()) {
|
||||||
|
putString(Constants.KIT_NUMBER, "")
|
||||||
putInt(Constants.KIT_COUNT, 0)
|
putInt(Constants.KIT_COUNT, 0)
|
||||||
apply()
|
apply()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
var isServiceConnected = false
|
var isServiceConnected = false
|
||||||
val progressBar = MutableLiveData(false)
|
val progressBar = MutableLiveData(false)
|
||||||
private val testDetails = DataHolder.selectedTest?.toHemoCubeTestData()
|
private val testDetails = DataHolder.selectedTest?.toHemoCubeTestData()
|
||||||
|
val messages = MutableLiveData<String>()
|
||||||
private val sharedPreference: SharedPreferences = context.getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
private val sharedPreference: SharedPreferences = context.getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
||||||
|
|
||||||
// Get the device ID of the device you want to retrieve data for (e.g., the first device in the list)
|
// Get the device ID of the device you want to retrieve data for (e.g., the first device in the list)
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_submit"
|
android:id="@+id/btn_submit"
|
||||||
android:layout_width="216dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="16dp"
|
android:layout_marginHorizontal="16dp"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
@@ -79,6 +79,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="24dp"
|
android:layout_marginHorizontal="24dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
|
android:visibility="gone"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/btn_submit">
|
app:layout_constraintTop_toBottomOf="@id/btn_submit">
|
||||||
@@ -89,6 +90,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/select_blood_group"
|
android:hint="@string/select_blood_group"
|
||||||
android:inputType="none"
|
android:inputType="none"
|
||||||
|
android:visibility="gone"
|
||||||
android:labelFor="@id/til_blood_group"
|
android:labelFor="@id/til_blood_group"
|
||||||
app:simpleItems="@array/blood_group" />
|
app:simpleItems="@array/blood_group" />
|
||||||
|
|
||||||
@@ -98,23 +100,23 @@
|
|||||||
android:id="@+id/btn_kit"
|
android:id="@+id/btn_kit"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
android:text="@string/new_kit"
|
android:text="@string/new_kit"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:layout_margin="10dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/btn_buffer" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
<Button
|
<!-- <Button-->
|
||||||
android:id="@+id/btn_buffer"
|
<!-- android:id="@+id/btn_buffer"-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:text="@string/new_buffer"
|
<!-- android:text="@string/new_buffer"-->
|
||||||
android:textColor="@color/white"
|
<!-- android:textColor="@color/white"-->
|
||||||
android:layout_margin="10dp"
|
<!-- android:layout_margin="10dp"-->
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
app:layout_constraintEnd_toStartOf="@id/btn_kit"/>
|
<!-- app:layout_constraintEnd_toStartOf="@id/btn_kit"/>-->
|
||||||
|
|
||||||
<!-- <Button-->
|
<!-- <Button-->
|
||||||
<!-- android:id="@+id/btn_read"-->
|
<!-- android:id="@+id/btn_read"-->
|
||||||
|
|||||||
Reference in New Issue
Block a user