diff --git a/app/src/main/java/com/example/ueberwachungssystem/Detection/DetectorService.java b/app/src/main/java/com/example/ueberwachungssystem/Detection/DetectorService.java
index 4bd3e1a..7613614 100644
--- a/app/src/main/java/com/example/ueberwachungssystem/Detection/DetectorService.java
+++ b/app/src/main/java/com/example/ueberwachungssystem/Detection/DetectorService.java
@@ -152,8 +152,6 @@ public class DetectorService extends LifecycleService {
}
-
-
public boolean checkState(String string){
Log.d("state", String.valueOf(splitString(string)[4].equals("An")));
return splitString(string)[4].equals("An");
diff --git a/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java b/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java
index f28616e..6871fca 100644
--- a/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java
+++ b/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java
@@ -34,28 +34,31 @@ public class MainActivity extends AppCompatActivity {
ImageView inputImageView;
ImageView outputImageView;
ToggleButton toggleButton;
+ int num=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
-
inputImageView = findViewById(R.id.inputImageView);
outputImageView = findViewById(R.id.outputImageView);
toggleButton = findViewById(R.id.toggleButton);
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
PermissionHandler permissionHandler = new PermissionHandler(this);
- permissionHandler.getPermissions();
+ //permissionHandler.getPermissions();
if (permissionHandler.hasPermissions()) {
-
Intent serviceIntent = new Intent(this, DetectorService.class);
bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE);
startService(serviceIntent);
-
toggleButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -63,7 +66,6 @@ public class MainActivity extends AppCompatActivity {
{
if (detectorService != null){
- detectorService.videoDetector.debugProcessing(inputImageView, outputImageView);
detectorService.videoDetector.startDetection();
detectorService.audioDetector.startDetection();
@@ -89,9 +91,11 @@ public class MainActivity extends AppCompatActivity {
}
});
}else{
- Toast.makeText(getApplicationContext(),"Bitte Zugriffsrechte gewähren",Toast.LENGTH_SHORT).show();
+ Toast.makeText(this,"Bitte Rechte geben", Toast.LENGTH_SHORT).show();
}
+
}
+
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.options_menu, menu);
return true;
@@ -115,6 +119,11 @@ public class MainActivity extends AppCompatActivity {
popUpClass.showPopupWindow(inputImageView);
popUpClass.Impressum();
return true;
+ case R.id.Detection:
+ popUpClass = new PopUpClass(MainActivity.this);
+ popUpClass.showPopupWindow(inputImageView);
+ popUpClass.DetectionTotal(num);
+ return true;
default:
return super.onOptionsItemSelected(item);
}
@@ -125,15 +134,18 @@ public class MainActivity extends AppCompatActivity {
public void onServiceConnected(ComponentName name, IBinder service) {
DetectorService.ServiceBinder binder = (DetectorService.ServiceBinder) service;
detectorService = binder.getBoundService();
+ detectorService.videoDetector.debugProcessing(null, outputImageView); //inputImageView
detectorService.setOnDetectionListener(new DetectorService.OnDetectionListener() {
@Override
public void onDetection(@NonNull StringBuffer stringBuffer) {
Log.d("onDetection", stringBuffer.toString()); //Für oli hier Textview einbauen
+ num++;
}
});
}
@Override
- public void onServiceDisconnected(ComponentName name) {}
+ public void onServiceDisconnected(ComponentName name) {
+ }
};
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/ueberwachungssystem/PermissionRequest.java b/app/src/main/java/com/example/ueberwachungssystem/PermissionRequest.java
index 6c66539..e7a56c0 100644
--- a/app/src/main/java/com/example/ueberwachungssystem/PermissionRequest.java
+++ b/app/src/main/java/com/example/ueberwachungssystem/PermissionRequest.java
@@ -35,7 +35,7 @@ public class PermissionRequest extends AppCompatActivity{
handler.post(new Runnable() {
@Override
public void run() {
- Toast.makeText(mainActivity.getApplicationContext(),"Es werden Rechte benötigt", Toast.LENGTH_LONG).show();
+ Toast.makeText(mainActivity.getApplicationContext(),"Es werden Rechte benötigt", Toast.LENGTH_SHORT).show();
}
});
}
diff --git a/app/src/main/java/com/example/ueberwachungssystem/PopUpClass.java b/app/src/main/java/com/example/ueberwachungssystem/PopUpClass.java
index 9b1990a..6ed8eb4 100644
--- a/app/src/main/java/com/example/ueberwachungssystem/PopUpClass.java
+++ b/app/src/main/java/com/example/ueberwachungssystem/PopUpClass.java
@@ -82,5 +82,7 @@ public class PopUpClass {
public void Impressum(){
PopUpText.setText("Die Ueberwachungsapp wurde im Rahmen eines Praktikums der TH-Nürnberg programmiert");
}
-
+ public void DetectionTotal(int num) {
+ PopUpText.setText("Total Detektions:" +num);
+ }
}
\ No newline at end of file
diff --git a/app/src/main/res/menu/options_menu.xml b/app/src/main/res/menu/options_menu.xml
index f2c05bf..ddb0237 100644
--- a/app/src/main/res/menu/options_menu.xml
+++ b/app/src/main/res/menu/options_menu.xml
@@ -4,6 +4,8 @@
android:title="Rechteverwaltung" />
+
\ No newline at end of file