Merge branch 'main' of https://gitlab.fdmci.hva.nl/propedeuse-hbo-ict/onderwijs/2023-2024/out-a-se-ti/blok-4/muupooviixee66
This commit is contained in:
9
code/src/Fitbot/.idea/misc.xml
generated
9
code/src/Fitbot/.idea/misc.xml
generated
@@ -16,6 +16,8 @@
|
||||
<entry key="..\:/Users/Niels/muupooviixee66-3/code/src/Fitbot/app/src/main/res/layout/activity_fitness.xml" value="0.1234375" />
|
||||
<entry key="..\:/Users/Niels/muupooviixee66-3/code/src/Fitbot/app/src/main/res/layout/activity_main.xml" value="0.1" />
|
||||
<entry key="..\:/Users/Niels/muupooviixee66-3/code/src/Fitbot/app/src/main/res/layout/header.xml" value="0.1234375" />
|
||||
<entry key="..\:/Users/sebas/.gradle/caches/transforms-3/9c4b978f8e84c8bb9ebef5f19e8c189e/transformed/qisdk-design-1.7.5/res/layout/activity_robot.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sebas/.gradle/caches/transforms-3/9c4b978f8e84c8bb9ebef5f19e8c189e/transformed/qisdk-design-1.7.5/res/layout/view_always_top_speech_bar.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.25" />
|
||||
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/drawable/darkred_button_gradient.xml" value="0.346" />
|
||||
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/drawable/ic_baseline_home_48.xml" value="0.25" />
|
||||
@@ -24,13 +26,16 @@
|
||||
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/drawable/ic_launcher_background.xml" value="0.25" />
|
||||
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/drawable/red_button_gradient.xml" value="0.346" />
|
||||
<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.176" />
|
||||
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_end_screen.xml" value="0.10499174917491749" />
|
||||
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_fitness.xml" value="0.33" />
|
||||
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_main.xml" value="0.25" />
|
||||
<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="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_power_screen.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_sport_item.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_sport_menu.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/header.xml" value="0.125" />
|
||||
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/header.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/toolbar.xml" value="0.125" />
|
||||
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/menu/main_menu.xml" value="0.33" />
|
||||
<entry key="app/src/main/res/layout/activity_end_screen.xml" value="0.1" />
|
||||
<entry key="app/src/main/res/layout/activity_fitness.xml" value="0.23550724637681159" />
|
||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.1" />
|
||||
|
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
Copyright 2008 Nedim Jackman
|
||||
|
||||
This file is part of Wiiboard Simple
|
||||
|
||||
Wiiboard Simple is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Wiiboard Simple is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with Wiiboard Simple. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.example.fitbot.bluetooth;
|
||||
|
||||
/**
|
||||
* In very basic structure, all bluetooth devices have an address that the connection
|
||||
* is associated with.
|
||||
*/
|
||||
public interface BluetoothDevice {
|
||||
|
||||
/**
|
||||
* The fixed address of the device.
|
||||
* Constant throughout the connection of the device.
|
||||
*/
|
||||
public String getBluetoothAddress();
|
||||
|
||||
}
|
@@ -1,133 +0,0 @@
|
||||
package com.example.fitbot.bluetooth;
|
||||
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothSocket;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.UUID;
|
||||
|
||||
public class BluetoothManager {
|
||||
|
||||
private BluetoothAdapter bluetoothAdapter;
|
||||
private Context context;
|
||||
|
||||
public BluetoothManager(Context context) {
|
||||
this.context = context;
|
||||
this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
}
|
||||
|
||||
public boolean isBluetoothSupported() {
|
||||
return bluetoothAdapter != null;
|
||||
}
|
||||
|
||||
public boolean isBluetoothEnabled() {
|
||||
return bluetoothAdapter.isEnabled();
|
||||
}
|
||||
|
||||
public void startDiscovery() {
|
||||
if (!isBluetoothEnabled()) {
|
||||
Log.e("BluetoothManager", "Bluetooth is not enabled");
|
||||
return;
|
||||
}
|
||||
|
||||
if (bluetoothAdapter.isDiscovering()) {
|
||||
bluetoothAdapter.cancelDiscovery();
|
||||
Log.d("BluetoothManager", "Cancelling current discovery process...");
|
||||
}
|
||||
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(BluetoothDevice.ACTION_FOUND);
|
||||
filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
|
||||
context.registerReceiver(receiver, filter);
|
||||
|
||||
bluetoothAdapter.startDiscovery();
|
||||
Log.d("BluetoothManager", "Starting discovery process...");
|
||||
}
|
||||
|
||||
public final BroadcastReceiver receiver = new BroadcastReceiver() {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
|
||||
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||
if (device.getName() != null && device.getName().contains("Nintendo RVL-WBC-01")) {
|
||||
Log.d("BluetoothManager", "Wii Balance Board found: " + device.getName() + " [" + device.getAddress() + "]");
|
||||
connectToDevice(device);
|
||||
}
|
||||
} else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
|
||||
context.unregisterReceiver(this);
|
||||
Log.d("BluetoothManager", "Discovery finished.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void connectToDevice(BluetoothDevice device) {
|
||||
new Thread(() -> {
|
||||
BluetoothSocket socket = null;
|
||||
final int MAX_RETRIES = 3;
|
||||
final long RETRY_DELAY_MS = 1000;
|
||||
boolean isConnected = false;
|
||||
|
||||
for (int attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
||||
try {
|
||||
UUID SPP_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
|
||||
socket = device.createRfcommSocketToServiceRecord(SPP_UUID);
|
||||
bluetoothAdapter.cancelDiscovery();
|
||||
|
||||
byte[] pinBytes = getPinBytes(device.getAddress());
|
||||
try {
|
||||
Method setPinMethod = device.getClass().getDeclaredMethod("setPin", byte[].class);
|
||||
setPinMethod.invoke(device, pinBytes);
|
||||
Log.d("BluetoothManager", "PIN set successfully");
|
||||
} catch (Exception e) {
|
||||
Log.e("BluetoothManager", "Failed to set PIN", e);
|
||||
}
|
||||
|
||||
socket.connect();
|
||||
Log.d("BluetoothManager", "Connected to Wii Balance Board");
|
||||
isConnected = true;
|
||||
break;
|
||||
} catch (IOException e) {
|
||||
Log.e("BluetoothManager", "Connection attempt " + attempt + " failed", e);
|
||||
if (attempt < MAX_RETRIES) {
|
||||
try {
|
||||
Thread.sleep(RETRY_DELAY_MS);
|
||||
} catch (InterruptedException ie) {
|
||||
Thread.currentThread().interrupt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (!isConnected && socket != null) {
|
||||
try {
|
||||
socket.close();
|
||||
} catch (IOException ex) {
|
||||
Log.e("BluetoothManager", "Could not close the client socket", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isConnected) {
|
||||
Log.e("BluetoothManager", "All connection attempts failed.");
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private byte[] getPinBytes(String address) {
|
||||
String[] addrParts = address.split(":");
|
||||
byte[] pin = new byte[addrParts.length];
|
||||
for (int i = 0; i < addrParts.length; i++) {
|
||||
pin[i] = (byte) Integer.parseInt(addrParts[addrParts.length - 1 - i], 16);
|
||||
}
|
||||
Log.i("BluetoothManager", "PIN: " + pin);
|
||||
return pin;
|
||||
}
|
||||
}
|
@@ -3,6 +3,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.widget.VideoView;
|
||||
|
||||
@@ -19,7 +20,7 @@ import org.joml.Vector3f;
|
||||
|
||||
public class FitnessActivity extends RobotActivity implements RobotLifecycleCallbacks {
|
||||
|
||||
// PersonalMotionPreviewElement personalMotionPreviewElement;
|
||||
// PersonalMotionPreviewElement personalMotionPreviewElement;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -28,6 +29,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
||||
// Set the content view to the appropriate layout
|
||||
setContentView(R.layout.activity_fitness);
|
||||
|
||||
|
||||
// Find the VideoView by its ID
|
||||
VideoView videoView = findViewById(R.id.videoView);
|
||||
|
||||
|
@@ -1,16 +1,10 @@
|
||||
package com.example.fitbot.ui.activities;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
@@ -20,13 +14,9 @@ import android.util.Log;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.example.fitbot.R;
|
||||
import com.example.fitbot.wiiboard.WiiBoardDiscoverer;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private static final int REQUEST_LOCATION_PERMISSION = 1;
|
||||
private WiiBoardDiscoverer wiiBoardDiscoverer;
|
||||
|
||||
//Variables
|
||||
DrawerLayout drawerLayout;
|
||||
NavigationView navigationView;
|
||||
@@ -48,50 +38,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
|
||||
// Check if the device supports Bluetooth
|
||||
if (BluetoothAdapter.getDefaultAdapter() == null) {
|
||||
Log.i("WiiBoardDiscoverer", "Device doesn't support Bluetooth. Exiting.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Request location permissions for Bluetooth discovery on Android 6.0 and above
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_LOCATION_PERMISSION);
|
||||
} else {
|
||||
// Initialize WiiBoardDiscoverer
|
||||
wiiBoardDiscoverer = new WiiBoardDiscoverer(this);
|
||||
}
|
||||
|
||||
setUpUi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == REQUEST_LOCATION_PERMISSION && grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
// Permission granted, initialize WiiBoardDiscoverer
|
||||
wiiBoardDiscoverer = new WiiBoardDiscoverer(this);
|
||||
} else {
|
||||
// Handle the case where the user denies the location permission
|
||||
Log.i("WiiBoardDiscoverer", "Location permission is required for Bluetooth discovery.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (wiiBoardDiscoverer != null) {
|
||||
wiiBoardDiscoverer.startWiiBoardSearch();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
if (wiiBoardDiscoverer != null) {
|
||||
wiiBoardDiscoverer.stopWiiBoardSearch();
|
||||
}
|
||||
setUpUi(); // Set up the UI
|
||||
}
|
||||
|
||||
private void setUpUi() {
|
||||
@@ -101,27 +48,27 @@ public class MainActivity extends AppCompatActivity {
|
||||
toolbar = findViewById(R.id.toolbar);
|
||||
startButton = findViewById(R.id.startButton);
|
||||
|
||||
startButton.setOnClickListener(v -> {
|
||||
// Switch to fitness activity
|
||||
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);
|
||||
setSupportActionBar(toolbar); // Make the toolbar act as the action bar
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(false); // Remove the title from the toolbar
|
||||
|
||||
/*---Navigation Drawer Menu---*/
|
||||
navigationView.bringToFront();
|
||||
navigationView.bringToFront(); // Make the navigation drawer menu clickable
|
||||
|
||||
ActionBarDrawerToggle toggle=new
|
||||
ActionBarDrawerToggle toggle=new // Create a toggle for the navigation drawer
|
||||
ActionBarDrawerToggle(this,drawerLayout,toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
||||
drawerLayout.addDrawerListener(toggle);
|
||||
toggle.syncState();
|
||||
toggle.syncState(); // Synchronize the state of the navigation drawer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed(){
|
||||
public void onBackPressed(){ // Close the navigation drawer when the back button is pressed
|
||||
if(drawerLayout.isDrawerOpen(GravityCompat.START)){
|
||||
drawerLayout.closeDrawer(GravityCompat.START);
|
||||
}
|
||||
|
@@ -1,48 +0,0 @@
|
||||
package com.example.fitbot.wiiboard;
|
||||
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothSocket;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class WiiBoard {
|
||||
private static final String TAG = "WiiBoard";
|
||||
|
||||
public static void connectToExtension(String address) {
|
||||
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
BluetoothDevice device = bluetoothAdapter.getRemoteDevice(address);
|
||||
BluetoothSocket socket = null;
|
||||
final int maxTries = 3;
|
||||
int currentTry = 0;
|
||||
|
||||
while (currentTry < maxTries) {
|
||||
try {
|
||||
// Use reflection to create a BluetoothSocket without UUID
|
||||
Method m = device.getClass().getMethod("createRfcommSocket", new Class[]{int.class});
|
||||
socket = (BluetoothSocket) m.invoke(device, 1);
|
||||
|
||||
bluetoothAdapter.cancelDiscovery();
|
||||
socket.connect();
|
||||
|
||||
Log.i(TAG, "Connected to WiiBoard");
|
||||
// Handle your communication here
|
||||
|
||||
return; // Exit the method upon successful connection
|
||||
} catch (Exception e) { // Catching Exception to handle reflection exceptions too
|
||||
Log.e(TAG, "Attempt " + (currentTry + 1) + " failed to connect", e);
|
||||
currentTry++;
|
||||
try {
|
||||
// Wait a bit before retrying
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException ie) {
|
||||
Log.e(TAG, "Interrupted while waiting to retry connection", ie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Log.e(TAG, "Could not connect to WiiBoard after " + maxTries + " attempts.");
|
||||
}
|
||||
}
|
@@ -1,66 +0,0 @@
|
||||
package com.example.fitbot.wiiboard;
|
||||
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.util.Log;
|
||||
|
||||
public class WiiBoardDiscoverer {
|
||||
private BluetoothAdapter bluetoothAdapter;
|
||||
private Context context;
|
||||
private String discoveredAddress;
|
||||
private boolean isSearching;
|
||||
|
||||
private final BroadcastReceiver receiver = new BroadcastReceiver() {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
|
||||
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||
String name = device.getName();
|
||||
if ("Nintendo RVL-WBC-01".equals(name)) {
|
||||
discoveredAddress = device.getAddress();
|
||||
Log.i("WiiBoardDiscoverer", "Discovered " + name + " " + discoveredAddress + ".");
|
||||
isSearching = false;
|
||||
bluetoothAdapter.cancelDiscovery();
|
||||
context.unregisterReceiver(this); // Important to unregister
|
||||
WiiBoard.connectToExtension(discoveredAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public WiiBoardDiscoverer(Context context) {
|
||||
this.context = context;
|
||||
this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
if (bluetoothAdapter == null) {
|
||||
Log.i("WiiBoardDiscoverer", "Device doesn't support Bluetooth. Exiting.");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
public void startWiiBoardSearch() {
|
||||
if (!isSearching && !bluetoothAdapter.isDiscovering()) {
|
||||
isSearching = true;
|
||||
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
|
||||
context.registerReceiver(receiver, filter);
|
||||
bluetoothAdapter.startDiscovery();
|
||||
Log.i("WiiBoardDiscoverer", "WiiBoard Discovery Started");
|
||||
}
|
||||
}
|
||||
|
||||
public void stopWiiBoardSearch() {
|
||||
if (bluetoothAdapter.isDiscovering()) {
|
||||
bluetoothAdapter.cancelDiscovery();
|
||||
}
|
||||
isSearching = false;
|
||||
try {
|
||||
context.unregisterReceiver(receiver);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// This can happen if the receiver was not registered or already unregistered
|
||||
Log.i("WiiBoardDiscoverer", "Receiver was not registered or already unregistered");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
package com.example.fitbot.wiiboard;
|
||||
|
||||
/**
|
||||
* Implement this interface to be notified of WiiBoards that are connected to. Register your
|
||||
* listener with an instance of WiiBoardDiscoverer.
|
||||
*/
|
||||
public interface WiiBoardDiscoveryListener {
|
||||
|
||||
/**
|
||||
* Is called by a WiiBoardDiscoverer when a WiiBoard has been found and successfully connected to.
|
||||
*/
|
||||
public void wiiBoardDiscovered(WiiBoard wiiboard);
|
||||
}
|
@@ -5,8 +5,9 @@ xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/red"
|
||||
android:background="@color/black"
|
||||
android:fitsSystemWindows="true"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
tools:context=".ui.activities.FitnessActivity"
|
||||
tools:openDrawer="start">
|
||||
|
||||
@@ -23,51 +24,71 @@ tools:openDrawer="start">
|
||||
|
||||
<VideoView
|
||||
android:id="@+id/videoView"
|
||||
android:layout_width="600dp"
|
||||
android:layout_height="550dp"
|
||||
android:layout_width="450dp"
|
||||
android:layout_height="450dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.023"
|
||||
app:layout_constraintHorizontal_bias="0.04"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.064" />
|
||||
app:layout_constraintVertical_bias="0.2" />
|
||||
|
||||
<VideoView
|
||||
android:id="@+id/videoView2"
|
||||
android:layout_width="450dp"
|
||||
android:layout_height="450dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.96"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/homeButton"
|
||||
style="@style/ButtonStyle"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="120dp"
|
||||
android:text="HOME"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="75dp"
|
||||
android:background="@drawable/red_button_gradient"
|
||||
android:text="@string/home"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.014"
|
||||
app:layout_constraintHorizontal_bias="0.02"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.976" />
|
||||
app:layout_constraintVertical_bias="0.968" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/skipButton"
|
||||
style="@style/ButtonStyle"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="120dp"
|
||||
android:text="SKIP"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="75dp"
|
||||
android:background="@drawable/red_button_gradient"
|
||||
android:text="@string/skip"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.976" />
|
||||
app:layout_constraintVertical_bias="0.968" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonComplete"
|
||||
style="@style/ButtonStyle"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="120dp"
|
||||
android:text="Complete"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="75dp"
|
||||
android:background="@drawable/red_button_gradient"
|
||||
android:text="@string/complete"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.985"
|
||||
app:layout_constraintHorizontal_bias="0.979"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.976" />
|
||||
app:layout_constraintVertical_bias="0.968" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
@@ -6,6 +6,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="#232323"
|
||||
android:fitsSystemWindows="true"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
tools:context=".ui.activities.MainActivity"
|
||||
tools:openDrawer="start">
|
||||
|
||||
@@ -19,24 +20,30 @@
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="300dp"
|
||||
android:layout_marginStart="232dp"
|
||||
android:layout_marginTop="120dp"
|
||||
android:text="@string/welkom_bij_fitbot"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="64sp"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="300dp"
|
||||
android:layout_marginTop="80dp"
|
||||
android:layout_marginStart="240dp"
|
||||
android:layout_marginTop="200dp"
|
||||
android:text="@string/robot_helpt"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="32sp"
|
||||
@@ -45,10 +52,10 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/startButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="400dp"
|
||||
android:layout_marginTop="350dp"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginStart="380dp"
|
||||
android:layout_marginTop="280dp"
|
||||
android:background="@drawable/red_button_gradient"
|
||||
android:text="@string/start"
|
||||
android:textAllCaps="false"
|
||||
@@ -59,10 +66,10 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/helpButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="450dp"
|
||||
android:layout_marginTop="500dp"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="428dp"
|
||||
android:layout_marginTop="400dp"
|
||||
android:background="@drawable/darkred_button_gradient"
|
||||
android:text="@string/help"
|
||||
android:textAllCaps="false"
|
||||
@@ -73,23 +80,14 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="260dp"
|
||||
android:contentDescription="@string/todo"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_marginTop="340dp"
|
||||
android:contentDescription="@string/robot_logo"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/robot_logo_inverted" />
|
||||
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/menu_switch_btn"-->
|
||||
<!-- android:layout_width="200dp"-->
|
||||
<!-- android:layout_height="50dp"-->
|
||||
<!-- android:clickable="true"-->
|
||||
<!-- android:text="Go to Sport Menu"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
|
||||
<!-- android:focusable="true" />-->
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
|
@@ -1,10 +1,9 @@
|
||||
<?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="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:orientation="vertical"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/ic_launcher_background"
|
||||
android:layout_gravity="top"
|
||||
android:padding="10dp">
|
||||
@@ -25,6 +24,7 @@
|
||||
android:layout_marginTop="60dp"
|
||||
android:text="FitBot"
|
||||
android:textSize="48sp"
|
||||
android:textColor="@color/black"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
@@ -3,7 +3,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00000000"
|
||||
android:elevation="8dp"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
|
||||
android:elevation="8dp">
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
@@ -9,6 +9,10 @@
|
||||
<string name="start">Start</string>
|
||||
<string name="help">Help</string>
|
||||
<string name="todo">TODO</string>
|
||||
<string name="robot_logo" />
|
||||
<string name="home">Home</string>
|
||||
<string name="skip">Skip</string>
|
||||
<string name="complete">Complete</string>
|
||||
<color name="red">#f22b1d</color>
|
||||
|
||||
</resources>
|
Reference in New Issue
Block a user