Merged Jw -> (Qi Ying -> Harine)

This commit is contained in:
Gabriel Low
2026-09-08 11:42:22 +08:00
parent 47f4567005
commit eb2491ea21
3 changed files with 21 additions and 5 deletions
@@ -70,7 +70,7 @@ class BowlingCameraActivity : AppCompatActivity(), CameraXController.Callback {
private lateinit var stepCounterUi: StepCounterUiController
// class for FeedbackUI
private lateinit var feedbackUI: FeedbackUI
private val stepLabels = listOf(
private val stepLabels = listOf<Int>(
R.string.pose_phase_waiting,
R.string.pose_phase_starting_stance,
R.string.first_step,
@@ -82,7 +82,7 @@ class BowlingCameraActivity : AppCompatActivity(), CameraXController.Callback {
private var currentStepIndex = 0
private val permissionLauncher =
registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { _ ->
registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { _: Map<String, Boolean> ->
val granted = CameraPermissions.allGranted(this)
viewModel.onPermissionsResult(granted)
if (granted) {
@@ -220,7 +220,8 @@ class BowlingCameraActivity : AppCompatActivity(), CameraXController.Callback {
}
launch {
viewModel.errorEvents.collect { message ->
Toast.makeText(this@BowlingCameraActivity, message, Toast.LENGTH_LONG).show()
Toast.makeText(this@BowlingCameraActivity, message, Toast.LENGTH_LONG)
.show()
}
}
launch {
@@ -232,7 +233,12 @@ class BowlingCameraActivity : AppCompatActivity(), CameraXController.Callback {
}
}
launch {
viewModel.handRaiseProgress.collect { progress -> stepCounterUi.renderHandRaiseProgress(progress) }
viewModel.handRaiseProgress.collect { progress ->
stepCounterUi.renderHandRaiseProgress(
progress
)
}
}
// Deliberately its own collector, independent of stepEvents
// above -- delivery-phase feedback and step counting are
// separate concerns (see PosePhaseDetector's class doc).
@@ -71,7 +71,7 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
// live preview with pose overlay on but not recording doesn't feed it.
private val stepCountingSession = StepCountingSession()
/** @brief Time-ordered pose samples buffered for the current/most recent recording session. */
val poseFrames: List<PoseFrame> get() = poseFrameBuffer
val poseFrames: List<PoseFrame> get() = stepCountingSession.poseFrames
// Extra SMA smoothing for ankle/hip landmarks specifically, on top of
// PoseLandmarkSmoother's per-frame EMA -- see AnkleHipMovingAverageFilter.