From 4185cb5200a603c946422eb2f157cce28bf4d253 Mon Sep 17 00:00:00 2001 From: Bastian Kohler Date: Mon, 19 Jun 2023 14:34:07 +0200 Subject: [PATCH] Proper display of Toasts in Audio Recorder --- .../ueberwachungssystem/Detection/AudioRecorder.java | 2 ++ .../ueberwachungssystem/Detection/VideoDetector.java | 4 ++-- .../java/com/example/ueberwachungssystem/MainActivity.java | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/example/ueberwachungssystem/Detection/AudioRecorder.java b/app/src/main/java/com/example/ueberwachungssystem/Detection/AudioRecorder.java index e794c72..aa16846 100644 --- a/app/src/main/java/com/example/ueberwachungssystem/Detection/AudioRecorder.java +++ b/app/src/main/java/com/example/ueberwachungssystem/Detection/AudioRecorder.java @@ -3,6 +3,7 @@ package com.example.ueberwachungssystem.Detection; import android.content.Context; import android.media.MediaPlayer; import android.media.MediaRecorder; +import android.widget.Toast; import java.io.File; import java.io.IOException; @@ -50,6 +51,7 @@ public class AudioRecorder { mediaRecorder.release(); mediaRecorder = null; isRecording = false; + Toast.makeText(context, "audio recording saved", Toast.LENGTH_SHORT).show(); } } diff --git a/app/src/main/java/com/example/ueberwachungssystem/Detection/VideoDetector.java b/app/src/main/java/com/example/ueberwachungssystem/Detection/VideoDetector.java index fc339cf..ec7350f 100644 --- a/app/src/main/java/com/example/ueberwachungssystem/Detection/VideoDetector.java +++ b/app/src/main/java/com/example/ueberwachungssystem/Detection/VideoDetector.java @@ -170,12 +170,12 @@ public class VideoDetector extends Detector { @Override public void onVideoSaved(@NonNull VideoCapture.OutputFileResults outputFileResults) { isRecording = false; - Toast.makeText(context, "recording saved", Toast.LENGTH_SHORT).show(); + Toast.makeText(context, "video recording saved", Toast.LENGTH_SHORT).show(); } @Override public void onError(int videoCaptureError, @NonNull String message, @Nullable Throwable cause) { isRecording = false; - Toast.makeText(context, "recording failed", Toast.LENGTH_SHORT).show(); + Toast.makeText(context, "video recording failed", Toast.LENGTH_SHORT).show(); } } ); diff --git a/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java b/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java index b45baa7..8487e19 100644 --- a/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java +++ b/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java @@ -54,13 +54,13 @@ public class MainActivity extends AppCompatActivity { { //vd.startDetection(); //vd.stopDetection(); - //vd.startRecording(); - //audioRecorder.startRecording(); + vd.startRecording(); + audioRecorder.startRecording(); } else { //vd.stopDetection(); vd.stopRecording(); - //audioRecorder.stopRecording(); + audioRecorder.stopRecording(); } } });