Compare commits

..
Author SHA1 Message Date
proelssju74689 23a2115a9d Dateien hochladen nach "Gruppe3" 2023-06-23 14:20:01 +00:00
proelssju74689 b84dc3f873 Dateien hochladen nach "Gruppe3" 2023-06-23 14:17:04 +00:00
bauseweinfr74630 e0a2a356bf Kapselung in Funktionen und Klassen 2023-06-20 15:57:40 +02:00
22 changed files with 8 additions and 593 deletions

No files matched your search

BIN
View File
Binary file not shown.
Binary file not shown.
-18
View File
@@ -9,24 +9,6 @@
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">
@@ -1,28 +0,0 @@
package com.example.greenwatch;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class AccelerometerActivity extends AppCompatActivity {
private Button backToMainActivityButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_accelerometer);
backToMainActivityButton = (Button) findViewById(R.id.accelerometerBackToMainActivity);
backToMainActivityButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}
@@ -1,27 +0,0 @@
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();
}
});
}
}
@@ -1,27 +0,0 @@
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();
}
});
}
}
@@ -1,27 +0,0 @@
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();
}
});
}
}
@@ -2,91 +2,13 @@ package com.example.greenwatch;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
private Button audiodetectionButton;
private Button videodetectionButton;
private Button accelerometerButton;
private Button audiodetectionAndAccelerometerButton;
private Button videodetectionAndAccelerometerButton;
private Button connectionButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
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);
audiodetectionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openAudiodetectionActivity();
}
});
videodetectionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openVideodetectionActivity();
}
});
accelerometerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openAccelerometerActivity();
}
});
audiodetectionAndAccelerometerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openAudiodetectionAndAccelerometerActivity();
}
});
videodetectionAndAccelerometerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openVideodetectionAndAccelerometerActivity();
}
});
connectionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openConnectionActivity();
}
});
}
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);
}
}
@@ -1,27 +0,0 @@
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();
}
});
}
}
@@ -1,27 +0,0 @@
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();
}
});
}
}
@@ -1,29 +0,0 @@
package com.example.greenwatch.mvc;
public class Device {
private String sensor;
private Boolean isActive;
public Device(String Sensor, Boolean Status) {
this.sensor = Sensor;
this.isActive = Status;
}
public void setSensor(String Sensor) {
this.sensor = Sensor;
}
public String getSensor() {
return sensor;
}
public void setIsActive(Boolean Status) {
this.isActive = Status;
}
public Boolean getIsActive() {
return isActive;
}
}
@@ -1,33 +0,0 @@
package com.example.greenwatch.mvc;
public class DeviceController {
private DeviceModel deviceModel;
private DeviceView deviceView;
public DeviceController(DeviceView view) {
this.deviceModel = DeviceModel.getInstance();
this.deviceView = view;
}
public void createDevice(String Sensor, Boolean Status) {
Device device = new Device(Sensor, Status);
deviceModel.addDevice(device);
// todo: Inform view and sender about changes
}
public void setDeviceSensor(String UUID, String Sensor) {
deviceModel.setDeviceSensor(UUID, Sensor);
}
public String getDeviceSensor(String UUID) {
return deviceModel.getDeviceSensor(UUID);
}
public void setDeviceStatus(String UUID, Boolean Status) {
deviceModel.setDeviceStatus(UUID, Status);
}
public Boolean getDeviceStatus(String UUID) {
return deviceModel.getDeviceStatus(UUID);
}
}
@@ -1,47 +0,0 @@
package com.example.greenwatch.mvc;
import java.util.Vector;
public class DeviceModel {
private static DeviceModel itemModelInstance;
// todo: should be a hashmap with UUID Keys
private Vector<Device> connectetDevicesList;
private DeviceModel() {
connectetDevicesList = new Vector<Device>();
}
public static synchronized DeviceModel getInstance() {
if (itemModelInstance == null){
itemModelInstance = new DeviceModel();
}
return itemModelInstance;
}
public void addDevice(Device device) {
// todo: Check if divece already exist
connectetDevicesList.add(device);
}
public Vector<Device> getConnectetDevicesList() {
return connectetDevicesList;
}
public void setDeviceSensor(String UUID, String Sensor) {
// todo: iterate through HashMap and find Divece for UUID
}
public String getDeviceSensor(String UUID) {
// todo: iterate through HashMap and find Divece for UUID
return "hasToBeDone";
}
public void setDeviceStatus(String UUID, Boolean Status) {
// todo: iterate through HashMap and find Divece for UUID
}
public Boolean getDeviceStatus(String UUID) {
// todo: iterate through HashMap and find Divece for UUID
return false;
}
}
@@ -1,10 +0,0 @@
package com.example.greenwatch.mvc;
import java.util.Vector;
public class DeviceView {
public void updateView(Vector<Device> deviceVector) {
// todo: what should be displayed
}
}
@@ -1,25 +0,0 @@
<?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="Accelerometer Activity">
</TextView>
<Button
android:id="@+id/accelerometerBackToMainActivity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Back to MainActivity">
</Button>
</LinearLayout>
@@ -1,25 +0,0 @@
<?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>
@@ -1,25 +0,0 @@
<?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>
@@ -1,25 +0,0 @@
<?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>
+8 -65
View File
@@ -1,75 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.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="match_parent"
android:orientation="vertical"
android:padding="10dp"
tools:context=".MainActivity">
<TextView
android:id="@+id/tvStatusmessage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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">
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="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>
<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>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,25 +0,0 @@
<?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>
@@ -1,25 +0,0 @@
<?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>