WIP: try them together

This commit is contained in:
Bastian Kohler 2023-06-17 10:05:54 +02:00
parent f14b9592d8
commit 0ee16abf99
3 changed files with 39 additions and 7 deletions

View File

@ -37,6 +37,8 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'com.jjoe64:graphview:4.2.2'
// Required for CameraX
def camerax_version = "1.2.3"
implementation "androidx.camera:camera-core:${camerax_version}"

View File

@ -12,13 +12,15 @@ import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ToggleButton;
import android.widget.VideoView;
import com.example.ueberwachungssystem.Detection.DetectionReport;
import com.example.ueberwachungssystem.Detection.Detector;
import com.example.ueberwachungssystem.logger.Logger;
import com.jjoe64.graphview.GraphView;
import com.example.ueberwachungssystem.Detection.VideoDetector;
import java.io.File;
@ -41,8 +43,27 @@ public class MainActivity extends AppCompatActivity {
File directory = getFilesDir();
TextView tv_log = (TextView) findViewById(R.id.tv_log); //Set textview for showing logged content
//Logger logger = new Logger(this.getClass().getSimpleName(), tv_log, "");
//logger.log(this.getClass().getSimpleName() + ".onCreate");
//GraphView graph = new GraphView(this);
AudioRecorder ar = new AudioRecorder(this);
VideoDetector vd = new VideoDetector(this);
vd.setPreviewView(previewView);
vd.setOnDetectionListener(new com.example.ueberwachungssystem.Detection.Detector.OnDetectionListener() {
@Override
public void onDetection(@NonNull com.example.ueberwachungssystem.Detection.DetectionReport detectionReport) {
Log.d("videoDetection", detectionReport.toString());
}
});
//AudioRecorder ar = new AudioRecorder(this);
//DetectionRecorder detectionRecorder = new DetectionRecorder(this);
@ -60,14 +81,16 @@ public class MainActivity extends AppCompatActivity {
if (isRecordVideoAllowed() && toggleButton.isChecked())
{
ar.startRecording();
//ar.startRecording();
vd.startRecording();
//vd.startRecording();
//vd.playVideo(videoView);
//detectionRecorder.playVideo(videoView);
//detectionRecorder.start();
}
else {
ar.stopRecording();
vd.stopRecording();
//ar.stopRecording();
//vd.stopRecording();
//detectionRecorder.stop();
@ -80,10 +103,11 @@ public class MainActivity extends AppCompatActivity {
public void onClick(View v) {
if (toggleButton.isChecked())
{
ar.playAudio();
//ar.playAudio();
vd.playVideo(videoView);
}
else {
ar.deleteRecording();
//ar.deleteRecording();
}
}
});

View File

@ -9,6 +9,12 @@
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:id="@+id/tv_log"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"