added arm raise movement
This commit is contained in:
@@ -16,15 +16,18 @@ import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.VideoView;
|
||||
|
||||
import com.aldebaran.qi.Future;
|
||||
import com.aldebaran.qi.sdk.QiContext;
|
||||
import com.aldebaran.qi.sdk.QiSDK;
|
||||
import com.aldebaran.qi.sdk.RobotLifecycleCallbacks;
|
||||
import com.aldebaran.qi.sdk.builder.AnimateBuilder;
|
||||
import com.aldebaran.qi.sdk.builder.AnimationBuilder;
|
||||
import com.aldebaran.qi.sdk.design.activity.RobotActivity;
|
||||
import com.aldebaran.qi.sdk.design.activity.conversationstatus.SpeechBarDisplayStrategy;
|
||||
import com.aldebaran.qi.sdk.object.actuation.Animate;
|
||||
import com.aldebaran.qi.sdk.object.actuation.Animation;
|
||||
import com.example.fitbot.R;
|
||||
import com.example.fitbot.exercise.Exercise;
|
||||
import com.example.fitbot.exercise.ExerciseManager;
|
||||
@@ -50,6 +53,8 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
||||
private TextView exerciseShortDescriptionTextView;
|
||||
//private TextView exerciseDescriptionTextView;
|
||||
private static String exerciseVideoUrl;
|
||||
private Animate animate;
|
||||
private VideoView videoView;
|
||||
|
||||
private final Object lock = new Object();
|
||||
|
||||
@@ -73,6 +78,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
||||
super.onCreate(savedInstanceState);
|
||||
QiSDK.register(this, this);
|
||||
setContentView(R.layout.activity_fitness);
|
||||
videoView = findViewById(R.id.videoView);
|
||||
|
||||
// Fill empty objects with exercise data
|
||||
this.exerciseNameTextView = findViewById(R.id.textViewFitnessTitle);
|
||||
@@ -127,6 +133,23 @@ 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<Void> 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);
|
||||
Pepper.say(EXERCISE_NOT_FOUND_MESSAGES[randomMessageIndex]);
|
||||
@@ -146,17 +169,16 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
||||
new Thread(() -> {
|
||||
Exercise exercise = ExerciseManager.fetchExerciseFromDatabase();
|
||||
if (exercise == null) {
|
||||
onFailedFetch.handle(null);
|
||||
runOnUiThread(() -> onFailedFetch.handle(null));
|
||||
} else {
|
||||
onSuccessfulFetch.handle(exercise);
|
||||
this.runOnUiThread(() -> {
|
||||
runOnUiThread(() -> {
|
||||
onSuccessfulFetch.handle(exercise);
|
||||
exerciseNameTextView.setText(exercise.name);
|
||||
exerciseShortDescriptionTextView.setText(exercise.shortDescription);
|
||||
// exerciseDescriptionTextView.setText(exercise.description);
|
||||
exerciseVideoUrl = exercise.videoUrl;
|
||||
|
||||
// Play the video
|
||||
VideoView videoView = findViewById(R.id.videoView);
|
||||
playVideo(videoView, this);
|
||||
|
||||
// When the video has started playing remove the loading circle
|
||||
@@ -275,5 +297,4 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
||||
});
|
||||
animator.start();
|
||||
}
|
||||
|
||||
}
|
@@ -136,11 +136,6 @@
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<com.example.fitbot.ui.components.ExerciseStatusElement
|
||||
android:id="@+id/personalMotionPreviewElement"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
|
Reference in New Issue
Block a user