added back phase toggle button
This commit is contained in:
@@ -79,6 +79,16 @@ class BowlingCameraActivity : AppCompatActivity(), CameraXController.Callback {
|
||||
// class for FeedbackUI
|
||||
private lateinit var feedbackUI: FeedbackUI
|
||||
|
||||
private val stepLabels = listOf(
|
||||
R.string.pose_phase_starting_stance,
|
||||
R.string.pose_phase_approach,
|
||||
R.string.pose_phase_pushaway,
|
||||
R.string.pose_phase_back_swing,
|
||||
R.string.pose_phase_power_step,
|
||||
R.string.pose_phase_slide_and_release,
|
||||
)
|
||||
private var currentPhaseToggleIndex = 0
|
||||
|
||||
private val permissionLauncher =
|
||||
registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { _: Map<String, Boolean> ->
|
||||
val granted = CameraPermissions.allGranted(this)
|
||||
@@ -134,6 +144,7 @@ class BowlingCameraActivity : AppCompatActivity(), CameraXController.Callback {
|
||||
}
|
||||
}
|
||||
binding.btnResetCounter.setOnClickListener { viewModel.resetStepCounter() }
|
||||
binding.btnShowStep.setOnClickListener { onPhaseToggleClicked() }
|
||||
|
||||
observeViewModel()
|
||||
|
||||
@@ -550,4 +561,12 @@ class BowlingCameraActivity : AppCompatActivity(), CameraXController.Callback {
|
||||
cameraExecutor.shutdown()
|
||||
debugSessionLogger.stop()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cycles through the delivery phase labels on the manual toggle button.
|
||||
*/
|
||||
private fun onPhaseToggleClicked() {
|
||||
currentPhaseToggleIndex = (currentPhaseToggleIndex + 1) % stepLabels.size
|
||||
binding.btnShowStep.setText(stepLabels[currentPhaseToggleIndex])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,6 +229,17 @@
|
||||
app:layout_constraintBottom_toTopOf="@id/btn_switch_camera"
|
||||
app:layout_constraintEnd_toEndOf="@id/btn_record" />
|
||||
|
||||
<!-- Bottom Middle: Manual Phase Toggle Button -->
|
||||
<Button
|
||||
android:id="@+id/btn_show_step"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="@string/pose_phase_starting_stance"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<!-- Bottom Right: Manual Reset Step Counter Button -->
|
||||
<Button
|
||||
android:id="@+id/btn_reset_counter"
|
||||
|
||||
@@ -236,6 +236,17 @@
|
||||
app:layout_constraintStart_toEndOf="@id/switch_pose"
|
||||
app:layout_constraintEnd_toStartOf="@id/btn_reset_counter" />
|
||||
|
||||
<!-- Bottom Middle: Manual Phase Toggle Button -->
|
||||
<Button
|
||||
android:id="@+id/btn_show_step"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="80dp"
|
||||
android:text="@string/pose_phase_starting_stance"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<!-- Bottom Right: Manual Reset Step Counter Button -->
|
||||
<Button
|
||||
android:id="@+id/btn_reset_counter"
|
||||
|
||||
Reference in New Issue
Block a user