diff --git a/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/activities/FitnessActivity.java b/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/activities/FitnessActivity.java index 510c035..e01867a 100644 --- a/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/activities/FitnessActivity.java +++ b/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/activities/FitnessActivity.java @@ -269,7 +269,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall public void incrementProgress(View view) { if (progress < maxProgress) { progress++; - triggerColorBurst(false); + triggerColorBurst(true); updateProgress(); } } @@ -283,8 +283,10 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall if (isGoodRep) { progressCircle.setProgressDrawable(ContextCompat.getDrawable(this, R.drawable.progress_circle_good)); + new MediaPlayer().create(this, R.raw.good_sound).start(); } else { progressCircle.setProgressDrawable(ContextCompat.getDrawable(this, R.drawable.progress_circle_bad)); + new MediaPlayer().create(this, R.raw.wrong_sound).start(); } ObjectAnimator animator = ObjectAnimator.ofFloat(progressCircle, "alpha", 1f, 0f, 1f); diff --git a/code/src/Fitbot/app/src/main/java/com/example/fitbot/util/processing/InputProcessor.java b/code/src/Fitbot/app/src/main/java/com/example/fitbot/util/processing/InputProcessor.java index fdf1eba..6a3fd8a 100644 --- a/code/src/Fitbot/app/src/main/java/com/example/fitbot/util/processing/InputProcessor.java +++ b/code/src/Fitbot/app/src/main/java/com/example/fitbot/util/processing/InputProcessor.java @@ -130,7 +130,7 @@ public class InputProcessor { */ public void onAdequateRepetition() { ExerciseManager.TOTAL_REPETITIONS_PERFORMED++; - // TODO: Play sound + // TODO: Add animation for correct repetition } /** @@ -138,6 +138,7 @@ public class InputProcessor { */ public void onInadequateRepetition() { + // TODO: Add animation for wrong repetition } /** @@ -344,16 +345,6 @@ public class InputProcessor { return jsonArray.toString(); } - /** - * Method for getting the current progress of the exercise. - * The return value will range between 0.0 and 1.0. - * - * @return The current progress of the exercise. - */ - public double getCurrentProgress() { - return secondsPassed / exerciseDurationInSeconds; - } - /** * Function for getting the combined (average) error value of both sensors. public double getCombinedError() @@ -373,9 +364,10 @@ public class InputProcessor { */ public double getError(int sensorId, float time) { - /*// Ensure the sensor ID is within the bounds of the array + // Ensure the sensor ID is within the bounds of the array if (sensorId < 0 || sensorId >= selfRotationVectorPaths.length) return 0.0d; + /* // Index of the current rotation vector int targetIndex = (int) ((this.exerciseDurationInSeconds / this.targetRotationVectorPaths[sensorId].length) * time); diff --git a/code/src/Fitbot/app/src/main/res/raw/good_sound.mp3 b/code/src/Fitbot/app/src/main/res/raw/good_sound.mp3 new file mode 100644 index 0000000..9fe5526 Binary files /dev/null and b/code/src/Fitbot/app/src/main/res/raw/good_sound.mp3 differ diff --git a/code/src/Fitbot/app/src/main/res/raw/wrong_sound.wav b/code/src/Fitbot/app/src/main/res/raw/wrong_sound.wav new file mode 100644 index 0000000..bdd516d Binary files /dev/null and b/code/src/Fitbot/app/src/main/res/raw/wrong_sound.wav differ