Refactored in Main

This commit is contained in:
Bastian Kohler 2023-05-28 22:19:30 +02:00
parent 9892fc35bc
commit 6100d17bd2

View File

@ -21,11 +21,6 @@ import com.example.ueberwachungssystem.VideoDetection.VideoDetector;
public class MainActivity extends AppCompatActivity {
private static final int CAMERA_PERMISSION_REQUEST_CODE = 101;
private PreviewView previewView;
private TextView textView;
private ToggleButton toggleButton;
private Boolean cameraPreviewIsRunning = false;
private Boolean isPressed = false;
@Override
@ -33,16 +28,15 @@ public class MainActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = findViewById(R.id.textView);
previewView = findViewById(R.id.previewView);
toggleButton = findViewById(R.id.previewButton);
TextView textView = findViewById(R.id.textView);
PreviewView previewView = findViewById(R.id.previewView);
VideoDetector vd = new VideoDetector(this);
vd.setPreviewView(previewView);
vd.setOnDetectionListener(new VideoDetector.OnDetectionListener() {
@Override
public void onDetection(DetectionReport detectionReport) {
public void onDetection(@NonNull DetectionReport detectionReport) {
detectionReport.log("OnDetection");
textView.setText(detectionReport.toString());
}
@ -50,6 +44,7 @@ public class MainActivity extends AppCompatActivity {
//vd.startDetection();
ToggleButton toggleButton = findViewById(R.id.previewButton);
toggleButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {