Refactored some stuff in Main
This commit is contained in:
parent
9892fc35bc
commit
9fce3be6a8
@ -21,11 +21,6 @@ import com.example.ueberwachungssystem.VideoDetection.VideoDetector;
|
|||||||
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
|
||||||
@ -33,16 +28,15 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
textView = findViewById(R.id.textView);
|
TextView textView = findViewById(R.id.textView);
|
||||||
previewView = findViewById(R.id.previewView);
|
PreviewView previewView = findViewById(R.id.previewView);
|
||||||
toggleButton = findViewById(R.id.previewButton);
|
|
||||||
|
|
||||||
|
|
||||||
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());
|
||||||
}
|
}
|
||||||
@ -50,6 +44,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
//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…
x
Reference in New Issue
Block a user