Merge branch 'main' of ssh://gitlab.fdmci.hva.nl/propedeuse-hbo-ict/onderwijs/2023-2024/out-a-se-ti/blok-4/muupooviixee66 into 55-als-gebruiker-wil-ik-oefeningen-te-zien-krijgen-met-een-instructie-video-zodat-ik-weet-wat-ik

This commit is contained in:
Niels Gras
2024-05-17 15:12:33 +02:00
7 changed files with 56 additions and 6 deletions

9
.gitignore vendored
View File

@@ -1 +1,8 @@
.DS_Store
.DS_Store
/.idea/.gitignore
/.idea/dictionaries/lucawarm.xml
/.idea/material_theme_project_new.xml
/docs/documentation/assets/math-expression-location-calculation.png
/.idea/modules.xml
/.idea/muupooviixee66.iml
/.idea/vcs.xml

View File

@@ -13,3 +13,5 @@
.externalNativeBuild
.cxx
local.properties
.idea
.vscode

View File

@@ -15,13 +15,15 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Fitbot" >
<!--android:name=".ui.activities.MainActivity"-->
<activity
android:name=".EndScreenActivity"
android:exported="false" />
<activity
android:name=".MainActivity"
android:name=".ui.activities.FitnessActivity"
android:exported="true" />
<activity
android:name=".ui.activities.MainActivity"
android:exported="true" >
<intent-filter>

View File

@@ -1,6 +1,7 @@
package com.example.fitbot.ui.activities;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
@@ -8,6 +9,8 @@ import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.widget.Button;
import com.example.fitbot.R;
@@ -17,17 +20,26 @@ public class MainActivity extends AppCompatActivity {
DrawerLayout drawerLayout;
NavigationView navigationView;
Toolbar toolbar;
Button startButton;
@SuppressLint("WrongViewCast")
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setContentView(R.layout.activity_main );
/*---Hooks---*/
drawerLayout = findViewById(R.id.drawer_layout);
navigationView = findViewById(R.id.nav_view);
toolbar = findViewById(R.id.toolbar);
startButton = findViewById(R.id.startButton);
startButton.setOnClickListener(v -> {
// Switch to fitness activity
Log.i("MainActivity", "Switching to FitnessActivity");
Intent intent = new Intent(MainActivity.this, FitnessActivity.class);
startActivity(intent);
});
/*---Tool Bar---*/
// setSupportActionBar(toolbar);

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.Log;
import android.view.View;
import com.example.fitbot.util.path.GesturePath;
@@ -24,6 +25,8 @@ public class PersonalMotionPreviewElement extends View {
private Path referencePath, performingPath;
private Paint referencePaint, performingPaint;
private Paint backgroundColor = new Paint();
/**
* Constants for the preview path projection.
*/
@@ -42,6 +45,9 @@ public class PersonalMotionPreviewElement extends View {
*/
public PersonalMotionPreviewElement(Context context, GesturePath path) {
super(context);
Log.i("PersonalMotionPreviewElement", "Creating new PersonalMotionPreviewElement.");
this.backgroundColor = new Paint();
this.backgroundColor.setColor(0xFF000000); // Black
this.path = path;
this.motionProcessor = new MotionProcessor();
this.motionProcessor.startListening();
@@ -158,6 +164,7 @@ public class PersonalMotionPreviewElement extends View {
@Override
public void onDraw(Canvas canvas) {
canvas.drawRect(0, 0, getWidth(), getHeight(), backgroundColor);
// Draw the sport preview canvas
canvas.drawPath(referencePath, referencePaint);
canvas.drawPath(performingPath, performingPaint);

View File

@@ -3,8 +3,21 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/red"
xmlns:tools="http://schemas.android.com/tools"
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#232323"
android:fitsSystemWindows="true"
tools:context=".ui.activities.FitnessActivity"
tools:openDrawer="start">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<com.example.fitbot.ui.components.PersonalMotionPreviewElement
android:id="@+id/personalMotionPreviewElement"
@@ -45,5 +58,10 @@
android:text="Complete"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.constraint.ConstraintLayout>
</LinearLayout>
</android.support.v4.widget.DrawerLayout>

View File

@@ -1,9 +1,12 @@
package com.example.fitbot;
import static org.junit.Assert.assertEquals;
import com.example.fitbot.util.path.GesturePath;
import com.example.fitbot.util.path.PathSegment;
import org.joml.Vector3f;
import org.junit.Test;
public class PathSegmentTest {
@@ -23,7 +26,6 @@ public class PathSegmentTest {
@Test
@DisplayName("Test Path Segment Interpolation")
public void test_pathSegmentInterpolation() {
Vector3f start = new Vector3f(0, 0, 0);
Vector3f end = new Vector3f(1, 1, 1);