Merged Jw -> (Qi Ying -> Harine)
This commit is contained in:
@@ -70,7 +70,7 @@ class BowlingCameraActivity : AppCompatActivity(), CameraXController.Callback {
|
|||||||
private lateinit var stepCounterUi: StepCounterUiController
|
private lateinit var stepCounterUi: StepCounterUiController
|
||||||
// class for FeedbackUI
|
// class for FeedbackUI
|
||||||
private lateinit var feedbackUI: FeedbackUI
|
private lateinit var feedbackUI: FeedbackUI
|
||||||
private val stepLabels = listOf(
|
private val stepLabels = listOf<Int>(
|
||||||
R.string.pose_phase_waiting,
|
R.string.pose_phase_waiting,
|
||||||
R.string.pose_phase_starting_stance,
|
R.string.pose_phase_starting_stance,
|
||||||
R.string.first_step,
|
R.string.first_step,
|
||||||
@@ -82,7 +82,7 @@ class BowlingCameraActivity : AppCompatActivity(), CameraXController.Callback {
|
|||||||
private var currentStepIndex = 0
|
private var currentStepIndex = 0
|
||||||
|
|
||||||
private val permissionLauncher =
|
private val permissionLauncher =
|
||||||
registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { _ ->
|
registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { _: Map<String, Boolean> ->
|
||||||
val granted = CameraPermissions.allGranted(this)
|
val granted = CameraPermissions.allGranted(this)
|
||||||
viewModel.onPermissionsResult(granted)
|
viewModel.onPermissionsResult(granted)
|
||||||
if (granted) {
|
if (granted) {
|
||||||
@@ -220,7 +220,8 @@ class BowlingCameraActivity : AppCompatActivity(), CameraXController.Callback {
|
|||||||
}
|
}
|
||||||
launch {
|
launch {
|
||||||
viewModel.errorEvents.collect { message ->
|
viewModel.errorEvents.collect { message ->
|
||||||
Toast.makeText(this@BowlingCameraActivity, message, Toast.LENGTH_LONG).show()
|
Toast.makeText(this@BowlingCameraActivity, message, Toast.LENGTH_LONG)
|
||||||
|
.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
launch {
|
launch {
|
||||||
@@ -232,7 +233,12 @@ class BowlingCameraActivity : AppCompatActivity(), CameraXController.Callback {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
launch {
|
launch {
|
||||||
viewModel.handRaiseProgress.collect { progress -> stepCounterUi.renderHandRaiseProgress(progress) }
|
viewModel.handRaiseProgress.collect { progress ->
|
||||||
|
stepCounterUi.renderHandRaiseProgress(
|
||||||
|
progress
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
// Deliberately its own collector, independent of stepEvents
|
// Deliberately its own collector, independent of stepEvents
|
||||||
// above -- delivery-phase feedback and step counting are
|
// above -- delivery-phase feedback and step counting are
|
||||||
// separate concerns (see PosePhaseDetector's class doc).
|
// 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.
|
// live preview with pose overlay on but not recording doesn't feed it.
|
||||||
private val stepCountingSession = StepCountingSession()
|
private val stepCountingSession = StepCountingSession()
|
||||||
/** @brief Time-ordered pose samples buffered for the current/most recent recording session. */
|
/** @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
|
// Extra SMA smoothing for ankle/hip landmarks specifically, on top of
|
||||||
// PoseLandmarkSmoother's per-frame EMA -- see AnkleHipMovingAverageFilter.
|
// PoseLandmarkSmoother's per-frame EMA -- see AnkleHipMovingAverageFilter.
|
||||||
|
|||||||
@@ -44,4 +44,14 @@
|
|||||||
<string name="editor_save">Save</string>
|
<string name="editor_save">Save</string>
|
||||||
<string name="editor_saved_toast">Settings saved</string>
|
<string name="editor_saved_toast">Settings saved</string>
|
||||||
<string name="editor_invalid_value_toast">Enter a valid number for every field</string>
|
<string name="editor_invalid_value_toast">Enter a valid number for every field</string>
|
||||||
|
<string name="pose_phase_starting_stance">Starting Stance</string>
|
||||||
|
<string name="pose_phase_waiting">Waiting for stance…</string>
|
||||||
|
<string name="first_step">Step 1</string>
|
||||||
|
<string name="second_step">Step 2</string>
|
||||||
|
<string name="third_step">Step 3</string>
|
||||||
|
<string name="fourth_step">Step 4</string>
|
||||||
|
<string name="end_position">End Position</string>
|
||||||
|
<string name="pose_phase_approach">Approach</string>
|
||||||
|
<string name="pose_phase_pushaway">Pushaway</string>
|
||||||
|
<string name="pose_metrics_format">Torso: %1$s | L Knee: %2$s | R Knee: %3$s | L Elbow: %4$s | R Elbow: %5$s</string>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user