Added class and intergrated it into code
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
package com.example.fitbot.ui.activities;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.MediaController;
|
||||
import android.os.Handler;
|
||||
import android.widget.VideoView;
|
||||
|
||||
import com.aldebaran.qi.sdk.QiContext;
|
||||
@@ -12,8 +9,7 @@ import com.aldebaran.qi.sdk.QiSDK;
|
||||
import com.aldebaran.qi.sdk.RobotLifecycleCallbacks;
|
||||
import com.aldebaran.qi.sdk.design.activity.RobotActivity;
|
||||
import com.example.fitbot.R;
|
||||
import com.example.fitbot.sports.Animations;
|
||||
import com.example.fitbot.ui.components.PersonalMotionPreviewElement;
|
||||
import com.example.fitbot.sports.FitnessCycle;
|
||||
import com.example.fitbot.util.path.GesturePath;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
@@ -25,21 +21,12 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Set the content view to the appropriate layout
|
||||
QiSDK.register(this, this);
|
||||
setContentView(R.layout.activity_fitness);
|
||||
|
||||
|
||||
// Find the VideoView by its ID
|
||||
VideoView videoView = findViewById(R.id.videoView);
|
||||
|
||||
if (videoView != null) {
|
||||
Uri videoUri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.bicepvideo);
|
||||
videoView.setVideoURI(videoUri);
|
||||
videoView.start();
|
||||
} else {
|
||||
Log.e("FitnessActivity", "VideoView is null. Check your layout XML.");
|
||||
}
|
||||
FitnessCycle.playVideo(videoView, this);
|
||||
|
||||
com.example.fitbot.util.ButtonNavigation.setupButtonNavigation(this, R.id.homeButton, MainActivity.class);
|
||||
com.example.fitbot.util.ButtonNavigation.setupButtonNavigation(this, R.id.buttonComplete, EndScreenActivity.class);
|
||||
@@ -71,8 +58,12 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
||||
|
||||
@Override
|
||||
public void onRobotFocusGained(QiContext qiContext) {
|
||||
// Implement your logic when the robot focus is gained
|
||||
Animations.Animate("bicepcurl", qiContext);
|
||||
|
||||
// Find the VideoView by its ID
|
||||
FitnessCycle.RobotMovement("bicepcurl", 10, qiContext);
|
||||
|
||||
// FitnessCycle.playVideo(qiContext, videoView, this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,9 +76,14 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
||||
// Implement your logic when the robot focus is refused
|
||||
}
|
||||
|
||||
private Handler handler;
|
||||
private Runnable runnable;
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
QiSDK.unregister(this, this);
|
||||
super.onDestroy();
|
||||
if (handler != null && runnable != null) {
|
||||
handler.removeCallbacks(runnable);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user