added comments and optimized code
This commit is contained in:
@@ -39,11 +39,10 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
private TextView exerciseNameTextView;
|
private TextView exerciseNameTextView;
|
||||||
private TextView exerciseShortDescriptionTextView;
|
private TextView exerciseShortDescriptionTextView;
|
||||||
private TextView exerciseDescriptionTextView;
|
private TextView exerciseDescriptionTextView;
|
||||||
|
private static String exerciseVideoUrl;
|
||||||
|
|
||||||
private final Object lock = new Object();
|
private final Object lock = new Object();
|
||||||
|
|
||||||
private static String exerciseVideoUrl;
|
|
||||||
|
|
||||||
// Some nice little messages for the user
|
// Some nice little messages for the user
|
||||||
private static final String[] EXERCISE_NOT_FOUND_MESSAGES = new String[]{
|
private static final String[] EXERCISE_NOT_FOUND_MESSAGES = new String[]{
|
||||||
"Ik heb momenteel helaas wat moeite met het ophalen van oefeningen, sorry.",
|
"Ik heb momenteel helaas wat moeite met het ophalen van oefeningen, sorry.",
|
||||||
@@ -68,16 +67,14 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
this.exerciseNameTextView = findViewById(R.id.textViewFitnessTitle);
|
this.exerciseNameTextView = findViewById(R.id.textViewFitnessTitle);
|
||||||
//this.exerciseDescriptionTextView = findViewById(R.id.textViewDialogDescription);
|
//this.exerciseDescriptionTextView = findViewById(R.id.textViewDialogDescription);
|
||||||
this.exerciseShortDescriptionTextView = findViewById(R.id.textViewFitnessShortDescription);
|
this.exerciseShortDescriptionTextView = findViewById(R.id.textViewFitnessShortDescription);
|
||||||
// Remove the ugly ass bar on top of the view
|
|
||||||
setSpeechBarDisplayStrategy(SpeechBarDisplayStrategy.IMMERSIVE);
|
|
||||||
|
|
||||||
// Find the VideoView by its ID
|
|
||||||
|
|
||||||
|
// Navigation Buttons
|
||||||
NavigationManager.setupButtonNavigation(this, R.id.homeButtonFitness, MainActivity.class);
|
NavigationManager.setupButtonNavigation(this, R.id.homeButtonFitness, MainActivity.class);
|
||||||
NavigationManager.setupButtonNavigation(this, R.id.skipButtonFitness, MainActivity.class); //Needs to skip exercises once those are implemented
|
NavigationManager.setupButtonNavigation(this, R.id.skipButtonFitness, MainActivity.class); //Needs to skip exercises once those are implemented
|
||||||
|
|
||||||
// Hide system UI
|
// Hide system UI
|
||||||
NavigationManager.hideSystemUI(this);
|
NavigationManager.hideSystemUI(this);
|
||||||
|
setSpeechBarDisplayStrategy(SpeechBarDisplayStrategy.IMMERSIVE);
|
||||||
|
|
||||||
// Initiate info button
|
// Initiate info button
|
||||||
Button infoButtonFitness = findViewById(R.id.infoButtonFitness);
|
Button infoButtonFitness = findViewById(R.id.infoButtonFitness);
|
||||||
@@ -85,7 +82,6 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
showInfoDialog();
|
showInfoDialog();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -121,8 +117,9 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
NavigationManager.navigateToActivity(this, EndScreenActivity.class);
|
NavigationManager.navigateToActivity(this, EndScreenActivity.class);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
VideoView videoView = findViewById(R.id.videoView);
|
||||||
// FitnessCycle.playVideo(qiContext, videoView, this);
|
Log.e("exerciseVideoUrl", "videoUrl:" + exerciseVideoUrl);
|
||||||
|
playVideo(videoView, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -142,20 +139,13 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
this.runOnUiThread(() -> {
|
this.runOnUiThread(() -> {
|
||||||
exerciseNameTextView.setText(exercise.name);
|
exerciseNameTextView.setText(exercise.name);
|
||||||
exerciseShortDescriptionTextView.setText(exercise.shortDescription);
|
exerciseShortDescriptionTextView.setText(exercise.shortDescription);
|
||||||
exerciseNameTextView.setText(exercise.name);
|
|
||||||
exerciseShortDescriptionTextView.setText(exercise.shortDescription);
|
|
||||||
// exerciseDescriptionTextView.setText(exercise.description);
|
|
||||||
exerciseVideoUrl = exercise.videoUrl;
|
|
||||||
// exerciseDescriptionTextView.setText(exercise.description);
|
// exerciseDescriptionTextView.setText(exercise.description);
|
||||||
VideoView videoView = findViewById(R.id.videoView);
|
exerciseVideoUrl = exercise.videoUrl;
|
||||||
Log.e("exerciseVideoUrl", "videourl:" + exerciseVideoUrl);
|
|
||||||
playVideo(videoView, this);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})).start();
|
})).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function for playing a video in a VideoView
|
* Function for playing a video in a VideoView
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user