Browse Source

Refactored in Main

pull/4/head
Bastian Kohler 1 year ago
parent
commit
6100d17bd2

+ 4
- 9
app/src/main/java/com/example/ueberwachungssystem/MainActivity.java View File

public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {


private static final int CAMERA_PERMISSION_REQUEST_CODE = 101; 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 @Override
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); 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); VideoDetector vd = new VideoDetector(this);
vd.setPreviewView(previewView); vd.setPreviewView(previewView);
vd.setOnDetectionListener(new VideoDetector.OnDetectionListener() { vd.setOnDetectionListener(new VideoDetector.OnDetectionListener() {
@Override @Override
public void onDetection(DetectionReport detectionReport) {
public void onDetection(@NonNull DetectionReport detectionReport) {
detectionReport.log("OnDetection"); detectionReport.log("OnDetection");
textView.setText(detectionReport.toString()); textView.setText(detectionReport.toString());
} }
//vd.startDetection(); //vd.startDetection();




ToggleButton toggleButton = findViewById(R.id.previewButton);
toggleButton.setOnClickListener(new View.OnClickListener() { toggleButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {

Loading…
Cancel
Save