Compare commits

..
11 Commits
25 changed files with 1139 additions and 400 deletions

No files matched your search

+18 -7
View File
@@ -2,13 +2,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.greenwatch">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
@@ -16,6 +9,24 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.GreenWatch">
<activity
android:name=".ConnectionActivity"
android:exported="false" />
<activity
android:name=".VideodetectionAndAccelerometerActivity"
android:exported="false" />
<activity
android:name=".AudiodetectionAndAccelerometerActivity"
android:exported="false" />
<activity
android:name=".VideodetectionActivity"
android:exported="false" />
<activity
android:name=".AudiodetectionActivity"
android:exported="false" />
<activity
android:name=".AccelerometerActivity"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="true">
@@ -0,0 +1,137 @@
package com.example.greenwatch;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.example.greenwatch.models.Device;
import com.example.greenwatch.viewmodels.AccelerometerViewModel;
import java.util.List;
public class AccelerometerActivity extends AppCompatActivity implements SensorEventListener {
private SensorManager accelerometerManager;
private Sensor accelerometerSensor;
private TextView accelerometerStatusMessage;
private TextView accelerometerDataTV;
private TextView accelerometerWarningTV;
private Button backToMainActivityButton;
private AccelerometerViewModel mAccelerometerViewModel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_accelerometer);
accelerometerStatusMessage = (TextView) findViewById(R.id.tvAccelerometerStatusmessage);
accelerometerDataTV = (TextView) findViewById(R.id.tvAccelerometerData);
accelerometerWarningTV = (TextView) findViewById(R.id.tvAccelerometerWarning);
backToMainActivityButton = (Button) findViewById(R.id.accelerometerBackToMainActivity);
backToMainActivityButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
mAccelerometerViewModel = new ViewModelProvider(this).get(AccelerometerViewModel.class);
mAccelerometerViewModel.init();
mAccelerometerViewModel.getConnectedDeviceList().observe(this, new Observer<List<Device>>() {
@Override
public void onChanged(List<Device> devices) {
StringBuilder sb = new StringBuilder();
sb.append("Time Stamp: ");
sb.append(mAccelerometerViewModel.getTimeStamp(mAccelerometerViewModel.getLocalDeviceUUID()));
sb.append(";\n");
sb.append("DeviceID: ");
sb.append(mAccelerometerViewModel.getDeviceID(mAccelerometerViewModel.getLocalDeviceUUID()));
sb.append(";\n");
sb.append("Sensor Status: ");
sb.append(mAccelerometerViewModel.getSensorStatus(mAccelerometerViewModel.getLocalDeviceUUID()));
sb.append(";\n");
sb.append("Sensor Type: ");
sb.append(mAccelerometerViewModel.getSensorType(mAccelerometerViewModel.getLocalDeviceUUID()));
sb.append(";\n");
sb.append("Sensor Massage: ");
sb.append(mAccelerometerViewModel.getSensorMassage(mAccelerometerViewModel.getLocalDeviceUUID()));
accelerometerStatusMessage.setText(sb);
Toast.makeText(AccelerometerActivity.this, "onChanged", Toast.LENGTH_LONG).show();
}
});
mAccelerometerViewModel.getMovementDetectedValue().observe(this, new Observer<Boolean>() {
@Override
public void onChanged(Boolean aBoolean) {
if (aBoolean) {
mAccelerometerViewModel.setDevice(mAccelerometerViewModel.getLocalDeviceUUID(), mAccelerometerViewModel.getSystemTimeStamp(), mAccelerometerViewModel.getLocalDeviceUUID(), true, "Accelerometer", 10);
}
else {
mAccelerometerViewModel.setDevice(mAccelerometerViewModel.getLocalDeviceUUID(), mAccelerometerViewModel.getSystemTimeStamp(), mAccelerometerViewModel.getLocalDeviceUUID(), false, "Accelerometer", 0);
}
}
});
accelerometerManager = (SensorManager) getSystemService(SENSOR_SERVICE);
if (accelerometerManager.getSensorList(Sensor.TYPE_GYROSCOPE).size() == 0) {
accelerometerSensor = null;
Toast.makeText(AccelerometerActivity.this, "No accelerometer sensor available", Toast.LENGTH_LONG).show();
}
else {
accelerometerSensor = accelerometerManager.getSensorList(Sensor.TYPE_GYROSCOPE).get(0);
}
}
@Override
public void onSensorChanged(SensorEvent event) {
StringBuilder sb = new StringBuilder();
sb.append("x=")
.append(event.values[0])
.append("\ny=")
.append(event.values[1])
.append("\nz=")
.append(event.values[2]);
accelerometerDataTV.setText(sb.toString());
mAccelerometerViewModel.addValueToGesamtBE(event.values[0] + event.values[1] + event.values[2]);
mAccelerometerViewModel.meanValueCalculation();
mAccelerometerViewModel.calibrateAccelerometerSensor();
mAccelerometerViewModel.checkAlarmCondition();
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
@Override
protected void onResume() {
super.onResume();
if (accelerometerSensor != null) {
if (accelerometerManager.registerListener(this, accelerometerSensor, SensorManager.SENSOR_DELAY_GAME)) {
Toast.makeText(AccelerometerActivity.this, "We registered to the sensor", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(AccelerometerActivity.this, "Registration did not work", Toast.LENGTH_LONG).show();
}
}
}
@Override
protected void onPause() {
super.onPause();
if (accelerometerSensor != null) {
accelerometerManager.unregisterListener(this, accelerometerSensor);
}
}
}
@@ -1,225 +0,0 @@
package com.example.greenwatch;
import android.graphics.SurfaceTexture;
import android.media.MediaCodec;
import android.media.MediaExtractor;
import android.media.MediaFormat;
import android.media.MediaMuxer;
import android.media.MediaRecorder;
import android.os.Environment;
import android.view.Surface;
import android.view.SurfaceHolder;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
public class AlarmRecorder {
private String videoPath;
private String audioPath;
private MediaFormat videoFormat;
private MediaFormat audioFormat;
private MediaExtractor videoExtractor;
private MediaExtractor audioExtractor;
private Runnable audioRecorderRunnable;
private Runnable videoRecorderRunnable;
private MediaRecorder videoRecorder;
private MediaRecorder audioRecorder;
//private SurfaceHolder previewHolder;
private Surface surface;
private Thread videoThread; // Video-Thread als Instanzvariable
private Thread audioThread; // Audio-Thread als Instanzvariable
public AlarmRecorder(SurfaceTexture surfaceTexture) {
audioRecorder = new MediaRecorder();
videoRecorder = new MediaRecorder();
videoExtractor = new MediaExtractor();
audioExtractor = new MediaExtractor();
this.surface = new Surface(surfaceTexture);
}
public void startRecording() {
createStoragePaths(); //Speicherort und -namen für Audio- und Video-Datei
audioRecorderRunnable = new AudioRecorder(audioRecorder, audioPath);
videoRecorderRunnable = new VideoRecorder(videoRecorder, videoPath, surface);
audioThread = new Thread(audioRecorderRunnable);
videoThread = new Thread(videoRecorderRunnable);
//Threads starten
videoThread.start();
audioThread.start();
}
public void stopRecording() {
try {
stopVideoRecording();
stopAudioRecording();
waitTillThreadsStopped();
File videoFile = new File(videoPath); //Speichere das aufgenommene Video
File audioFile = new File(audioPath); //Speichere die aufgenommene Audio
if (videoFile.exists() && audioFile.exists()) {
//Wenn Video- und Audioaufzeichnung gestoppt und abgespeichert sind, beginne mit dem Mergeprozess der beiden
mergeVideoWithAudio();
}
} catch (RuntimeException stopException) {
stopException.printStackTrace();
}
}
private void createStoragePaths(){
//Pfade zum Zwischenspeichern der aufgenommenen Audio und Video-Datei
String externalStorageDirectory = Environment.getExternalStorageDirectory().getAbsolutePath();
String dcimDirectory = externalStorageDirectory + "/DCIM";
videoPath = dcimDirectory + "/video.mp4";
audioPath = dcimDirectory + "/audio.mp3";
}
private void stopVideoRecording(){
if (videoRecorder != null) {
videoRecorder.stop();
videoRecorder.release();
videoRecorder = null;
}
}
private void stopAudioRecording(){
if (audioRecorder != null) {
audioRecorder.stop();
audioRecorder.release();
audioRecorder = null;
}
}
private void waitTillThreadsStopped(){
try {
videoThread.join();
audioThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private void mergeVideoWithAudio() {
try {
setVideoExtractorDataSource(); //extrahieren der Video Datei, die zuvor zwischengespeichert wurde
setAudioExtractorDataSource(); //extrahieren der Audio Datei, die zuvor zwischengespeichert wurde
//Speicherort der später zusammengeführten Datei
String outputFilePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath() + "/merged_video.mp4";
//MediaMuxer zum Zusammenführen einer Audio- und einer Videodatei
MediaMuxer muxer = new MediaMuxer(outputFilePath, MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);
int videoTrack = muxer.addTrack(videoFormat);
int audioTrack = muxer.addTrack(audioFormat);
muxer.start();
ByteBuffer buffer = ByteBuffer.allocate(1024 * 1024);
MediaCodec.BufferInfo bufferInfo = new MediaCodec.BufferInfo();
videoExtraction(buffer, videoTrack, bufferInfo, muxer);
audioExtraction(buffer, audioTrack, bufferInfo, muxer);
muxer.stop();
muxer.release();
// Löschen der separaten Video- und Audio-Dateien
deleteVideoFile();
deleteAudioFile();
} catch (IOException e) {
e.printStackTrace();
}
}
private void setVideoExtractorDataSource() {
try {
videoExtractor.setDataSource(videoPath);
int videoTrackIndex = getTrackIndex(videoExtractor, "video/");
if (videoTrackIndex < 0) {
// Video-Track nicht gefunden
return;
}
videoExtractor.selectTrack(videoTrackIndex);
videoFormat = videoExtractor.getTrackFormat(videoTrackIndex);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private void setAudioExtractorDataSource() {
try {
audioExtractor.setDataSource(audioPath);
int audioTrackIndex = getTrackIndex(audioExtractor, "audio/");
if (audioTrackIndex < 0) {
// Audio-Track nicht gefunden
return;
}
audioExtractor.selectTrack(audioTrackIndex);
audioFormat = audioExtractor.getTrackFormat(audioTrackIndex);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private int getTrackIndex(MediaExtractor extractor, String mimeType) {
int trackCount = extractor.getTrackCount();
for (int i = 0; i < trackCount; i++) {
MediaFormat format = extractor.getTrackFormat(i);
String trackMimeType = format.getString(MediaFormat.KEY_MIME);
if (trackMimeType.startsWith(mimeType)) {
return i;
}
}
return -1;
}
private void videoExtraction(ByteBuffer buffer, int videoTrack, MediaCodec.BufferInfo bufferInfo, MediaMuxer muxer) {
videoExtractor.seekTo(0, MediaExtractor.SEEK_TO_CLOSEST_SYNC);
while (true) {
int sampleSize = videoExtractor.readSampleData(buffer, 0);
if (sampleSize < 0) {
break;
}
long presentationTimeUs = videoExtractor.getSampleTime();
bufferInfo.offset = 0;
bufferInfo.size = sampleSize;
bufferInfo.flags = MediaCodec.BUFFER_FLAG_KEY_FRAME;
bufferInfo.presentationTimeUs = presentationTimeUs;
muxer.writeSampleData(videoTrack, buffer, bufferInfo);
videoExtractor.advance();
}
}
private void audioExtraction(ByteBuffer buffer, int audioTrack, MediaCodec.BufferInfo bufferInfo, MediaMuxer muxer) {
audioExtractor.seekTo(0, MediaExtractor.SEEK_TO_CLOSEST_SYNC);
while (true) {
int sampleSize = audioExtractor.readSampleData(buffer, 0);
if (sampleSize < 0) {
break;
}
long presentationTimeUs = audioExtractor.getSampleTime();
bufferInfo.offset = 0;
bufferInfo.size = sampleSize;
bufferInfo.flags = 0; // or MediaCodec.BUFFER_FLAG_KEY_FRAME
bufferInfo.presentationTimeUs = presentationTimeUs;
muxer.writeSampleData(audioTrack, buffer, bufferInfo);
audioExtractor.advance();
}
}
private void deleteVideoFile(){
File videoFile = new File(videoPath);
if (videoFile.exists()) {
videoFile.delete();
}
}
private void deleteAudioFile(){
File audioFile = new File(audioPath);
if (audioFile.exists()) {
audioFile.delete();
}
}
}
@@ -1,30 +0,0 @@
package com.example.greenwatch;
import android.media.MediaRecorder;
import java.io.IOException;
public class AudioRecorder implements Runnable {
private final MediaRecorder audioRecorder;
private final String audioPath;
public AudioRecorder(MediaRecorder audioRecorder, String audioPath) {
this.audioRecorder = audioRecorder;
this.audioPath = audioPath;
}
@Override
public void run() {
audioRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
audioRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
audioRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
audioRecorder.setOutputFile(audioPath);
try {
audioRecorder.prepare();
audioRecorder.start();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,27 @@
package com.example.greenwatch;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class AudiodetectionActivity extends AppCompatActivity {
private Button backToMainActivityButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_audiodetection);
backToMainActivityButton = (Button) findViewById(R.id.audiodetectorBackToMainActivity);
backToMainActivityButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}
@@ -0,0 +1,27 @@
package com.example.greenwatch;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class AudiodetectionAndAccelerometerActivity extends AppCompatActivity {
private Button backToMainActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_audiodetection_and_accelerometer);
backToMainActivity = (Button) findViewById(R.id.audiodetectionAndAccelerometerBackToMainActivity);
backToMainActivity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}
@@ -0,0 +1,4 @@
package com.example.greenwatch;
public class Beschleunigungssensor {
}
@@ -0,0 +1,27 @@
package com.example.greenwatch;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class ConnectionActivity extends AppCompatActivity {
private Button backToMainActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_connection);
backToMainActivity = (Button) findViewById(R.id.connectionBackToMainActivity);
backToMainActivity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}
@@ -0,0 +1,4 @@
package com.example.greenwatch;
public class Kamera {
}
@@ -1,101 +1,138 @@
package com.example.greenwatch;
import android.Manifest;
import android.content.pm.PackageManager;
import android.graphics.SurfaceTexture;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import android.content.Intent;
import android.os.Bundle;
import android.view.TextureView;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.example.greenwatch.models.Device;
import com.example.greenwatch.viewmodels.MainActivityViewModel;
public class MainActivity extends AppCompatActivity implements TextureView.SurfaceTextureListener{
import java.util.List;
private boolean isRecording = false;
private static final int REQUEST_PERMISSION = 200;
private Button button;
private TextureView textureView;
private AlarmRecorder alarmRecorder;
public class MainActivity extends AppCompatActivity {
private TextView tvstatusmessage;
private Button audiodetectionButton;
private Button videodetectionButton;
private Button accelerometerButton;
private Button audiodetectionAndAccelerometerButton;
private Button videodetectionAndAccelerometerButton;
private Button connectionButton;
private MainActivityViewModel mMainActivityViewModel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = findViewById(R.id.button);
textureView = findViewById(R.id.textureView);
textureView.setSurfaceTextureListener(this);
tvstatusmessage = (TextView) findViewById(R.id.tvStatusmessage);
audiodetectionButton = (Button) findViewById(R.id.audiodetectionButton);
videodetectionButton = (Button) findViewById(R.id.videodetectionButton);
accelerometerButton = (Button) findViewById(R.id.accelerometerButton);
audiodetectionAndAccelerometerButton = (Button) findViewById(R.id.audiodetectionAndAccelerometerButton);
videodetectionAndAccelerometerButton = (Button) findViewById(R.id.videodetectionAndAccelerometerButton);
connectionButton = (Button) findViewById(R.id.connectionButton);
button.setOnClickListener(new View.OnClickListener() {
mMainActivityViewModel = new ViewModelProvider(this).get(MainActivityViewModel.class);
mMainActivityViewModel.init();
mMainActivityViewModel.getConnectedDeviceList().observe(this, new Observer<List<Device>>() {
@Override
public void onChanged(List<Device> devices) {
StringBuilder sb = new StringBuilder();
sb.append("Time Stamp: ");
sb.append(mMainActivityViewModel.getTimeStamp(mMainActivityViewModel.getLocalDeviceUUID()));
sb.append(";\n");
sb.append("DeviceID: ");
sb.append(mMainActivityViewModel.getDeviceID(mMainActivityViewModel.getLocalDeviceUUID()));
sb.append(";\n");
sb.append("Sensor Status: ");
sb.append(mMainActivityViewModel.getSensorStatus(mMainActivityViewModel.getLocalDeviceUUID()));
sb.append(";\n");
sb.append("Sensor Type: ");
sb.append(mMainActivityViewModel.getSensorType(mMainActivityViewModel.getLocalDeviceUUID()));
sb.append(";\n");
sb.append("Sensor Massage: ");
sb.append(mMainActivityViewModel.getSensorMassage(mMainActivityViewModel.getLocalDeviceUUID()));
tvstatusmessage.setText(sb);
Toast.makeText(MainActivity.this, "onChanged", Toast.LENGTH_LONG).show();
}
});
audiodetectionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!isRecording) {
if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED
|| ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED
|| ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.RECORD_AUDIO)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO},
REQUEST_PERMISSION);
} else {
isRecording = true;
alarmRecorder.startRecording();
}
} else {
isRecording = false;
alarmRecorder.stopRecording();
}
//openAudiodetectionActivity();
mMainActivityViewModel.setDevice(mMainActivityViewModel.getLocalDeviceUUID(), "10:51", "12345", false, "Audio", 10);
}
});
videodetectionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//openVideodetectionActivity();
mMainActivityViewModel.setSensorType(mMainActivityViewModel.getLocalDeviceUUID(), "Video");
mMainActivityViewModel.setTimeStamp(mMainActivityViewModel.getLocalDeviceUUID(), "12:50");
mMainActivityViewModel.setDeviceID(mMainActivityViewModel.getLocalDeviceUUID(), mMainActivityViewModel.getLocalDeviceUUID());
}
});
accelerometerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openAccelerometerActivity();
mMainActivityViewModel.setSensorType(mMainActivityViewModel.getLocalDeviceUUID(), "Accelerometer");
}
});
audiodetectionAndAccelerometerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//openAudiodetectionAndAccelerometerActivity();
mMainActivityViewModel.setSensorType(mMainActivityViewModel.getLocalDeviceUUID(), "AudiodetectionAndAccelerometer");
mMainActivityViewModel.setTimeStamp(mMainActivityViewModel.getLocalDeviceUUID(), "00:00");
mMainActivityViewModel.setDeviceID(mMainActivityViewModel.getLocalDeviceUUID(), "6789");
}
});
videodetectionAndAccelerometerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openVideodetectionAndAccelerometerActivity();
}
});
connectionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openConnectionActivity();
}
});
}
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) {
alarmRecorder = new AlarmRecorder(surfaceTexture);
public void openAudiodetectionActivity(){
Intent intent = new Intent(this, AudiodetectionActivity.class);
startActivity(intent);
}
public void openVideodetectionActivity(){
Intent intent = new Intent(this, VideodetectionActivity.class);
startActivity(intent);
}
public void openAccelerometerActivity(){
Intent intent = new Intent(this, AccelerometerActivity.class);
startActivity(intent);
}
public void openAudiodetectionAndAccelerometerActivity(){
Intent intent = new Intent(this, AudiodetectionAndAccelerometerActivity.class);
startActivity(intent);
}
public void openVideodetectionAndAccelerometerActivity(){
Intent intent = new Intent(this, VideodetectionAndAccelerometerActivity.class);
startActivity(intent);
}
public void openConnectionActivity(){
Intent intent = new Intent(this, ConnectionActivity.class);
startActivity(intent);
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
// Die Größe der SurfaceTexture hat sich geändert
// Hier können entsprechende Anpassungen vorgenommen werden
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
// SurfaceTexture wurde zerstört
// Hier können entsprechende Bereinigungen durchgeführt werden
return true;
}
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
// SurfaceTexture wurde aktualisiert
// Hier können entsprechende Aktionen ausgeführt werden, wenn gewünscht
}
private SurfaceTexture getSurfaceTexture() {
return textureView.getSurfaceTexture();
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_PERMISSION) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// Berechtigungen wurden gewährt
Toast.makeText(this, "Berechtigungen gewährt", Toast.LENGTH_SHORT).show();
isRecording = true;
alarmRecorder.startRecording();
} else {
// Berechtigungen wurden nicht gewährt
Toast.makeText(this, "Berechtigungen nicht gewährt", Toast.LENGTH_SHORT).show();
}
}
}
}
@@ -0,0 +1,4 @@
package com.example.greenwatch;
public class Mikrofon {
}
@@ -1,39 +0,0 @@
package com.example.greenwatch;
import android.media.MediaRecorder;
import android.view.Surface;
import android.view.SurfaceHolder;
import java.io.IOException;
public class VideoRecorder implements Runnable{
private final MediaRecorder videoRecorder;
private final String videoPath;
//private SurfaceHolder previewHolder;
private Surface surface;
public VideoRecorder(MediaRecorder videoRecorder, String videoPath, Surface surface) {
this.videoRecorder = videoRecorder;
this.videoPath = videoPath;
this.surface = surface;
}
@Override
public void run() {
videoRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
videoRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
videoRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
videoRecorder.setOutputFile(videoPath);
videoRecorder.setOrientationHint(90);
videoRecorder.setPreviewDisplay(surface);
try {
videoRecorder.prepare();
videoRecorder.start();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,27 @@
package com.example.greenwatch;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class VideodetectionActivity extends AppCompatActivity {
private Button backToMainActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_videodetection);
backToMainActivity = (Button) findViewById(R.id.videodetectorBackToMainActivity);
backToMainActivity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}
@@ -0,0 +1,27 @@
package com.example.greenwatch;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class VideodetectionAndAccelerometerActivity extends AppCompatActivity {
private Button backToMainActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_videodetection_and_accelerometer);
backToMainActivity = (Button) findViewById(R.id.videodetectionAndAccelerometerBackToMainActivity);
backToMainActivity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}
@@ -0,0 +1,57 @@
package com.example.greenwatch.models;
public class Device {
private String timeStamp;
private String deviceID;
private boolean sensorStatus;
private String sensorType;
private int sensorMassage;
public Device(String timeStamp, String deviceID, boolean sensorStatus, String sensorType, int sensorMassage) {
this.timeStamp = timeStamp;
this.deviceID = deviceID;
this.sensorStatus = sensorStatus;
this.sensorType = sensorType;
this.sensorMassage = sensorMassage;
}
public void setTimeStamp(String timeStamp) {
this.timeStamp = timeStamp;
}
public String getTimeStamp() {
return timeStamp;
}
public void setDeviceID(String deviceID) {
this.deviceID = deviceID;
}
public String getDeviceID() {
return deviceID;
}
public void setSensorType(String sensorType) {
this.sensorType = sensorType;
}
public String getSensorType() {
return sensorType;
}
public void setSensorStatus(boolean sensorStatus) {
this.sensorStatus = sensorStatus;
}
public Boolean getSensorStatus() {
return sensorStatus;
}
public void setSensorMassage(int sensorMassage) {
this.sensorMassage = sensorMassage;
}
public int getSensorMassage() {
return sensorMassage;
}
}
@@ -0,0 +1,216 @@
package com.example.greenwatch.repositories;
import androidx.lifecycle.MutableLiveData;
import com.example.greenwatch.models.Device;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
public class DeviceRepository {
private String delimiter = ", ";
private String deviceUUID;
private static DeviceRepository deviceRepositoryInstance;
private MutableLiveData<List<Device>> deviceList = new MutableLiveData<>();
private HashMap<String, Device> connectedDevicesList = new HashMap<>();
private HashMap<String, String> deviceIDMapper = new HashMap<>();
public static synchronized DeviceRepository getInstance() {
if (deviceRepositoryInstance == null){
deviceRepositoryInstance = new DeviceRepository();
deviceRepositoryInstance.setDeviceUUID();
}
return deviceRepositoryInstance;
}
public MutableLiveData<List<Device>> getConnectedDeviceList() {
setMutableLiveDataValue();
return deviceList;
}
public void createNewDevice(String timeStamp, String deviceID, boolean sensorStatus, String sensorType, int sensorMassage){
Device newDevice = new Device(timeStamp, deviceID, sensorStatus, sensorType, sensorMassage);
addToConnectedDeviceList(newDevice.getDeviceID(), newDevice);
setMutableLiveDataValue();
}
public void createNewRemoteDevice(String message) {
String[] messageString = messageStringSplitter(message);
String timeStamp = messageString[0];
String deviceID = messageString[1];
boolean sensorStatus = Boolean.valueOf(messageString[1]);
String sensorType = messageString[3];
int sensorMassage = Integer.valueOf(messageString[4]);
if(!connectedDevicesList.containsKey(deviceID)) {
createNewDevice(timeStamp, deviceID, sensorStatus, sensorType, sensorMassage);
}
}
public String messageStringBuilder(String deviceID) {
StringBuilder message = new StringBuilder();
Device device = connectedDevicesList.get(deviceID);
if(device != null) {
message.append(device.getTimeStamp())
.append(delimiter)
.append(device.getDeviceID())
.append(delimiter)
.append(device.getSensorStatus())
.append(delimiter)
.append(device.getSensorType())
.append(delimiter)
.append(device.getSensorMassage());
return message.toString();
}
return message.toString();
}
public String getLocalDeviceUUID() {
return deviceUUID;
}
public void setDevice(String deviceID, String timeStamp, String newDeviceID, boolean sensorStatus, String sensorType, int sensorMassage) {
String checkedDeviceID = checkDeviceID(deviceID);
Device device = connectedDevicesList.get(checkedDeviceID);
if(device != null) {
device.setTimeStamp(timeStamp);
device.setDeviceID(newDeviceID);
device.setSensorStatus(sensorStatus);
device.setSensorType(sensorType);
device.setSensorMassage(sensorMassage);
setDeviceIDMapper(newDeviceID);
connectedDevicesList.remove(checkedDeviceID);
addToConnectedDeviceList(newDeviceID, device);
setMutableLiveDataValue();
}
}
public void setTimeStamp(String deviceID, String timeStamp) {
String checkedDeviceID = checkDeviceID(deviceID);
Device device = connectedDevicesList.get(checkedDeviceID);
if(device != null) {
device.setTimeStamp(timeStamp);
addToConnectedDeviceList(checkedDeviceID, device);
setMutableLiveDataValue();
}
}
public String getTimeStamp(String deviceID) {
String checkedDeviceID = checkDeviceID(deviceID);
Device device = connectedDevicesList.get(checkedDeviceID);
if(device != null) {
return device.getTimeStamp();
}
return "";
}
public void setDeviceID(String deviceID, String newDeviceID) {
String checkedDeviceID = checkDeviceID(deviceID);
Device device = connectedDevicesList.get(checkedDeviceID);
if(device != null) {
device.setDeviceID(newDeviceID);
setDeviceIDMapper(newDeviceID);
connectedDevicesList.remove(checkedDeviceID);
addToConnectedDeviceList(newDeviceID, device);
setMutableLiveDataValue();
}
}
public String getDeviceID(String deviceID) {
String checkedDeviceID = checkDeviceID(deviceID);
Device device = connectedDevicesList.get(checkedDeviceID);
if(device != null) {
return device.getDeviceID();
}
return "";
}
public void setSensorStatus(String deviceID, boolean sensorStatus) {
String checkedDeviceID = checkDeviceID(deviceID);
Device device = connectedDevicesList.get(checkedDeviceID);
if(device != null) {
device.setSensorStatus(sensorStatus);
addToConnectedDeviceList(checkedDeviceID, device);
setMutableLiveDataValue();
}
}
public boolean getSensorStatus(String deviceID) {
String checkedDeviceID = checkDeviceID(deviceID);
Device device = connectedDevicesList.get(checkedDeviceID);
if(device != null) {
return device.getSensorStatus();
}
return false;
}
public void setSensorType(String deviceID, String sensorType) {
String checkedDeviceID = checkDeviceID(deviceID);
Device device = connectedDevicesList.get(checkedDeviceID);
if(device != null) {
device.setSensorType(sensorType);
addToConnectedDeviceList(checkedDeviceID, device);
setMutableLiveDataValue();
}
}
public String getSensorType(String deviceID) {
String checkedDeviceID = checkDeviceID(deviceID);
Device device = connectedDevicesList.get(checkedDeviceID);
if(device != null) {
return device.getSensorType();
}
return "";
}
public void setSensorMassage(String deviceID, int sensorMessage) {
String checkedDeviceID = checkDeviceID(deviceID);
Device device = connectedDevicesList.get(checkedDeviceID);
if(device != null) {
device.setSensorMassage(sensorMessage);
addToConnectedDeviceList(checkedDeviceID, device);
setMutableLiveDataValue();
}
}
public int getSensorMassage(String deviceID) {
String checkedDeviceID = checkDeviceID(deviceID);
Device device = connectedDevicesList.get(checkedDeviceID);
if(device != null) {
return device.getSensorMassage();
}
return 0;
}
private void setMutableLiveDataValue() {
List<Device> list = new ArrayList<>(connectedDevicesList.values());
deviceList.setValue(list);
}
private void addToConnectedDeviceList(String key, Device device) {
connectedDevicesList.put(key, device);
}
private String checkDeviceID(String deviceID) {
if(!deviceIDMapper.isEmpty() && deviceID.equals(deviceUUID)) {
return deviceIDMapper.get(deviceID);
}
return deviceID;
}
private void setDeviceIDMapper(String deviceID) {
deviceIDMapper.put(deviceUUID, deviceID);
}
private void setDeviceUUID(){
this.deviceUUID = UUID.randomUUID().toString();
}
private String[] messageStringSplitter(String message) {
return message.split(delimiter);
}
}
@@ -0,0 +1,143 @@
package com.example.greenwatch.viewmodels;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.example.greenwatch.models.Device;
import com.example.greenwatch.repositories.DeviceRepository;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class AccelerometerViewModel extends ViewModel {
private MutableLiveData<List<Device>> mDeviceList;
private MutableLiveData<Boolean> mMovementDetected = new MutableLiveData<>();
private DeviceRepository mDeviceRepository;
private ArrayList<Float> Gesamt_be;
int arraySize = 500;
int functionCallCount;
float meanValue;
float offsetValue;
float thresholdValue;
boolean startMeasuring;
public void init() {
if (mDeviceList == null) {
mDeviceRepository = DeviceRepository.getInstance();
mDeviceList = mDeviceRepository.getConnectedDeviceList();
}
initGesamtBE();
mMovementDetected.setValue(false);
functionCallCount = 0;
meanValue = 0f;
offsetValue = 0.1f;
thresholdValue = 0.15f;
startMeasuring = false;
}
public void initGesamtBE() {
Gesamt_be = new ArrayList<>(arraySize);
for (int i = 0; i < arraySize; i++) {
Gesamt_be.add(0f);
}
}
public void addValueToGesamtBE(float newValue) {
if (Gesamt_be.size() == arraySize) {
Gesamt_be.remove(Gesamt_be.size() -1);
}
Gesamt_be.add(0, newValue);
functionCallCount++;
}
public void meanValueCalculation() {
for (float element : Gesamt_be) {
meanValue += Math.abs(element);
}
meanValue = meanValue/arraySize;
}
public void calibrateAccelerometerSensor() {
if (functionCallCount <= arraySize) {
offsetValue = meanValue;
}
else {
startMeasuring = true;
}
}
public void checkAlarmCondition() {
if (meanValue > (thresholdValue + offsetValue) && startMeasuring && !mMovementDetected.getValue()) {
mMovementDetected.setValue(true);
}
else if (meanValue < (thresholdValue + offsetValue) && mMovementDetected.getValue()){
mMovementDetected.setValue(false);
}
}
public String getSystemTimeStamp() {
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
Date date = new Date(System.currentTimeMillis());
return formatter.format(date);
}
public LiveData<Boolean> getMovementDetectedValue() {
return mMovementDetected;
}
public LiveData<List<Device>> getConnectedDeviceList() {
return mDeviceList;
}
public void setDevice(String deviceID, String timeStamp, String newDeviceID, boolean sensorStatus, String sensorType, int sensorMassage) {
mDeviceRepository.setDevice(deviceID, timeStamp,newDeviceID, sensorStatus, sensorType, sensorMassage);
}
public void setTimeStamp(String deviceID, String timeStamp) {
mDeviceRepository.setTimeStamp(deviceID, timeStamp);
}
public String getTimeStamp(String deviceID) {
return mDeviceRepository.getTimeStamp(deviceID);
}
public void setDeviceID(String deviceID, String newDeviceID) {
mDeviceRepository.setDeviceID(deviceID, newDeviceID);
}
public String getDeviceID(String deviceID) {
return mDeviceRepository.getDeviceID(deviceID);
}
public void setSensorStatus(String deviceID, boolean sensorStatus) {
mDeviceRepository.setSensorStatus(deviceID, sensorStatus);
}
public boolean getSensorStatus(String deviceID) {
return mDeviceRepository.getSensorStatus(deviceID);
}
public void setSensorType(String deviceID, String sensorType) {
mDeviceRepository.setSensorType(deviceID, sensorType);
}
public String getSensorType(String deviceID) {
return mDeviceRepository.getSensorType(deviceID);
}
public void setSensorMassage(String deviceID, int sensorMessage) {
mDeviceRepository.setSensorMassage(deviceID, sensorMessage);
}
public int getSensorMassage(String deviceID) {
return mDeviceRepository.getSensorMassage(deviceID);
}
public String getLocalDeviceUUID() {
return mDeviceRepository.getLocalDeviceUUID();
}
}
@@ -0,0 +1,77 @@
package com.example.greenwatch.viewmodels;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.example.greenwatch.models.Device;
import com.example.greenwatch.repositories.DeviceRepository;
import java.util.List;
public class MainActivityViewModel extends ViewModel {
private MutableLiveData<List<Device>> mDeviceList;
private DeviceRepository mDeviceRepository;
public void init() {
if(mDeviceList != null) {
return;
}
mDeviceRepository = DeviceRepository.getInstance();
mDeviceRepository.createNewDevice("", mDeviceRepository.getLocalDeviceUUID(), false, "", 0);
mDeviceList = mDeviceRepository.getConnectedDeviceList();
}
public LiveData<List<Device>> getConnectedDeviceList() {
return mDeviceList;
}
public void setDevice(String deviceID, String timeStamp, String newDeviceID, boolean sensorStatus, String sensorType, int sensorMassage) {
mDeviceRepository.setDevice(deviceID, timeStamp,newDeviceID, sensorStatus, sensorType, sensorMassage);
}
public void setTimeStamp(String deviceID, String timeStamp) {
mDeviceRepository.setTimeStamp(deviceID, timeStamp);
}
public String getTimeStamp(String deviceID) {
return mDeviceRepository.getTimeStamp(deviceID);
}
public void setDeviceID(String deviceID, String newDeviceID) {
mDeviceRepository.setDeviceID(deviceID, newDeviceID);
}
public String getDeviceID(String deviceID) {
return mDeviceRepository.getDeviceID(deviceID);
}
public void setSensorStatus(String deviceID, boolean sensorStatus) {
mDeviceRepository.setSensorStatus(deviceID, sensorStatus);
}
public boolean getSensorStatus(String deviceID) {
return mDeviceRepository.getSensorStatus(deviceID);
}
public void setSensorType(String deviceID, String sensorType) {
mDeviceRepository.setSensorType(deviceID, sensorType);
}
public String getSensorType(String deviceID) {
return mDeviceRepository.getSensorType(deviceID);
}
public void setSensorMassage(String deviceID, int sensorMessage) {
mDeviceRepository.setSensorMassage(deviceID, sensorMessage);
}
public int getSensorMassage(String deviceID) {
return mDeviceRepository.getSensorMassage(deviceID);
}
public String getLocalDeviceUUID() {
return mDeviceRepository.getLocalDeviceUUID();
}
}
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="match_parent"
android:orientation="vertical"
android:padding="10dp"
tools:context=".AccelerometerActivity">
<TextView
android:id="@+id/tvAccelerometerStatusmessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="">
</TextView>
<TextView
android:id="@+id/tvAccelerometerData"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="">
</TextView>
<TextView
android:id="@+id/tvAccelerometerWarning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="">
</TextView>
<Button
android:id="@+id/accelerometerBackToMainActivity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Back to MainActivity">
</Button>
</LinearLayout>
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="match_parent"
android:orientation="vertical"
android:padding="10dp"
tools:context=".AudiodetectionActivity">
<TextView
android:id="@+id/tvAudiodetectionStatusmessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Audiodetection Activity">
</TextView>
<Button
android:id="@+id/audiodetectorBackToMainActivity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Back to MainActivity">
</Button>
</LinearLayout>
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="match_parent"
android:orientation="vertical"
android:padding="10dp"
tools:context=".AudiodetectionAndAccelerometerActivity">
<TextView
android:id="@+id/tvAudiodetectionAndAccelerometerStatusmessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Audiodetection + Accelerometer Activity">
</TextView>
<Button
android:id="@+id/audiodetectionAndAccelerometerBackToMainActivity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Back to MainActivity">
</Button>
</LinearLayout>
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="match_parent"
android:orientation="vertical"
android:padding="10dp"
tools:context=".ConnectionActivity">
<TextView
android:id="@+id/tvConnectionStatusmessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Connection Activity">
</TextView>
<Button
android:id="@+id/connectionBackToMainActivity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Back to MainActivity">
</Button>
</LinearLayout>
+66 -22
View File
@@ -1,31 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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="match_parent"
android:orientation="vertical"
android:padding="10dp"
tools:context=".MainActivity">
<TextureView
android:id="@+id/textureView"
android:layout_width="1sp"
android:layout_height="1sp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/button"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/tvStatusmessage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Hello World!"
android:layout_weight="1">
</TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="339dp"
android:text="Record Video"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<Button
android:id="@+id/audiodetectionButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Audiodetection">
</Button>
</androidx.constraintlayout.widget.ConstraintLayout>
<Button
android:id="@+id/videodetectionButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Videodetection">
</Button>
<Button
android:id="@+id/accelerometerButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Accelerometer">
</Button>
<Button
android:id="@+id/audiodetectionAndAccelerometerButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Audiodetection + Accelerometer">
</Button>
<Button
android:id="@+id/videodetectionAndAccelerometerButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Videodetection + Accelerometer">
</Button>
<Button
android:id="@+id/connectionButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Connect to Devices">
</Button>
</LinearLayout>
</LinearLayout>
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="match_parent"
android:orientation="vertical"
android:padding="10dp"
tools:context=".VideodetectionActivity">
<TextView
android:id="@+id/tvVideodetectionStatusmessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Videodetection Activity">
</TextView>
<Button
android:id="@+id/videodetectorBackToMainActivity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Back to MainActivity">
</Button>
</LinearLayout>
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="match_parent"
android:orientation="vertical"
android:padding="10dp"
tools:context=".VideodetectionAndAccelerometerActivity">
<TextView
android:id="@+id/tvVideodetectionAndAccelerometerStatusmessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Videodetection + Accelerometer Activity">
</TextView>
<Button
android:id="@+id/videodetectionAndAccelerometerBackToMainActivity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Back to MainActivity">
</Button>
</LinearLayout>