Browse Source

Refactor

bk_video
Bastian Kohler 1 year ago
parent
commit
e01e23eccd

+ 7
- 1
app/src/main/java/com/example/ueberwachungssystem/Detection/DetectorService.java View File

@@ -14,7 +14,6 @@ import java.io.File;

@ExperimentalGetImage
public class DetectorService extends LifecycleService {

public ServiceBinder serviceBinder = new ServiceBinder();
private DetectorService.OnDetectionListener listener;
private boolean isServiceRunning = false;
@@ -27,6 +26,9 @@ public class DetectorService extends LifecycleService {
public int onStartCommand(Intent intent, int flags, int startId) {
if (isServiceRunning)
return START_NOT_STICKY;


// Setup Service classes:
videoDetector = new VideoDetector(this);
videoDetector.setOnDetectionListener(new Detector.OnDetectionListener() {
@Override
@@ -34,7 +36,11 @@ public class DetectorService extends LifecycleService {
passToServiceListener(detectionReport);
}
});

audioRecorder = new AudioRecorder(this);



isServiceRunning = true;
return super.onStartCommand(intent, flags, startId);
}

+ 0
- 1
app/src/main/java/com/example/ueberwachungssystem/Detection/VideoDetector.java View File

@@ -2,7 +2,6 @@ package com.example.ueberwachungssystem.Detection;

import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.ImageFormat;

+ 8
- 0
app/src/main/java/com/example/ueberwachungssystem/PermissionHandler.java View File

@@ -4,6 +4,7 @@ package com.example.ueberwachungssystem;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.widget.Toast;

import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
@@ -32,4 +33,11 @@ public class PermissionHandler {
if (!hasPermissions())
ActivityCompat.requestPermissions((Activity) context, permissions, PERMISSION_REQUEST_CODE);
}

public void showPermissionToast() {
if (hasPermissions())
Toast.makeText(context, "permissions available", Toast.LENGTH_SHORT).show();
else
Toast.makeText(context, "permissions missing", Toast.LENGTH_SHORT).show();
}
}

Loading…
Cancel
Save