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.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'com.jjoe64:graphview:4.2.2'
// Required for CameraX // Required for CameraX
def camerax_version = "1.2.3" def camerax_version = "1.2.3"
implementation "androidx.camera:camera-core:${camerax_version}" implementation "androidx.camera:camera-core:${camerax_version}"

View File

@ -12,13 +12,15 @@ import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Switch;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import android.widget.ToggleButton; import android.widget.ToggleButton;
import android.widget.VideoView; import android.widget.VideoView;
import com.example.ueberwachungssystem.Detection.DetectionReport; import com.example.ueberwachungssystem.logger.Logger;
import com.example.ueberwachungssystem.Detection.Detector; import com.jjoe64.graphview.GraphView;
import com.example.ueberwachungssystem.Detection.VideoDetector; import com.example.ueberwachungssystem.Detection.VideoDetector;
import java.io.File; import java.io.File;
@ -41,8 +43,27 @@ public class MainActivity extends AppCompatActivity {
File directory = getFilesDir(); 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); //DetectionRecorder detectionRecorder = new DetectionRecorder(this);
@ -60,14 +81,16 @@ public class MainActivity extends AppCompatActivity {
if (isRecordVideoAllowed() && toggleButton.isChecked()) if (isRecordVideoAllowed() && toggleButton.isChecked())
{ {
ar.startRecording(); //ar.startRecording();
vd.startRecording();
//vd.startRecording(); //vd.startRecording();
//vd.playVideo(videoView); //vd.playVideo(videoView);
//detectionRecorder.playVideo(videoView); //detectionRecorder.playVideo(videoView);
//detectionRecorder.start(); //detectionRecorder.start();
} }
else { else {
ar.stopRecording(); vd.stopRecording();
//ar.stopRecording();
//vd.stopRecording(); //vd.stopRecording();
//detectionRecorder.stop(); //detectionRecorder.stop();
@ -80,10 +103,11 @@ public class MainActivity extends AppCompatActivity {
public void onClick(View v) { public void onClick(View v) {
if (toggleButton.isChecked()) if (toggleButton.isChecked())
{ {
ar.playAudio(); //ar.playAudio();
vd.playVideo(videoView);
} }
else { else {
ar.deleteRecording(); //ar.deleteRecording();
} }
} }
}); });

View File

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