diff --git a/code/server/incoming_request_handlers.js b/code/server/incoming_request_handlers.js index ef583a1..9d23366 100644 --- a/code/server/incoming_request_handlers.js +++ b/code/server/incoming_request_handlers.js @@ -1,5 +1,5 @@ - -const databaseQuery = 'SELECT * FROM `Exercise` ORDER BY RAND() LIMIT 1'; +const databaseQuery = 'SELECT * FROM `Exercise` WHERE ExerciseID = 1'; +// const databaseQueryRand = 'SELECT * FROM `Exercise` ORDER BY RAND() LIMIT 1'; /** * diff --git a/code/src/Fitbot/.idea/misc.xml b/code/src/Fitbot/.idea/misc.xml index 48993be..ca880a9 100644 --- a/code/src/Fitbot/.idea/misc.xml +++ b/code/src/Fitbot/.idea/misc.xml @@ -25,6 +25,7 @@ + @@ -47,6 +48,7 @@ + diff --git a/code/src/Fitbot/app/src/main/java/com/example/fitbot/exercise/Exercise.java b/code/src/Fitbot/app/src/main/java/com/example/fitbot/exercise/Exercise.java index d0c4dc9..18153d7 100644 --- a/code/src/Fitbot/app/src/main/java/com/example/fitbot/exercise/Exercise.java +++ b/code/src/Fitbot/app/src/main/java/com/example/fitbot/exercise/Exercise.java @@ -17,13 +17,14 @@ public class Exercise { /** * Constructor for the AbstractExercise class. * - * @param muscleGroup The muscle group of the exercise. - * @param leftPath The path of the left hand. - * @param rightPath The path of the right hand. - * @param name The title of the exercise. - * @param description The description of the exercise. - * @param imageUrl The URL of the image. - * @param videoUrl The URL of the video. + * @param muscleGroup The muscle group of the exercise. + * @param leftPath The path of the left hand. + * @param rightPath The path of the right hand. + * @param name The title of the exercise. + * @param shortDescription The short description of the exercise. + * @param description The full description of the exercise. + * @param imageUrl The URL of the image. + * @param videoUrl The URL of the video. */ public Exercise(EMuscleGroup muscleGroup, String name,String shortDescription, String description, String imageUrl, String videoUrl, GesturePath leftPath, GesturePath rightPath, float exerciseTimeInSeconds) { this.name = name; diff --git a/code/src/Fitbot/app/src/main/java/com/example/fitbot/exercise/ExerciseManager.java b/code/src/Fitbot/app/src/main/java/com/example/fitbot/exercise/ExerciseManager.java index 94599a9..0de72d0 100644 --- a/code/src/Fitbot/app/src/main/java/com/example/fitbot/exercise/ExerciseManager.java +++ b/code/src/Fitbot/app/src/main/java/com/example/fitbot/exercise/ExerciseManager.java @@ -36,8 +36,7 @@ public class ExerciseManager { private static final String[] REQUIRED_PROPERTIES = { PROPERTY_MUSCLE_GROUP, PROPERTY_DESC,PROPERTY_SHORT_DESC, PROPERTY_IMAGE_URL, PROPERTY_VIDEO_URL, PROPERTY_NAME, PROPERTY_PATH, - PROPERTY_EXERCISE_DURATION, PROPERTY_EXERCISE_ID, - PROPERTY_SHORT_DESC + PROPERTY_EXERCISE_DURATION, PROPERTY_EXERCISE_ID }; public static final int DEFAULT_EXERCISE_REPETITIONS = 10; @@ -115,8 +114,8 @@ public class ExerciseManager { return new Exercise( EMuscleGroup.parse(content.get(PROPERTY_MUSCLE_GROUP).getAsString()), content.get(PROPERTY_NAME).getAsString(), - content.get(PROPERTY_DESC).getAsString(), content.get(PROPERTY_SHORT_DESC).getAsString(), + content.get(PROPERTY_DESC).getAsString(), content.get(PROPERTY_IMAGE_URL).getAsString(), content.get(PROPERTY_VIDEO_URL).getAsString(), GesturePath.fromString(leftRightData[0]), 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 975a8b3..7282278 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 @@ -3,6 +3,7 @@ package com.example.fitbot.ui.activities; import android.app.Dialog; import android.content.Context; import android.graphics.drawable.ColorDrawable; +import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; @@ -38,7 +39,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall private TextView exerciseMuscleGroupTextView; private TextView exerciseNameTextView; private TextView exerciseShortDescriptionTextView; - private TextView exerciseDescriptionTextView; + //private TextView exerciseDescriptionTextView; private static String exerciseVideoUrl; private final Object lock = new Object(); @@ -55,6 +56,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall private static final float SENSOR_SAMPLE_RATE = 10.0f; private static final int EXERCISE_COUNT = 5; + private static int EXERCISE_REP = 10; private static final float EXERCISE_SPEED_MULTIPLIER = 1.0f; @Override @@ -65,8 +67,8 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall // Fill empty objects with exercise data this.exerciseNameTextView = findViewById(R.id.textViewFitnessTitle); - //this.exerciseDescriptionTextView = findViewById(R.id.textViewDialogDescription); this.exerciseShortDescriptionTextView = findViewById(R.id.textViewFitnessShortDescription); + //this.exerciseDescriptionTextView = findViewById(R.id.textViewDialogDescription); // Navigation Buttons NavigationManager.setupButtonNavigation(this, R.id.homeButtonFitness, MainActivity.class); @@ -117,9 +119,6 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall NavigationManager.navigateToActivity(this, EndScreenActivity.class); }); }); - VideoView videoView = findViewById(R.id.videoView); - Log.e("exerciseVideoUrl", "videoUrl:" + exerciseVideoUrl); - playVideo(videoView, this); } /** @@ -141,6 +140,21 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall exerciseShortDescriptionTextView.setText(exercise.shortDescription); // exerciseDescriptionTextView.setText(exercise.description); exerciseVideoUrl = exercise.videoUrl; + + // Play the video + VideoView videoView = findViewById(R.id.videoView); + playVideo(videoView, this); + + // Set a listener to repeat the video + while (EXERCISE_REP > 1) { + videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { + @Override + public void onCompletion(MediaPlayer mp) { + videoView.start(); // start the video again + } + }); + EXERCISE_REP--; + } }); } })).start(); diff --git a/code/src/Fitbot/app/src/main/res/drawable/fitbot_launcher_background.xml b/code/src/Fitbot/app/src/main/res/drawable/fitbot_launcher_background.xml index ca3826a..071825e 100644 --- a/code/src/Fitbot/app/src/main/res/drawable/fitbot_launcher_background.xml +++ b/code/src/Fitbot/app/src/main/res/drawable/fitbot_launcher_background.xml @@ -5,7 +5,7 @@ android:viewportHeight="108" android:viewportWidth="108" xmlns:android="http://schemas.android.com/apk/res/android"> - diff --git a/code/src/Fitbot/app/src/main/res/layout/activity_fitness.xml b/code/src/Fitbot/app/src/main/res/layout/activity_fitness.xml index ea324d5..f802f04 100644 --- a/code/src/Fitbot/app/src/main/res/layout/activity_fitness.xml +++ b/code/src/Fitbot/app/src/main/res/layout/activity_fitness.xml @@ -42,15 +42,23 @@ android:layout_margin="10dp" tools:ignore="SpeakableTextPresentCheck" /> - + android:layout_marginBottom="50dp" + card_view:cardCornerRadius="30dp"> + + + + @@ -61,9 +69,9 @@ android:layout_marginVertical="20dp" android:layout_marginLeft="15dp" android:layout_marginRight="30dp" + android:padding="10dp" android:background="@drawable/border_background" android:orientation="vertical" - android:padding="20dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> @@ -75,20 +83,19 @@ android:layout_height="wrap_content" android:text="@string/title" android:textAlignment="center" - android:layout_gravity="center_horizontal" - android:layout_marginBottom="5dp"/> + android:layout_gravity="center_horizontal" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code/src/Fitbot/app/src/main/res/raw/squat.qianim b/code/src/Fitbot/app/src/main/res/raw/squat.qianim new file mode 100644 index 0000000..a25766a --- /dev/null +++ b/code/src/Fitbot/app/src/main/res/raw/squat.qianim @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code/src/Fitbot/app/src/main/res/values/styles.xml b/code/src/Fitbot/app/src/main/res/values/styles.xml index be54ae7..d2d8f81 100644 --- a/code/src/Fitbot/app/src/main/res/values/styles.xml +++ b/code/src/Fitbot/app/src/main/res/values/styles.xml @@ -25,6 +25,13 @@ 6dp + +