From 0948d7f44f036cb9b99950ccf8b3984579cd7501 Mon Sep 17 00:00:00 2001 From: kleineckeol72024 Date: Wed, 21 Jun 2023 19:36:20 +0200 Subject: [PATCH] - added audio and motion detection again --- .../ueberwachungssystem/MainActivity.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java b/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java index 79f70b6..bc30c98 100644 --- a/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java +++ b/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java @@ -78,7 +78,9 @@ public class MainActivity extends AppCompatActivity { detectorService.videoDetector.startDetection(); } } else { - detectorService.videoDetector.stopDetection(); + if(detectorService != null) { + detectorService.videoDetector.stopDetection(); + } } } }); @@ -86,9 +88,13 @@ public class MainActivity extends AppCompatActivity { @Override public void onClick(View v) { if (toggleAudio.isChecked()) { - + if(detectorService != null) { + detectorService.audioDetector.startDetection(); + } } else { - + if(detectorService != null) { + detectorService.audioDetector.stopDetection(); + } } } }); @@ -96,9 +102,13 @@ public class MainActivity extends AppCompatActivity { @Override public void onClick(View v) { if (toggleBewegung.isChecked()) { - + if(detectorService != null) { + detectorService.motionDetector.startDetection(); + } } else { - + if(detectorService != null) { + detectorService.motionDetector.stopDetection(); + } } } });