From 65f4bb32b7f6c3d57137ab1fd56a1de3ea3c79c0 Mon Sep 17 00:00:00 2001 From: Niels Gras Date: Wed, 5 Jun 2024 13:40:30 +0200 Subject: [PATCH 1/2] fixed animation code placement --- .../fitbot/ui/activities/FitnessActivity.java | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) 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 e01867a..d1cb337 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 @@ -133,22 +133,6 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall motionProcessor.setRecording(true, 10); motionProcessor.startListening(); - if ( videoView.isPlaying() ) - { - Animation animationarmraise = AnimationBuilder.with(qiContext) // Create the builder with the context. - .withResources(R.raw.armraise) // Set the animation resource. - .build(); // Build the animation. - - animate = AnimateBuilder.with(qiContext) // Create the builder with the context. - .withAnimation(animationarmraise) // Set the animation. - .build(); // Build the animate action. - - Future animateFuture = animate.async().run(); - } - else - { - Log.e("FitnessActivity", "VideoView is null. Check your layout XML."); - } }, (n) -> { int randomMessageIndex = (int) Math.floor(Math.random() * EXERCISE_NOT_FOUND_MESSAGES.length); @@ -186,6 +170,24 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { ProgressBar loadingCircle = findViewById(R.id.loadingCircle); loadingCircle.setVisibility(View.GONE); + + if ( videoView.isPlaying() ) + { + Animation animationarmraise = AnimationBuilder.with(qiContext) // Create the builder with the context. + .withResources(R.raw.armraise) // Set the animation resource. + .build(); // Build the animation. + + animate = AnimateBuilder.with(qiContext) // Create the builder with the context. + .withAnimation(animationarmraise) // Set the animation. + .build(); // Build the animate action. + + Future animateFuture = animate.async().run(); + } + else + { + Log.e("FitnessActivity", "VideoView is null. Check your layout XML."); + } + return true; } return false; From 213af5e6fbf615601f24542c5d229abd135ff734 Mon Sep 17 00:00:00 2001 From: Niels Gras Date: Wed, 5 Jun 2024 13:45:00 +0200 Subject: [PATCH 2/2] Fixed animation placement --- .../java/com/example/fitbot/ui/activities/FitnessActivity.java | 2 ++ 1 file changed, 2 insertions(+) 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 d1cb337..5b8f87f 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 @@ -55,6 +55,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall private static String exerciseVideoUrl; private Animate animate; private VideoView videoView; + private QiContext qiContext; private final Object lock = new Object(); @@ -173,6 +174,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall if ( videoView.isPlaying() ) { + QiContext qiContext = null; Animation animationarmraise = AnimationBuilder.with(qiContext) // Create the builder with the context. .withResources(R.raw.armraise) // Set the animation resource. .build(); // Build the animation.