Compare commits

...
76 Commits
Author SHA1 Message Date
kleineckeol72024 076db89147 removed Fragment classes from MainActivity
- changed buttons, added fragments
2023-06-21 18:21:52 +02:00
kleineckeol72024 061646a7d6 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	app/src/main/AndroidManifest.xml
#	app/src/main/java/com/example/ueberwachungssystem/MainActivity.java
#	app/src/main/res/layout/activity_main.xml
2023-06-20 23:05:14 +02:00
siebenhaarmi76624 6f78836c4d Merge remote-tracking branch 'origin/master' 2023-06-20 22:34:42 +02:00
siebenhaarmi76624 b667e70fef Kommunikationcopie Version 1.8 UDP Socket 2023-06-20 22:30:30 +02:00
wolzto94552 272daf9fae Adjustment to fit master 2023-06-20 22:25:20 +02:00
wolzto94552 55ae95e661 Merge of MicrophoneDetector 2023-06-20 21:58:09 +02:00
wolzto94552 8e47934beb Merge branch 'tw' into master
# Conflicts:
#	app/build.gradle
#	app/src/main/AndroidManifest.xml
#	app/src/main/java/com/example/ueberwachungssystem/MainActivity.java
#	app/src/main/res/layout/activity_main.xml
#	gradle.properties
2023-06-20 21:42:25 +02:00
wolzto94552 c60a14b6ac Clean project for merge 2023-06-20 21:37:17 +02:00
Leon Market b9c66f7533 Updated detection report constructor in Accelerometer 2023-06-20 21:23:57 +02:00
Leon Market 7e1143880e Merge branch 'lm'
# Conflicts:
#	app/src/main/java/com/example/ueberwachungssystem/Detection/DetectionReport.java
#	app/src/main/java/com/example/ueberwachungssystem/Detection/Detector.java
#	app/src/main/java/com/example/ueberwachungssystem/MainActivity.java
#	app/src/main/res/layout/activity_main.xml
2023-06-20 21:20:04 +02:00
wolzto94552 4381ae78f8 Commit before cleaning project for merge (minor changes) 2023-06-20 21:16:18 +02:00
siebenhaarmi76624 c198292fbf Merge remote-tracking branch 'origin/master' into Kommunikationcopie
# Conflicts:
#	app/src/main/AndroidManifest.xml
#	app/src/main/java/com/example/ueberwachungssystem/MainActivity.java
#	app/src/main/java/com/example/ueberwachungssystem/WifiCommunication.java
#	app/src/main/res/layout/activity_main.xml
2023-06-20 21:13:26 +02:00
Leon Market 81c3542654 Removed unnecessary packages 2023-06-20 21:13:08 +02:00
siebenhaarmi76624 35d52088aa merge Kommunikationcopie Version 1.7 UDP Socket 2023-06-20 21:06:51 +02:00
wolzto94552 81e04e370a Commit before cleaning project for merge 2023-06-20 21:04:33 +02:00
Leon Market d33ab299ab Added reportViolation() 2023-06-20 20:59:18 +02:00
siebenhaarmi76624 ee61f7042b Kommunikation Version 1.6 UDP Socket 2023-06-20 20:50:18 +02:00
siebenhaarmi76624 ab54b6d96a Kommunikation Version 1.5 UDP Socket 2023-06-20 20:47:53 +02:00
siebenhaarmi76624 a85fb1f5ca Kommunikation Version 1.5 UDP Socket 2023-06-20 20:33:46 +02:00
kohlerba68671 f8f1fd23fb Merge branch 'bk_video'
# Conflicts:
#	app/src/main/java/com/example/ueberwachungssystem/MainActivity.java
2023-06-20 15:34:24 +02:00
siebenhaarmi76624 e007ad1744 Kommunikation Version 1.4 UDP Socket 2023-06-20 15:22:27 +02:00
siebenhaarmi76624 292c3457fa Kommunikation Version 1.4 UDP Socket 2023-06-20 15:22:10 +02:00
siebenhaarmi76624 79c7c16d21 Kommunikation Version 1.4 UDP Socket 2023-06-20 15:19:29 +02:00
kohlerba68671 e01e23eccd Refactor 2023-06-20 14:29:10 +02:00
kohlerba68671 a493bafb79 Refactor 2023-06-20 11:16:26 +02:00
kohlerba68671 aed079377f Refactor 2023-06-20 11:07:57 +02:00
kohlerba68671 bff6abbd29 Removed Permission Handling from Video Detector, Added PermissionHandler.java class 2023-06-20 11:00:26 +02:00
kohlerba68671 5d31f0bb46 Adapted Parameters 2023-06-19 15:47:40 +02:00
kohlerba68671 ea0e88ed89 Refactor in DetectorService class 2023-06-19 14:51:04 +02:00
kohlerba68671 7dee124378 Refactor in DetectorService class 2023-06-19 14:41:41 +02:00
kohlerba68671 0ee1446cbc Merge branch 'bk_video_service' into bk_video
# Conflicts:
#	app/src/main/java/com/example/ueberwachungssystem/MainActivity.java
2023-06-19 14:40:06 +02:00
kohlerba68671 bc5227ba4f Refactor of DetectorService 2023-06-19 14:37:49 +02:00
kohlerba68671 4185cb5200 Proper display of Toasts in Audio Recorder 2023-06-19 14:34:07 +02:00
kohlerba68671 0a3600d0d6 Refactor 2023-06-19 14:27:04 +02:00
kohlerba68671 9b2d57ad37 Refactor 2023-06-19 13:35:02 +02:00
kohlerba68671 847e90f5ac Fixed Bug in VideoDetector 2023-06-19 13:17:17 +02:00
kohlerba68671 ab41217f0e Added DetectionService 2023-06-19 13:13:23 +02:00
siebenhaarmi76624 0782bbdd04 merge Kommunikation Version 1.3 UDP Socket 2023-06-19 13:00:22 +02:00
kohlerba68671 e088b0afa3 Working Recorder and Video Detector 2023-06-18 20:17:19 +02:00
kohlerba68671 493fa8ca83 Fixed Grey Stripes and Rotation Problems 2023-06-18 18:12:03 +02:00
kohlerba68671 6954d38143 Moved OpenCV Helper to its own Java File 2023-06-18 13:43:10 +02:00
Leon Market 8a5d720685 Changed to a (hopefully) working version of the Accelerometer 2023-06-18 13:13:30 +02:00
kohlerba68671 057c7fc139 Added Audio Recorder 2023-06-18 13:03:38 +02:00
kohlerba68671 29c193b716 Removed Preview Use Case, Audio still not working 2023-06-18 10:55:21 +02:00
Leon Market 90aea5b1bc Added LinkedBlockingQueue to collect data, added Thread to evaluate data from queue 2023-06-17 23:58:34 +02:00
kohlerba68671 76442888f7 Working Video Detector + Recorder WIP: Use Case logic 2023-06-17 19:44:08 +02:00
Leon Market 8a357e0d26 Fixed errors after merge with origin:lm 2023-06-17 19:20:32 +02:00
Leon Market 83268c763b Merge remote-tracking branch 'origin/lm' into lm
# Conflicts:
#	app/src/main/java/com/example/ueberwachungssystem/Beschleunigungssensor.java
2023-06-17 19:17:11 +02:00
Leon Market 3d02d8d4c0 Added 2023-06-17 19:16:48 +02:00
Leon Market cafe763c4a Removed unnecessary code parts 2023-06-17 19:14:34 +02:00
Leon Market 2cff334056 Added detection report 2023-06-17 19:00:44 +02:00
kohlerba68671 d32e0a11f5 Fixed bug in Detector and VideoDetector 2023-06-17 11:20:56 +02:00
wolzto94552 b94a1d98b7 Working detection with calibration and dB signals. FFT also implemented, but does not work properly at the moment. (Added Complex class, FFT class and imported jjoe64 Graphview (in gradle and gradle.properties) for visualising FFT results) 2023-06-16 16:49:20 +02:00
kleineckeol72024 746eec18ba removed Fragment classes from MainActivity 2023-06-15 17:19:35 +02:00
siebenhaarmi76624 e89a5d11a1 Kommunikation Version 1.2 UDP Socket 2023-06-15 16:38:49 +02:00
siebenhaarmi76624 b246ad8624 Kommunikation Version 1.1 UDP Socket 2023-06-15 15:09:19 +02:00
Leon Market 6c4905d0e7 Added constructors for activity and textView in ThreadDemo 2023-06-15 14:27:25 +02:00
kohlerba68671 fb8bdcd895 Fixed up Video detector 2023-06-15 12:40:54 +02:00
Leon Market 402b73e4bd Removed calibration code and added method checkAlarm 2023-06-14 22:28:05 +02:00
Leon Market 9e5b669986 Added Accelerometer as Runnable Class and ThreadDemo as example 2023-06-14 22:25:54 +02:00
Leon Market 8275d8bd5a Added 2023-06-14 22:11:17 +02:00
kohlerba68671 7ef0df48dd Refactored Detector 2023-06-14 20:14:06 +02:00
kohlerba68671 50b579705e Detector based on OpenCV working 2023-06-14 19:43:18 +02:00
kohlerba68671 8551abfc5d Changde Detector class 2023-06-14 16:38:33 +02:00
kohlerba68671 bbd333426d unfinished changes in Detector 2023-06-13 20:55:30 +02:00
kohlerba68671 e98ae10267 refactor 2023-06-12 19:03:52 +02:00
kohlerba68671 7d29ed1ca9 Rebuild to use openCV. Alarm not yet implemented 2023-06-09 20:56:14 +02:00
kohlerba68671 f98079d431 Readded main and main xml 2023-06-09 09:09:50 +02:00
siebenhaarmi76624 192f88ede5 Kommunikation Version 1 UDP Socket 2023-06-08 18:10:39 +02:00
siebenhaarmi76624 3c1366bd10 Kommunikation Version 1 UDP Socket 2023-06-08 17:59:47 +02:00
wolzto94552 7c8610facb Move from Mikrofon to MicrophoneDetector class and add of abstract Detector class 2023-05-25 16:58:08 +02:00
Leon Market 4999f1b998 added Detector, DetectorReport, Logger 2023-05-25 16:46:12 +02:00
Leon Market 620528302e added Beschleunigungssensor 2023-05-24 20:40:18 +02:00
unknown 90a2aad491 new class Mikrofon 2023-05-11 16:21:59 +02:00
siebenhaarmi76624 35583a4cdd Merge branch 'test' of siebenhaarmi76624/MDT5_1_Ueberwachungssystem_G1 into ms 2023-05-11 13:39:00 +00:00
siebenhaarmi76624 d22952d83b Initial commit Project Version 0 2023-05-11 15:38:14 +02:00
28 changed files with 668 additions and 538 deletions
+3
View File
@@ -0,0 +1,3 @@
Sensor als Service einrichten, der aus Activity heraus gestartet werden kann.
Stichwort: Intent
Siehe Skript Teil 1
+12
View File
@@ -26,6 +26,9 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
@@ -33,10 +36,19 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.gms:play-services-nearby:18.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
// OpenCV (from: https://github.com/QuickBirdEng/opencv-android)
def opencv_version = "4.5.3.0"
implementation "com.quickbirdstudios:opencv:${opencv_version}"
implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"
// Required for CameraX
def camerax_version = "1.2.2"
implementation "androidx.camera:camera-core:${camerax_version}"
+4 -21
View File
@@ -2,27 +2,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<!-- &lt;!&ndash; If your app targets Android 13 (API level 33)-->
<!-- or higher, you must declare the NEARBY_WIFI_DEVICES permission. &ndash;&gt;-->
<!-- <uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES"-->
<!-- &lt;!&ndash; If your app derives location information from Wi-Fi APIs,-->
<!-- don't include the "usesPermissionFlags" attribute. &ndash;&gt;-->
<!-- android:usesPermissionFlags="neverForLocation" />-->
<uses-permission
android:required="true"
android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- If any feature in your app relies on precise location information,
don't include the "maxSdkVersion" attribute. -->
<uses-permission
android:required="true"
android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission
android:required="true"
android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission
android:required="true"
android:name="android.permission.INTERNET"/>
<uses-feature android:name="android.hardware.camera"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
@@ -46,6 +28,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".Detection.DetectorService"/>
</application>
</manifest>
@@ -1,36 +0,0 @@
package com.example.ueberwachungssystem.Detection;
import android.util.Log;
import java.util.Calendar;
/** Detection Report Class */
public class DetectionReport {
public String timeStamp;
public String detectionType;
public float detectedValue;
public String detectorID;
public DetectionReport(String detectorID, String detectionType, float detectedAmplitude) {
this.timeStamp = String.valueOf(Calendar.getInstance().getTime());
this.detectionType = detectionType;
this.detectedValue = detectedAmplitude;
this.detectorID = detectorID;
}
/** Get Detection Report in String format */
public String toString() {
String time = "Time: " + "[" + this.timeStamp + "]";
String type = "Type: " + "[" + this.detectionType + "]";
String value = "Value: " + "[" + this.detectedValue + "]";
String id = "ID: " + "[" + this.detectorID + "]";
return String.join("\t", time, type, value, id);
}
/** Debug Report */
public void log(String tag) {
Log.d(tag, this.toString());
}
}
@@ -1,38 +0,0 @@
package com.example.ueberwachungssystem.Detection;
import androidx.annotation.NonNull;
abstract public class Detector {
private OnDetectionListener listener;
/** Constructor - takes context of current activity */
public Detector() {}
/** On Detection Listener - runs when violation is reported */
public interface OnDetectionListener {
void onDetection(@NonNull DetectionReport detectionReport);
}
public void setOnDetectionListener(@NonNull OnDetectionListener listener) {
this.listener = listener;
}
/** Triggers onDetectionListener - call this to trigger violation/alarm */
public void reportViolation(String detectorID, String detectionType, float amplitude) {
if (listener != null) {
DetectionReport detectionReport = new DetectionReport(detectorID, detectionType, amplitude);
listener.onDetection(detectionReport);
} else {
throw new IllegalStateException("No listener set for violation reporting");
}
}
/** Starts Detection (abstract method: needs to be overridden in child class) */
public abstract void startDetection();
/** Stops Detection (abstract method: needs to be overridden in child class) */
public abstract void stopDetection();
}
@@ -1,196 +0,0 @@
package com.example.ueberwachungssystem.Detection;
import android.content.Context;
import android.graphics.ImageFormat;
import android.media.Image;
import android.util.Size;
import androidx.annotation.NonNull;
import androidx.camera.core.CameraSelector;
import androidx.camera.core.ExperimentalGetImage;
import androidx.camera.core.ImageAnalysis;
import androidx.camera.core.Preview;
import androidx.camera.lifecycle.ProcessCameraProvider;
import androidx.camera.view.PreviewView;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.LifecycleOwner;
import com.google.common.util.concurrent.ListenableFuture;
import java.nio.ByteBuffer;
import java.util.concurrent.ExecutionException;
/**
* Video Detector inherits some methods from abstract Detector class (more info there)
*
*
* USE FROM MAIN ACTIVITY:
*
* VideoDetector vd = new VideoDetector(this);
* vd.setPreview(previewView); //THIS IS OPTIONAL!
* vd.setOnDetectionListener(new Detector.OnDetectionListener{...});
* vd.startDetection();
* vd.stopDetection
*
* */
@ExperimentalGetImage
public class VideoDetector extends Detector {
// Calling Activity
private final Context context;
// Camera Provider
private ProcessCameraProvider cameraProvider;
private Boolean isDetectionRunning = false;
// Preview Camera Image
private PreviewView previewView = null;
// Detect Violation
private static final float PIXEL_THRESHOLD = 30f; // Luminosity (brightness channel of YUV_420_888)
private static final float ALARM_THRESHOLD = 0.2f; // Percent of pixels changed
private ByteBuffer previousBuffer = null;
/**
* Constructor
* @param context: the context of calling activity (usually "this")
* */
public VideoDetector(Context context) {
super();
this.context = context;
}
/**
* Starts the Video Detection
* */
@Override
public void startDetection() {
if (isDetectionRunning)
return;
// Request Camera Provider
final ListenableFuture<ProcessCameraProvider> cameraProviderFuture = ProcessCameraProvider.getInstance(context);
//Check for Camera availability
cameraProviderFuture.addListener(() -> {
try {
cameraProvider = cameraProviderFuture.get();
bindAnalysis(cameraProvider);
isDetectionRunning = true;
previousBuffer = null;
} catch (ExecutionException | InterruptedException e) {
// No errors need to be handled for this Future. This should never be reached.
}
},ContextCompat.getMainExecutor(context));
}
/**
* Stops the Video Detection
* */
@Override
public void stopDetection() {
if (!isDetectionRunning)
return;
cameraProvider.unbindAll();
isDetectionRunning = false;
}
/**
* Set PreviewView to show video feed while detecting
* this is optional and does not need to be called
* */
public void setPreviewView(PreviewView previewView) {
this.previewView = previewView;
}
/**
* Binds the Luminosity Analyzer (configure and run Analysis)
* @param cameraProvider: CameraProvider of Context passed by Constructor
* */
private void bindAnalysis(@NonNull ProcessCameraProvider cameraProvider) {
// Configure and create Image Analysis
ImageAnalysis.Builder builder = new ImageAnalysis.Builder();
builder.setTargetResolution(new Size(640, 480));
builder.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST);
builder.setOutputImageFormat(ImageAnalysis.OUTPUT_IMAGE_FORMAT_YUV_420_888);
ImageAnalysis imageAnalysis = builder.build();
// Set Analyzer
imageAnalysis.setAnalyzer(ContextCompat.getMainExecutor(context), imageProxy -> {
if (imageProxy.getFormat() == ImageFormat.YUV_420_888) {
Image image = imageProxy.getImage();
assert image != null;
// Changed Pixel Detection
int pixelChanged = getChangedPixelCount(image);
int width = image.getWidth();
int height = image.getHeight();
float percentPixelChanged = (float) 100f * pixelChanged / (width * height);
if (percentPixelChanged > ALARM_THRESHOLD)
reportViolation("0", "Video", percentPixelChanged);
}
imageProxy.close();
});
// Create Preview
Preview preview = new Preview.Builder().build();
// Specify which Camera to use
CameraSelector cameraSelector = new CameraSelector.Builder().requireLensFacing(CameraSelector.LENS_FACING_BACK).build();
// Update PreviewView if set
if (previewView != null)
preview.setSurfaceProvider(previewView.getSurfaceProvider());
cameraProvider.bindToLifecycle((LifecycleOwner) context, cameraSelector, imageAnalysis, preview);
}
/**
* Calculate Amount of Pixels changed using a threshold
* @param image
* */
private int getChangedPixelCount(Image image) {
Image.Plane[] planes = image.getPlanes();
ByteBuffer buffer = planes[0].getBuffer();
if (previousBuffer == null) {
previousBuffer = ByteBuffer.allocate(buffer.capacity());
buffer.rewind();
previousBuffer.put(buffer);
previousBuffer.rewind();
return 0;
}
int width = image.getWidth();
int height = image.getHeight();
int yRowStride = image.getPlanes()[0].getRowStride();
int yPixelStride = image.getPlanes()[0].getPixelStride();
int changedPixelCount = 0;
// Count changed pixels
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; x++) {
int index = (y * yRowStride) + (x * yPixelStride);
int luminosity = (buffer.get(index) & 0xff);
int previousLuminosity = (previousBuffer.get(index) & 0xff);
int diff = Math.abs(luminosity - previousLuminosity);
if (diff > PIXEL_THRESHOLD)
changedPixelCount++;
}
}
// Reset and copy Byte Buffer
buffer.rewind();
previousBuffer.rewind();
previousBuffer.put(buffer);
return changedPixelCount;
}
}
@@ -0,0 +1,53 @@
package com.example.ueberwachungssystem.Fragments;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.VideoView;
import androidx.fragment.app.Fragment;
import com.example.ueberwachungssystem.R;
import java.io.File;
public class Fragment1 extends Fragment {
private String text;
private final static String KEY_TEXT = "KEY_TEXT";
private void log(String nachricht) {
Log.d(this.getClass().getSimpleName(), nachricht);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
log("onCreateView");
View view = inflater.inflate(R.layout.fragment1, container, false);
TextView Sensor = (TextView) view.findViewById(R.id.Alarm);
Sensor.setText(text);
return view;
}
public static Fragment1 erstellen(String text) {
Fragment1 fragment = new Fragment1();
Bundle b = new Bundle();
b.putString(KEY_TEXT, text);
fragment.setArguments(b);
return fragment;
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
Bundle args = getArguments();
if (args != null ) {
text = args.getString(KEY_TEXT);
log("onCreate: text=" + text);
} else {
log("onCreate");
}
}
}
@@ -0,0 +1,66 @@
package com.example.ueberwachungssystem.Fragments;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import com.example.ueberwachungssystem.MeinAdapter;
import com.example.ueberwachungssystem.R;
import java.io.File;
import java.util.Arrays;
import java.util.List;
public class Fragment2 extends Fragment {
private String text;
private Context c;
private final static String KEY_TEXT = "KEY_TEXT" ;
private void log(String nachricht) {
Log.d(this.getClass().getSimpleName(), nachricht);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
log( "onCreateView" );
View view = inflater.inflate(R.layout.fragment2, container, false );
// TextView Sensor = (TextView) view.findViewById(R.id.Aufzeichnungen);
// Sensor.setText(text);
return view;
}
public static Fragment2 erstellen(String text) {
Fragment2 fragment = new Fragment2();
Bundle b = new Bundle();
b.putString(KEY_TEXT, text);
fragment.setArguments(b);
return fragment;
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
Bundle args = getArguments();
c = getContext();
ListView listView = new ListView(c);
setContentView(R.layout.fragment2);
listView.setAdapter(new MeinAdapter(c, getVideoFiles()));
if (args != null) {
text = args.getString(KEY_TEXT);
log("onCreate: text=" + text);
} else {
log("onCreate");
}
}
public List<File> getVideoFiles(){
File directory = c.getFilesDir();
File[] files = directory.listFiles();
assert files != null;
return Arrays.asList(files);
}
}
@@ -0,0 +1,46 @@
package com.example.ueberwachungssystem.Fragments;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import com.example.ueberwachungssystem.R;
public class Fragment3 extends Fragment {
private String text;
private final static String KEY_TEXT = "KEY_TEXT" ;
private void log(String nachricht) {
Log.d(this.getClass().getSimpleName(), nachricht);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
log( "onCreateView" );
View view = inflater.inflate(R.layout.fragment2, container, false );
TextView Sensor = (TextView) view.findViewById(R.id.Sensor);
Sensor.setText(text);
return view;
}
public static Fragment3 erstellen(String text) {
Fragment3 fragment = new Fragment3();
Bundle b = new Bundle();
b.putString(KEY_TEXT, text);
fragment.setArguments(b);
return fragment;
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
Bundle args = getArguments();
if (args != null) {
text = args.getString(KEY_TEXT);
log("onCreate: text=" + text);
} else {
log("onCreate");
}
}
}
@@ -1,6 +1,5 @@
package com.example.ueberwachungssystem;
import androidx.annotation.NonNull;
import androidx.camera.core.ExperimentalGetImage;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
@@ -8,32 +7,36 @@ import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.ToggleButton;
import com.example.ueberwachungssystem.Detection.DetectionReport;
import com.example.ueberwachungssystem.Detection.Detector;
import com.example.ueberwachungssystem.Detection.VideoDetector;
import org.w3c.dom.Text;
import com.example.ueberwachungssystem.Fragments.Fragment1;
import com.example.ueberwachungssystem.Fragments.Fragment2;
@ExperimentalGetImage
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
//Fragmente
private Fragment aktuellesFragment;
private Fragment1 fragment1;
private Fragment2 fragment2;
//Textviews
private TextView Auswahl;
private TextView AoderA;
private String auswahltext = "Wahl des Detektionsmodus";
private String auswahlAoderA = "Wahl von Alarmmeldungen oder Auswahl von Alarmaufzeichnungen";
//Sensoren und Kommunikation
WifiCommunication communication;
private TextView alarm;
private String text = "Das ist ein Alarm des Sensors";
//Buttons
private ToggleButton toggleKamera;
private ToggleButton btnAudio;
private ToggleButton btnBewegung;
//Detektoren
VideoDetector vd = new VideoDetector(this);
private ToggleButton toggleAudio;
private ToggleButton toggleBewegung;
//Überprüfungswerte
boolean wahr;
private void log(String nachricht) {
Log.d(this.getClass().getSimpleName(), nachricht);
}
@@ -43,32 +46,42 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
super.onCreate(savedInstanceState);
setTitle(this.getClass().getSimpleName());
setContentView(R.layout.activity_main);
alarm = findViewById(R.id.Alarm);
alarm.setText(text);
Auswahl = findViewById(R.id.textAuswahl);
Auswahl.setText(auswahltext);
AoderA = findViewById(R.id.textAoderA);
AoderA.setText(auswahlAoderA);
toggleKamera = findViewById(R.id.toggleKamera);
toggleKamera.setOnClickListener(this);
vd.setOnDetectionListener(new Detector.OnDetectionListener() {
@Override
public void onDetection(@NonNull DetectionReport detectionReport) {
DetectionReport dr = detectionReport;
String drString = dr.toString();
}
});
//boolean isRunning = vd.isRunning();
toggleAudio = findViewById(R.id.toggleAudio);
toggleAudio.setOnClickListener(this);
toggleBewegung = findViewById(R.id.toggleBewegung);
toggleBewegung.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if (v == toggleKamera) {
if (toggleKamera.isChecked()) {
vd.startDetection();
wahr = true;
} else {
vd.stopDetection();
wahr = false;
}
}
if (v == toggleAudio) {
if (toggleAudio.isChecked()) {
wahr = true;
} else {
wahr = false;
}
}
if (v == toggleBewegung) {
if (toggleBewegung.isChecked()) {
wahr = true;
} else {
wahr = false;
}
}
}
@Override
protected void onPause() {
super.onPause();
@@ -78,24 +91,19 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
@Override
protected void onResume() {
super.onResume();
communication = new WifiCommunication(MainActivity.this, 1234);
communication = new WifiCommunication(1234);
}
public void onClickZeigeFragment1(View view) {
Button button = (Button) view;
log(button.getText() + " ausgewählt");
zeigeFragment(Fragment1.erstellen("Fragment 1 wurde angeklickt"));
zeigeFragment(fragment1.erstellen("Hier stehen dann die Alarme"));
}
public void onClickZeigeFragment2(View view) {
Button button = (Button) view;
log(button.getText() + " ausgewählt");
zeigeFragment(Fragment2.erstellen("Fragment 2 wurde angeklickt"));
}
public void onClickZeigeFragment3(View view) {
Button button = (Button) view;
log(button.getText() + " ausgewählt");
zeigeFragment(Fragment3.erstellen("Fragment 3 wurde angeklickt"));
zeigeFragment(fragment2.erstellen("Hier stehen dann die Videos"));
}
public void onClickEntferneFragment(View view) {
@@ -115,106 +123,4 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
aktuellesFragment = null ;
}
}
public static class Fragment1 extends Fragment {
private String text;
private final static String KEY_TEXT = "KEY_TEXT";
private void log(String nachricht) {
Log.d(this.getClass().getSimpleName(), nachricht);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
log("onCreateView");
View view = inflater.inflate(R.layout.fragment1, container, false);
TextView Sensor = (TextView) view.findViewById(R.id.Sensor);
Sensor.setText(text);
return view;
}
public static Fragment1 erstellen(String text) {
Fragment1 fragment = new Fragment1();
Bundle b = new Bundle();
b.putString(KEY_TEXT, text);
fragment.setArguments(b);
return fragment;
}
@Override
public void onCreate(Bundle bundle) {
super .onCreate(bundle);
Bundle args = getArguments();
if (args != null ) {
text = args.getString(KEY_TEXT);
log("onCreate: text=" + text);
} else {
log("onCreate");
}
}
}
public static class Fragment2 extends Fragment {
private String text;
private final static String KEY_TEXT = "KEY_TEXT" ;
private void log(String nachricht) {
Log.d(this.getClass().getSimpleName(), nachricht);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
log( "onCreateView" );
View view = inflater.inflate(R.layout.fragment2, container, false );
TextView Sensor = (TextView) view.findViewById(R.id.Sensor);
Sensor.setText(text);
return view;
}
public static Fragment2 erstellen(String text) {
Fragment2 fragment = new Fragment2();
Bundle b = new Bundle();
b.putString(KEY_TEXT, text);
fragment.setArguments(b);
return fragment;
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
Bundle args = getArguments();
if (args != null) {
text = args.getString(KEY_TEXT);
log("onCreate: text=" + text);
} else {
log("onCreate");
}
}
}
public static class Fragment3 extends Fragment {
private String text;
private final static String KEY_TEXT = "KEY_TEXT" ;
private void log(String nachricht) {
Log.d(this.getClass().getSimpleName(), nachricht);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
log( "onCreateView" );
View view = inflater.inflate(R.layout.fragment2, container, false );
TextView Sensor = (TextView) view.findViewById(R.id.Sensor);
Sensor.setText(text);
return view;
}
public static Fragment3 erstellen(String text) {
Fragment3 fragment = new Fragment3();
Bundle b = new Bundle();
b.putString(KEY_TEXT, text);
fragment.setArguments(b);
return fragment;
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
Bundle args = getArguments();
if (args != null) {
text = args.getString(KEY_TEXT);
log("onCreate: text=" + text);
} else {
log("onCreate");
}
}
}
}
@@ -0,0 +1,31 @@
package com.example.ueberwachungssystem;
import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import java.io.File;
import java.util.List;
public class MeinAdapter extends ArrayAdapter<File> {
private Context context;
private File[] files;
public MeinAdapter(Context context, List<File> listf) {
super(context, android.R.layout.simple_list_item_1, listf);
this.context = context;
}
@Override
public View getView(final int pos, View cv, ViewGroup vg) {
View v = super.getView(pos, cv, vg);
v.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d("DerLog","nicht null");
}
});
return v;
}
}
@@ -0,0 +1,43 @@
package com.example.ueberwachungssystem;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.widget.Toast;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
public class PermissionHandler {
private final Context context;
private static final int PERMISSION_REQUEST_CODE = 23409;
private static final String[] permissions = new String[]{
android.Manifest.permission.CAMERA,
android.Manifest.permission.RECORD_AUDIO
};
public PermissionHandler(Context context) {
this.context = context;
}
public boolean hasPermissions() {
boolean permissionState = true;
for (String permission: permissions) {
permissionState = permissionState && ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED;
}
return permissionState;
}
public void getPermissions() {
if (!hasPermissions())
ActivityCompat.requestPermissions((Activity) context, permissions, PERMISSION_REQUEST_CODE);
}
public void showPermissionToast() {
if (hasPermissions())
Toast.makeText(context, "permissions available", Toast.LENGTH_SHORT).show();
else
Toast.makeText(context, "permissions missing", Toast.LENGTH_SHORT).show();
}
}
@@ -0,0 +1,48 @@
package com.example.ueberwachungssystem;
import static android.Manifest.permission.INTERNET;
import static android.Manifest.permission.CAMERA;
import static android.Manifest.permission.RECORD_AUDIO;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
public class PermissionRequest extends AppCompatActivity{
private static final int PERMISSION_REQUEST_CODE = 123;
private final MainActivity mainActivity;
Handler handler = new Handler();
public PermissionRequest(MainActivity mainActivity) {
this.mainActivity = mainActivity;
}
public StringBuilder rechtePruefen() {
boolean rechtKamera = ContextCompat.checkSelfPermission(mainActivity, CAMERA) == PackageManager.PERMISSION_GRANTED;
boolean rechtMikrofon = ContextCompat.checkSelfPermission(mainActivity, RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED;
boolean rechtInternet = ContextCompat.checkSelfPermission(mainActivity, INTERNET) == PackageManager.PERMISSION_GRANTED;
StringBuilder sb = new StringBuilder();
sb.append("Rechte prüfen:")
.append("\nKamera: ").append(rechtKamera)
.append("\nMikrofon: ").append(rechtMikrofon)
.append("\nInternet: ").append(rechtInternet);
//mainActivity.runOnUiThread(() -> mainActivity.tvMessages.setText(sb));
if (!(rechtKamera && rechtMikrofon && rechtInternet)){
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(mainActivity.getApplicationContext(),"Es werden Rechte benötigt", Toast.LENGTH_LONG).show();
}
});
}
return sb;
}
public void rechteAnfordern() {
mainActivity.requestPermissions(new String[]{CAMERA, RECORD_AUDIO, INTERNET}, PERMISSION_REQUEST_CODE);
}
}
@@ -0,0 +1,86 @@
package com.example.ueberwachungssystem;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
public class PopUpClass {
private final MainActivity mainActivity;
PermissionRequest permission;
TextView PopUpText;
public PopUpClass(MainActivity mainActivity) {
this.mainActivity = mainActivity;
permission = new PermissionRequest(mainActivity);
}
//PopupWindow display method
public void showPopupWindow(final View view) {
//Create a View object yourself through inflater
LayoutInflater inflater = (LayoutInflater) view.getContext().getSystemService(view.getContext().LAYOUT_INFLATER_SERVICE);
View popupView = inflater.inflate(R.layout.popup_window, null);
//Specify the length and width through constants
int width = LinearLayout.LayoutParams.WRAP_CONTENT;
int height = LinearLayout.LayoutParams.WRAP_CONTENT;
//Make Inactive Items Outside Of PopupWindow
boolean focusable = true;
//Create a window with our parameters
final PopupWindow popupWindow = new PopupWindow(popupView,width*1, height*1, focusable);
//Set the location of the window on the screen
popupWindow.showAtLocation(view, Gravity.CENTER, 0, 0);
//Initialize the elements of our window, install the handler
PopUpText = popupView.findViewById(R.id.titleText);
Button buttonEdit = popupView.findViewById(R.id.RechteAnfordern);
buttonEdit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RechteAnfordern();
}
});
//Handler for clicking on the inactive zone of the window
popupView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
//Close the window when clicked
popupWindow.dismiss();
return true;
}
});
}
public void RechtePrüfen(){
StringBuilder Text = permission.rechtePruefen();
PopUpText.setText(Text);
}
public void RechteAnfordern(){
permission.rechteAnfordern();
StringBuilder Text = permission.rechtePruefen();
PopUpText.setText(Text);
}
public void Sensoren(){
PopUpText.setText("Es können 3 verschiedene Sensoren verwendet werden \n -1. Beschleunigungssensor\n -2. Mikrofon\n -3. Kamera");
}
public void Impressum(){
PopUpText.setText("Die Ueberwachungsapp wurde im Rahmen eines Praktikums der TH-Nürnberg programmiert");
}
}
@@ -0,0 +1,36 @@
package com.example.ueberwachungssystem;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.io.File;
import java.util.List;
public class VideoListAdapter extends ArrayAdapter<File> {
public VideoListAdapter(Context context, List<File> videoList) {
super(context, 0, videoList);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_item_video, parent, false);
}
File videoFile = getItem(position);
ImageView thumbnailImageView = convertView.findViewById(R.id.imageViewThumbnail);
TextView titleTextView = convertView.findViewById(R.id.textViewTitle);
// Set tag to identify the clicked item
convertView.setTag(videoFile.getAbsolutePath());
return convertView;
    }
}
@@ -1,6 +1,8 @@
package com.example.ueberwachungssystem;
import android.annotation.SuppressLint;
import androidx.annotation.NonNull;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
@@ -14,7 +16,7 @@ import java.util.Date;
import java.util.Enumeration;
public class WifiCommunication {
private final MainActivity mainActivity;
//private final MainActivity mainActivity;
private final InetAddress address;
private final int port;
@@ -22,9 +24,11 @@ public class WifiCommunication {
volatile private boolean send;
private final DatagramSocket socket;
volatile private boolean running;
private OnConnectionListener listener;
@SuppressLint("SetTextI18n")
public WifiCommunication(MainActivity mainActivity, int port) {
this.mainActivity = mainActivity;
public WifiCommunication(int port) {
//this.mainActivity = mainActivity;
this.port = port;
try {
socket = new DatagramSocket(this.port);
@@ -37,8 +41,23 @@ public class WifiCommunication {
} catch (SocketException | UnknownHostException e) {
throw new RuntimeException(e);
}
//Toast.makeText(mainActivity.getApplicationContext(),"Communication running", Toast.LENGTH_SHORT).show();
//mainActivity.runOnUiThread(() -> mainActivity.tvMessages.setText("Communication running"));
}
public interface OnConnectionListener {
void onConnection(StringBuffer data);
}
public void setOnConnectionListener(@NonNull OnConnectionListener listener) {
this.listener = listener;
}
public void sendWifiData(StringBuffer wifiMessage) {
if (listener != null) {
listener.onConnection(wifiMessage);
}
}
private class ReceiveThread extends Thread {
private StringBuffer rxStringBuffer = new StringBuffer();
private String rxString="";
@@ -49,20 +68,16 @@ public class WifiCommunication {
try {
do {
byte[] receiveData = new byte[512];
InetAddress fromAdress;
int fromPort;
DatagramPacket rxPacket = new DatagramPacket(receiveData, receiveData.length);
socket.receive(rxPacket);
fromAdress = rxPacket.getAddress();
fromPort = rxPacket.getPort();
rxString = new String(rxPacket.getData());
if(!previousRxString.equals(rxString)) {
rxString = new String(receiveData, 0, rxPacket.getLength());
String[] splitrxString = rxString.split(",");
if(!previousRxString.equals(rxString) && splitrxString[0].equals("1") && splitrxString.length==7) {
rxStringBuffer.append(rxString).append("\n");
sendWifiData(rxStringBuffer);
//mainActivity.runOnUiThread(() -> mainActivity.tvMessages.setText(rxStringBuffer));
previousRxString = rxString;
}
} while (running);
}
catch (IOException e) {
@@ -83,18 +98,13 @@ public class WifiCommunication {
Date curDate = new Date(System.currentTimeMillis());
String str = formatter.format(curDate);
byte[] send_Data = new byte[512];
String txString = (str+ ",Gruppe2," + getLocalIpAddress() + ",An,Video," +messageToSend);
String txString = ("1," +str+ ",Gruppe2," + getLocalIpAddress() + ",An,Video," +messageToSend);
send_Data = txString.getBytes();
DatagramPacket txPacket = new DatagramPacket(send_Data, txString.length(), address, port);
for(int i = 0; i < 500; i++) {
for(int i = 0; i < 300; i++) {
socket.send(txPacket);
/*try{
sleep(10);
}catch (InterruptedException e){
e.printStackTrace();
}*/
}
}
} while (running);
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false" android:drawable="@color/redbright" />
<item android:state_checked="true" android:drawable="@color/greenbright" />
</selector>
+70 -64
View File
@@ -3,121 +3,127 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/holo_green_dark"
android:background="#010C49"
android:visibility="visible"
tools:context="com.example.ueberwachungssystem.MainActivity"
tools:visibility="visible">
<TextView
android:id="@+id/textAuswahl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:textSize="20sp"
android:textColor="@color/white"/>
<TextView
android:id="@+id/textAoderA"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/toggleAudio"
android:layout_alignParentLeft="true"
android:layout_marginTop="15dp"
android:textSize="20sp"
android:textColor="@color/white"/>
<ToggleButton
android:id="@+id/toggleKamera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/toggleAudio"
android:layout_marginRight="15dp"
android:layout_toStartOf="@+id/toggleAudio"
android:layout_marginRight="30dp"
android:layout_toLeftOf="@id/toggleAudio"
android:text="Kamera" />
android:textColor="@color/yellow"
android:textOn="Kamera an"
android:textOff="Kamera aus"
android:background="@drawable/toggle_btn"/>
<ToggleButton
android:id="@+id/toggleAudio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_below="@id/textAuswahl"
android:layout_centerHorizontal="true"
android:text="Audio" />
android:layout_marginTop="5dp"
android:textColor="@color/yellow"
android:textOn="Audio an"
android:textOff="Audio aus"
android:background="@drawable/toggle_btn"/>
<ToggleButton
android:id="@+id/toggleBewegung"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/toggleAudio"
android:layout_marginLeft="15dp"
android:layout_marginLeft="30dp"
android:layout_toEndOf="@+id/toggleAudio"
android:layout_toRightOf="@id/toggleAudio"
android:text="Bewegung" />
android:textColor="@color/yellow"
android:textOn="Bewegung an"
android:textOff="Bewegung aus"
android:background="@drawable/toggle_btn"/>
<Button
android:id="@+id/btnAudio"
android:id="@+id/btnAlarme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/btnKamera"
android:layout_alignBottom="@+id/btnAufnahmen"
android:layout_toLeftOf="@id/btnAufnahmen"
android:layout_marginRight="15dp"
android:layout_toStartOf="@+id/btnKamera"
android:theme="@style/Button.Green"
android:onClick="onClickZeigeFragment1"
android:text="Audio" />
android:text="Alarme" />
<Button
android:id="@+id/btnKamera"
android:id="@+id/btnAufnahmen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/toggleAudio"
android:layout_below="@+id/textAoderA"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:theme="@style/Button.Green"
android:onClick="onClickZeigeFragment2"
android:text="Kamera" />
android:text="Aufnahmen" />
<!--
<Button
android:id="@+id/btnSensorWeg"
android:id="@+id/btnAnzeigeVerb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@+id/btn1"
android:text="Entferne Sensordarstellung"
android:layout_alignBottom="@+id/btnAufnahmen"
android:layout_toRightOf="@id/btnAufnahmen"
android:layout_marginLeft="15dp"
android:text="Anzeige verbergen"
android:onClick="onClickEntferneFragment"/>
-->
<Button
android:id="@+id/btnBewegung"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/btnKamera"
android:layout_marginLeft="15dp"
android:layout_toEndOf="@+id/btnKamera"
android:layout_toRightOf="@id/btnKamera"
android:onClick="onClickZeigeFragment3"
android:text="Bewegung" />
<Button
android:id="@+id/btnAufnahme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/btnKamera"
android:layout_toLeftOf="@id/btnKamera"
android:layout_marginRight="15dp"
android:onClick="onClickEntferneFragment"
android:text="Aufnahme" />
<Button
android:id="@+id/btnWiedergabe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/btnKamera"
android:layout_toRightOf="@id/btnKamera"
android:layout_marginLeft="15dp"
android:onClick="onClickEntferneFragment"
android:text="Wiedergabe" />
<FrameLayout
android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_below="@+id/btnAufnahme"
android:layout_alignParentStart="true">
android:layout_height="match_parent"
android:layout_below="@+id/btnAufnahmen"
android:layout_marginTop="25dp"
android:layout_alignParentStart="true"
android:background="@color/white">
</FrameLayout>
<!--
<ScrollView
android:id= "@+id/scrollView1"
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:layout_below= "@id/frame">
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/btnAufnahmen"
android:layout_marginTop="25dp">
<LinearLayout
android:layout_width= "match_parent"
android:layout_height= "match_parent"
android:orientation= "vertical" >
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id= "@+id/Alarm"
android:layout_width= "wrap_content"
android:layout_height= "wrap_content" />
android:id="@+id/Alarm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/red"/>
</LinearLayout>
</ScrollView>
-->
</RelativeLayout>
+17 -13
View File
@@ -4,19 +4,23 @@
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:background="@android:color/holo_green_light">
android:background="@color/bluedark">
<TextView
android:id="@+id/Sensor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@+id/Alarm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/Sensor"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="25dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/Alarm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/yellow"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
+19 -8
View File
@@ -6,17 +6,28 @@
android:orientation="vertical"
android:background="@android:color/holo_blue_light" >
<TextView
android:id="@+id/Sensor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<ScrollView
android:id="@+id/scrollView2"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_marginTop="25dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/Aufzeichnungen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/yellow"/>
</LinearLayout>
</ScrollView>
<TextView
android:id="@+id/Alarm"
<VideoView
android:id="@+id/AusAuf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/Sensor"
android:layout_below="@id/scrollView2"
android:textAppearance="?android:attr/textAppearanceLarge"/>
</LinearLayout>
+29
View File
@@ -0,0 +1,29 @@
<?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"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:gravity="center"
android:background="#A5ACB2">
<TextView
android:id="@+id/titleText"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textStyle="italic"
android:padding="10dp"/>
<Button
android:id="@+id/RechteAnfordern"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Rechte Anfordern" />
</LinearLayout>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/Rechteverwaltung"
android:title="Rechteverwaltung" />
<item android:id="@+id/Sensoren"
android:title="Sensoren" />
<item android:id="@+id/Impressum"
android:title="Impressum" />
</menu>
+5
View File
@@ -7,4 +7,9 @@
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="red">#5C0000</color>
<color name="redbright">#EF3434</color>
<color name="greenbright">#469733</color>
<color name="bluedark">#053C8E</color>
<color name="yellow">#FFEB3B</color>
</resources>
+5
View File
@@ -13,4 +13,9 @@
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<style name="Button.Green" parent="ThemeOverlay.AppCompat">
<item name="colorAccent">#0F3E01</item>
</style>
</resources>
+2 -2
View File
@@ -1,5 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '7.4.2' apply false
id 'com.android.application' version '8.0.0' apply false
id 'com.android.library' version '8.0.0' apply false
}
+3 -1
View File
@@ -18,4 +18,6 @@ android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
+1 -1
View File
@@ -1,6 +1,6 @@
#Thu May 11 15:19:24 CEST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
+1
View File
@@ -14,3 +14,4 @@ dependencyResolutionManagement {
}
rootProject.name = "Ueberwachungssystem"
include ':app'
include ':app'