Removed update button.
This commit is contained in:
@@ -9,11 +9,15 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.children
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.example.refactoredapp.R
|
||||
import com.example.refactoredapp.data.DataHolder
|
||||
import com.example.refactoredapp.data.constant.Constants
|
||||
import com.example.refactoredapp.data.constant.TestRightCommands
|
||||
import com.example.refactoredapp.data.model.PatientData
|
||||
import com.example.refactoredapp.data.model.TestRightResultType
|
||||
import com.example.refactoredapp.databinding.FragmentTestRightExpSampleBinding
|
||||
import com.example.refactoredapp.presentation.UsbServiceListener
|
||||
|
||||
@@ -30,7 +34,14 @@ class TestRightExpSample : Fragment() {
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
binding = FragmentTestRightExpSampleBinding.inflate(inflater, container, false)
|
||||
binding.btnUpdateReference.disable()
|
||||
// if (DataHolder.sampleReadCounter > Constants.MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE) {
|
||||
// binding.btnUpdateReference.enable()
|
||||
// binding.clInstructions.setAllEnabled(false)
|
||||
// } else {
|
||||
// binding.btnUpdateReference.disable()
|
||||
// binding.clInstructions.setAllEnabled(false)
|
||||
// }
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@@ -42,8 +53,12 @@ class TestRightExpSample : Fragment() {
|
||||
viewModel.progressBar.observe(viewLifecycleOwner) {
|
||||
if (it) {
|
||||
binding.progressBar.visibility = View.VISIBLE
|
||||
binding.clParent.alpha = 0.5f
|
||||
binding.btnAcquire.isEnabled = false
|
||||
} else {
|
||||
binding.progressBar.visibility = View.GONE
|
||||
binding.clParent.alpha = 1f
|
||||
binding.btnAcquire.isEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +93,7 @@ class TestRightExpSample : Fragment() {
|
||||
binding.ddGender.error = getString(R.string.gender_error)
|
||||
return null
|
||||
}
|
||||
return PatientData(name.toString(), age.toString().toInt(), gender.toString(), null)
|
||||
return PatientData(name.toString(), age.toString().toInt(), gender.toString(), TestRightResultType.UNDEFINED)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,6 +107,7 @@ class TestRightExpSample : Fragment() {
|
||||
}
|
||||
|
||||
private fun sendCmdToRun() {
|
||||
Log.d(TAG, "sendCmdToRun() called")
|
||||
viewModel.progressBar.postValue(true)
|
||||
val fullReadOutput = StringBuilder()
|
||||
(activity as TestRightActivity).mService.eventDrivenWrite(
|
||||
@@ -125,6 +141,7 @@ class TestRightExpSample : Fragment() {
|
||||
}
|
||||
|
||||
private fun sendCmdToFetchLightIntensities() {
|
||||
Log.d(TAG, "sendCmdToFetchLightIntensities() called")
|
||||
viewModel.progressBar.postValue(true)
|
||||
val fullReadOutput = StringBuilder()
|
||||
(activity as TestRightActivity).mService.eventDrivenWrite(TestRightCommands.printAll,
|
||||
@@ -150,7 +167,9 @@ class TestRightExpSample : Fragment() {
|
||||
}
|
||||
|
||||
private fun showResultsAfterAcquiring() {
|
||||
viewModel.mapWavelengthToAbsorbance()
|
||||
viewModel.calculateResults()
|
||||
|
||||
viewModel.progressBar.postValue(false)
|
||||
// binding.progressBar.visibility = View.GONE
|
||||
parentFragmentManager.beginTransaction().replace(R.id.fl_main, TestRightResults())
|
||||
@@ -167,4 +186,9 @@ class TestRightExpSample : Fragment() {
|
||||
// background.setColorFilter(Color.BLUE, PorterDuff.Mode.MULTIPLY)
|
||||
isClickable = true
|
||||
}
|
||||
|
||||
fun View.setAllEnabled(enabled: Boolean) {
|
||||
isEnabled = enabled
|
||||
if (this is ViewGroup) children.forEach { child -> child.setAllEnabled(enabled) }
|
||||
}
|
||||
}
|
||||
@@ -9,20 +9,28 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_update_reference"
|
||||
android:layout_width="216dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:clickable="false"
|
||||
android:text="@string/update_reference"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/btn_update_reference"-->
|
||||
<!-- android:layout_width="216dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginHorizontal="24dp"-->
|
||||
<!-- android:layout_marginTop="24dp"-->
|
||||
<!-- android:clickable="false"-->
|
||||
<!-- android:text="@string/update_reference"-->
|
||||
<!-- android:textColor="@color/white"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
|
||||
<!-- android:id="@+id/cl_instructions"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/btn_update_reference">-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
@@ -33,7 +41,7 @@
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/Instructions"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_update_reference" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_subtitle1"
|
||||
@@ -207,15 +215,17 @@
|
||||
<!-- 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"
|
||||
android:elevation="12dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
Reference in New Issue
Block a user