reversed ordering of Yes & No buttons + Added alert dialog in sample page + Updated text of alert dialog and a button in sample page. (Update based on feedback)
This commit is contained in:
@@ -61,16 +61,16 @@ class TestRightExpReference : Fragment() {
|
||||
requireContext(),
|
||||
getString(R.string.have_you_placed),
|
||||
getString(R.string.please_place),
|
||||
getString(R.string.yes),
|
||||
getString(R.string.no),
|
||||
getString(R.string.yes),
|
||||
object : MyDialogListener {
|
||||
override fun onClickBtnOne() {
|
||||
startTakingReference()
|
||||
}
|
||||
override fun onClickBtnTwo() {
|
||||
override fun onClickNegativeButton() {
|
||||
// Todo: Only for testing
|
||||
// viewModel.progressBar.postValue(true)
|
||||
}
|
||||
override fun onClickPositiveButton() {
|
||||
startTakingReference()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -284,6 +284,7 @@ class TestRightExpReference : Fragment() {
|
||||
}
|
||||
|
||||
private fun moveToSamplePage() {
|
||||
Toast.makeText(requireContext(), "Reference taken successfully.", Toast.LENGTH_SHORT).show()
|
||||
parentFragmentManager.beginTransaction().replace(R.id.fl_main, TestRightExpSample())
|
||||
.commit()
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.core.view.children
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.example.hpos.R
|
||||
@@ -18,6 +16,7 @@ import com.example.hpos.data.model.PatientData
|
||||
import com.example.hpos.data.model.TestRightResultType
|
||||
import com.example.hpos.databinding.FragmentTestRightExpSampleBinding
|
||||
import com.example.hpos.presentation.UsbServiceListener
|
||||
import com.example.hpos.presentation.utils.MyDialogListener
|
||||
import com.example.hpos.presentation.utils.UIUtils
|
||||
|
||||
class TestRightExpSample : Fragment() {
|
||||
@@ -53,11 +52,11 @@ class TestRightExpSample : Fragment() {
|
||||
if (it) {
|
||||
binding.progressBar.visibility = View.VISIBLE
|
||||
binding.clParent.alpha = 0.5f
|
||||
binding.btnAcquire.isEnabled = false
|
||||
binding.btnSubmit.isEnabled = false
|
||||
} else {
|
||||
binding.progressBar.visibility = View.GONE
|
||||
binding.clParent.alpha = 1f
|
||||
binding.btnAcquire.isEnabled = true
|
||||
binding.btnSubmit.isEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,11 +66,23 @@ class TestRightExpSample : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
binding.btnAcquire.setOnClickListener {
|
||||
val details = isValidInput()
|
||||
binding.btnSubmit.setOnClickListener {
|
||||
val details = checkAndReturnPatientDetails()
|
||||
if (details != null) {
|
||||
viewModel.patientDetails = details
|
||||
startAcquiring()
|
||||
|
||||
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()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
binding.etNameBlock.setOnClickListener { binding.etName.isErrorEnabled = false }
|
||||
@@ -79,7 +90,7 @@ class TestRightExpSample : Fragment() {
|
||||
binding.etGenderBlock.setOnClickListener { binding.ddGender.isErrorEnabled = false }
|
||||
}
|
||||
|
||||
private fun isValidInput(): PatientData? {
|
||||
private fun checkAndReturnPatientDetails(): PatientData? {
|
||||
val name = binding.etName.editText?.text?.trim()
|
||||
if (name.isNullOrEmpty()) {
|
||||
binding.etName.error = getString(R.string.name_error)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.example.hpos.presentation.utils
|
||||
|
||||
interface MyDialogListener {
|
||||
fun onClickBtnOne()
|
||||
fun onClickBtnTwo()
|
||||
fun onClickNegativeButton()
|
||||
fun onClickPositiveButton()
|
||||
}
|
||||
@@ -18,10 +18,10 @@ object UIUtils {
|
||||
.setTitle(title)
|
||||
.setMessage(subtitle)
|
||||
.setNegativeButton(btnOneText) { _, _ ->
|
||||
listener.onClickBtnOne()
|
||||
listener.onClickNegativeButton()
|
||||
}
|
||||
.setPositiveButton(btnTwoText) { _, _ ->
|
||||
listener.onClickBtnTwo()
|
||||
listener.onClickPositiveButton()
|
||||
}
|
||||
.show()
|
||||
}
|
||||
|
||||
@@ -193,13 +193,13 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_acquire"
|
||||
android:id="@+id/btn_submit"
|
||||
android:layout_width="216dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:clickable="false"
|
||||
android:text="@string/start_now"
|
||||
android:text="@string/submit"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<!-- Alert Dialog -->
|
||||
<string name="have_you_placed">Have you placed the cuvette containing reference sample?</string>
|
||||
<string name="please_place">Please place the cuvette containing sample for reference before moving forward</string>
|
||||
<string name="please_place">Please place the cuvette containing sample for reference before running</string>
|
||||
<string name="yes">Yes</string>
|
||||
<string name="no">No</string>
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
<string name="update_reference">Update Reference</string>
|
||||
|
||||
|
||||
<string name="have_you_placed_sample">Have you placed the cuvette with sample?</string>
|
||||
<string name="please_place_sample">Please place the cuvette containing sample before running</string>
|
||||
<string name="yes_and_run">Yes, Run</string>
|
||||
|
||||
|
||||
|
||||
<!-- Instructions Text -->
|
||||
<string name="Instructions">Instructions</string>
|
||||
<string name="step1"><b><u>Step 1</u> : </b> Place the cuvette containing reference/baseline sample for referencing.</string>
|
||||
@@ -71,5 +77,6 @@
|
||||
<string name="high_performance_optical_spectroscopy">High Performance\nOptical Spectroscopy</string>
|
||||
<string name="sickle_cert">Sickle Cert</string>
|
||||
<string name="sickle_find">Sickle Find</string>
|
||||
<string name="submit">Submit</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user