Added test UI for selecting sport items

This commit is contained in:
Luca Warmenhoven
2024-04-24 15:59:24 +02:00
13 changed files with 204 additions and 42 deletions

75
.idea/workspace.xml generated
View File

@@ -14,7 +14,11 @@
</configurations>
</component>
<component name="ChangeListManager">
<list default="true" id="00599d5b-7eb5-44da-ad7f-98bf42384c16" name="Changes" comment="Final update onderzoek-formulier.md" />
<list default="true" id="00599d5b-7eb5-44da-ad7f-98bf42384c16" name="Changes" comment="Final update onderzoek-formulier.md">
<change afterPath="$PROJECT_DIR$/docs/personalDocs/Luca/weekly-reports/sprint-1-week-1.md" afterDir="false" />
<change afterPath="$PROJECT_DIR$/docs/personalDocs/Luca/weekly-reports/sprint-1-week-2.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/code/src/Fitbot/app/src/main/java/com/example/fitbot/MainActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/code/src/Fitbot/app/src/main/java/com/example/fitbot/MainActivity.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -23,7 +27,7 @@
<component name="ClangdSettings">
<option name="formatViaClangd" value="false" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[/Users/lucawarm/.android/avd/Pixel_3a_API_34_extension_level_7_arm64-v8a.avd]" />
<component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[]" />
<component name="ExternalProjectsData">
<projectState path="$PROJECT_DIR$">
<ProjectState />
@@ -63,6 +67,13 @@
<filtered-out-file-type name="COMMIT_BY_MESSAGE" />
</file-type-list>
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectColorInfo"><![CDATA[{
"customColor": "",
"associatedIndex": 7
}]]></component>
<component name="ProjectId" id="2fE3N2CwEPDo9wBtexBLxU20tCJ" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
@@ -71,11 +82,19 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.cidr.known.project.marker" value="true" />
<property name="cidr.known.project.marker" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"git-widget-placeholder": "Merging main",
"kotlin-language-version-configured": "true",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"vue.rearranger.settings.migration": "true"
}
}]]></component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/code/src/app/src/main/java/com/fitbot" />
@@ -90,40 +109,19 @@
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ALL_USERS" value="false" />
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
<option name="CLEAR_APP_STORAGE" value="false" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="INSPECTION_WITHOUT_ACTIVITY_RESTART" value="false" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Auto" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Hybrid>
<Java />
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Native>
<option name="DEBUGGER_TYPE" value="Java" />
<Java>
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Java>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
<option name="STARTUP_PROFILING_ENABLED" value="false" />
@@ -139,13 +137,6 @@
<method v="2" />
</configuration>
</component>
<component name="SharedIndexes">
<attachedChunks>
<set>
<option value="bundled-js-predefined-1d06a55b98c1-2e7d6887c066-JavaScript-WS-241.15989.47" />
</set>
</attachedChunks>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
@@ -158,6 +149,7 @@
<workItem from="1713352446871" duration="1766000" />
<workItem from="1713814327036" duration="4920000" />
<workItem from="1713863377053" duration="634000" />
<workItem from="1713960463274" duration="353000" />
</task>
<task id="LOCAL-00001" summary="Changes">
<created>1713528225837</created>
@@ -227,7 +219,6 @@
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Changes" />

View File

@@ -3,12 +3,17 @@
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="../../../../../../../../layout/custom_preview.xml" value="0.35989583333333336" />
<entry key="..\:/Users/31687/muupooviixee66-1/code/src/Fitbot/app/src/main/res/layout/activity_bicepvideo.xml" value="0.2015625" />
<entry key="..\:/Users/31687/muupooviixee66-1/code/src/Fitbot/app/src/main/res/layout/activity_main.xml" value="0.2015625" />
<entry key="..\:/Users/31687/muupooviixee66-1/code/src/Fitbot/app/src/main/res/layout/activity_main_screen.xml" value="0.358695652173913" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_bicepvideo.xml" value="0.22826086956521738" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_main.xml" value="0.1" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_main_screen.xml" value="0.1" />
<entry key="app/src/main/res/layout/activity_main.xml" value="0.2341485507246377" />
<entry key="app/src/main/res/layout/activity_sport_item.xml" value="0.2341485507246377" />
<entry key="app/src/main/res/layout/activity_sport_menu.xml" value="0.22056159420289856" />
<entry key="app/src/main/res/layout/sport_menu_item.xml" value="0.22056159420289856" />
</map>
</option>
</component>

View File

@@ -32,6 +32,7 @@ dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
implementation 'com.android.support:cardview-v7:28.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

View File

@@ -11,6 +11,15 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Fitbot">
<activity
android:name=".ui.SportMenuActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".bicepvideo"
android:exported="false" />

View File

@@ -0,0 +1,18 @@
package com.example.fitbot.sports;
public enum ESportType {
FITNESS("Fitness"),
POWER("Krachttrening");
private final String name;
ESportType(String name) {
this.name = name;
}
public String getName() {
return name;
}
}

View File

@@ -0,0 +1,21 @@
package com.example.fitbot.ui;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.example.fitbot.R;
public class SportItemActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sport_item);
}
@Override
protected void onDestroy() {
super.onDestroy();
}
}

View File

@@ -0,0 +1,22 @@
package com.example.fitbot.ui;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.example.fitbot.R;
public class SportMenuActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sport_menu);
}
@Override
protected void onDestroy() {
super.onDestroy();
}
}

View File

@@ -0,0 +1,45 @@
package com.example.fitbot.ui;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.View;
import com.example.fitbot.sports.ESportType;
public class SportMenuItem extends View {
private Paint backgroundPaint, textPaint;
private String title, description;
private Bitmap imageResource;
private Rect imageRect, elementRect;
private ESportType type;
public SportMenuItem(Context context, ESportType type, String title, String description, Bitmap backgroundImage) {
super(context);
this.title = title;
this.description = description;
this.imageResource = backgroundImage;
this.imageRect = new Rect(0, 0, this.imageResource.getWidth(), this.imageResource.getHeight());
this.elementRect = new Rect(0, 0, this.getWidth(), this.getHeight());
this.type = type;
this.backgroundPaint = new Paint();
this.textPaint = new Paint();
this.textPaint.setTextAlign(Paint.Align.CENTER);
this.backgroundPaint.setColor(0xFFF0F0F0);
this.textPaint.setColor(0xFF000000);
this.setOnClickListener(v -> context.startActivity(new Intent(context, SportItemActivity.class)));
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawBitmap(this.imageResource, this.imageRect, this.elementRect, null);
canvas.drawRoundRect(0, 0, getWidth(), getHeight(), 10, 10, backgroundPaint);
canvas.drawText(title, getWidth() / 2.0f, this.textPaint.getFontMetrics().top, textPaint);
}
}

View File

@@ -15,4 +15,13 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/menu_switch_btn"
android:layout_width="200dp"
android:layout_height="50dp"
android:text="Go to Sport Menu"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
/>
</android.support.constraint.ConstraintLayout>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.constraint.ConstraintLayout>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:context=".ui.SportMenuActivity">
<com.example.fitbot.ui.SportMenuItem
android:id="@+id/sportMenuItem1"
android:layout_width="300dp"
android:layout_height="300dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>

View File

@@ -0,0 +1,12 @@
## Summary week 1, sprint 1
---
As a team, we mostly worked together on figuring out what project we'd
like to work on. We did this on the first day (Tuesday) and we decided to
make a robot that promotes sports activities for the elderly.
On Wednesday we started making graphs for the project, to visualize all the
required components and how they would interact with each other.
The rest of the time we were mostly working on figuring out how to work
with Android Studio and QiSDK, which was quite a hassle.

View File

@@ -0,0 +1,7 @@
## Summary week 2, sprint 1
---
In the second week, most of us figured out how to work with the IDE
and got the SDK's to work. We've made the robot say things, and we're
currently working on adding a UI part to the robot.