added library and videoview
This commit is contained in:
@@ -2,10 +2,13 @@ package com.example.fitbot.sports;
|
||||
|
||||
import static com.example.fitbot.sports.Animations.PlayAnimation;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import android.util.Log;
|
||||
import android.widget.VideoView;
|
||||
import com.example.fitbot.R;
|
||||
import com.aldebaran.qi.sdk.QiContext;
|
||||
import com.aldebaran.qi.sdk.builder.AnimateBuilder;
|
||||
import com.aldebaran.qi.sdk.builder.AnimationBuilder;
|
||||
@@ -14,10 +17,9 @@ import com.aldebaran.qi.sdk.object.actuation.Animation;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
|
||||
public class FitnessCycle extends AppCompatActivity {
|
||||
|
||||
public static void FitnessManager(String Exercise, int Reps, QiContext qiContext, String videoView){
|
||||
public static void RobotMovement(String Exercise, int Reps, QiContext qiContext) {
|
||||
AtomicInteger repCount = new AtomicInteger(0);
|
||||
|
||||
Animation animation = AnimationBuilder.with(qiContext)
|
||||
@@ -40,11 +42,19 @@ public class FitnessCycle extends AppCompatActivity {
|
||||
for (int i = 0; i < Reps; i++) {
|
||||
animate.run();
|
||||
}
|
||||
}
|
||||
|
||||
public static void playVideo(VideoView videoView, Context context) {
|
||||
// Set up the video player
|
||||
if (videoView != null) {
|
||||
Uri videoUri = Uri.parse("android.resource://" + qiContext.getPackageName() + "/" + R.raw.bicepvideo);
|
||||
Uri videoUri = Uri.parse("android.resource://" + context.getPackageName() + "/" + R.raw.bicepvideo);
|
||||
videoView.setVideoURI(videoUri);
|
||||
|
||||
videoView.setOnCompletionListener(mp -> {
|
||||
// Repeat the video when it finishes playing
|
||||
videoView.start();
|
||||
});
|
||||
|
||||
videoView.start();
|
||||
} else {
|
||||
Log.e("FitnessActivity", "VideoView is null. Check your layout XML.");
|
||||
|
Reference in New Issue
Block a user