|
|
@@ -5,8 +5,6 @@ import androidx.fragment.app.Fragment; |
|
|
|
import androidx.fragment.app.FragmentTransaction; |
|
|
|
import androidx.annotation.NonNull; |
|
|
|
import androidx.appcompat.app.AppCompatActivity; |
|
|
|
import androidx.camera.core.ExperimentalGetImage; |
|
|
|
import androidx.camera.view.PreviewView; |
|
|
|
|
|
|
|
import android.content.ComponentName; |
|
|
|
import android.content.Context; |
|
|
@@ -20,22 +18,15 @@ import android.view.MenuItem; |
|
|
|
import android.view.View; |
|
|
|
import android.widget.Button; |
|
|
|
import android.widget.TextView; |
|
|
|
import android.widget.ImageView; |
|
|
|
import android.widget.Toast; |
|
|
|
import android.widget.ToggleButton; |
|
|
|
|
|
|
|
import com.example.ueberwachungssystem.Fragments.Fragment1; |
|
|
|
import com.example.ueberwachungssystem.Fragments.Fragment2; |
|
|
|
import com.example.ueberwachungssystem.Detection.Accelerometer; |
|
|
|
import com.example.ueberwachungssystem.Detection.AudioRecorder; |
|
|
|
import com.example.ueberwachungssystem.Detection.DetectionReport; |
|
|
|
import com.example.ueberwachungssystem.Detection.Detector; |
|
|
|
import com.example.ueberwachungssystem.Detection.DetectorService; |
|
|
|
import com.example.ueberwachungssystem.Detection.MicrophoneDetector; |
|
|
|
import com.example.ueberwachungssystem.Detection.VideoDetector; |
|
|
|
|
|
|
|
@ExperimentalGetImage |
|
|
|
public class MainActivity extends AppCompatActivity implements View.OnClickListener { |
|
|
|
public class MainActivity extends AppCompatActivity { |
|
|
|
//Fragmente |
|
|
|
private Fragment aktuellesFragment; |
|
|
|
private Fragment1 fragment1; |
|
|
@@ -63,22 +54,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
|
|
|
AoderA = findViewById(R.id.textAoderA); |
|
|
|
AoderA.setText(auswahlAoderA); |
|
|
|
toggleKamera = findViewById(R.id.toggleKamera); |
|
|
|
toggleKamera.setOnClickListener(this); |
|
|
|
toggleAudio = findViewById(R.id.toggleAudio); |
|
|
|
toggleAudio.setOnClickListener(this); |
|
|
|
toggleBewegung = findViewById(R.id.toggleBewegung); |
|
|
|
toggleBewegung.setOnClickListener(this); |
|
|
|
|
|
|
|
} |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
if (v == toggleKamera) { |
|
|
|
if (toggleKamera.isChecked()) { |
|
|
|
vd.startDetection(); |
|
|
|
} else { |
|
|
|
vd.stopDetection(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@@ -93,34 +70,33 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
|
|
|
bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE); |
|
|
|
startService(serviceIntent); |
|
|
|
|
|
|
|
toggleButton.setOnClickListener(new View.OnClickListener() { |
|
|
|
toggleKamera.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
if (toggleButton.isChecked()) |
|
|
|
{ |
|
|
|
if (detectorService != null){ |
|
|
|
|
|
|
|
detectorService.videoDetector.startDetection(); |
|
|
|
|
|
|
|
detectorService.audioDetector.startDetection(); |
|
|
|
if (toggleKamera.isChecked()) { |
|
|
|
|
|
|
|
detectorService.motionDetector.startDetection(); |
|
|
|
} else { |
|
|
|
|
|
|
|
detectorService.audioRecorder.stopRecording(); |
|
|
|
|
|
|
|
detectorService.videoDetector.startRecording(); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
detectorService.videoDetector.stopDetection(); |
|
|
|
} |
|
|
|
}); |
|
|
|
toggleAudio.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
if (toggleAudio.isChecked()) { |
|
|
|
|
|
|
|
detectorService.audioDetector.stopDetection(); |
|
|
|
} else { |
|
|
|
|
|
|
|
detectorService.motionDetector.stopDetection(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
toggleBewegung.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
if (toggleBewegung.isChecked()) { |
|
|
|
|
|
|
|
detectorService.audioRecorder.stopRecording(); |
|
|
|
} else { |
|
|
|
|
|
|
|
detectorService.videoDetector.stopRecording(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
@@ -141,22 +117,22 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
|
|
|
switch (item.getItemId()) { |
|
|
|
case R.id.Rechteverwaltung: |
|
|
|
popUpClass = new PopUpClass(MainActivity.this); |
|
|
|
popUpClass.showPopupWindow(inputImageView); |
|
|
|
popUpClass.showPopupWindow(toggleAudio); |
|
|
|
popUpClass.RechtePrüfen(); |
|
|
|
return true; |
|
|
|
case R.id.Sensoren: |
|
|
|
popUpClass = new PopUpClass(MainActivity.this); |
|
|
|
popUpClass.showPopupWindow(inputImageView); |
|
|
|
popUpClass.showPopupWindow(toggleAudio); |
|
|
|
popUpClass.Sensoren(); |
|
|
|
return true; |
|
|
|
case R.id.Impressum: |
|
|
|
popUpClass = new PopUpClass(MainActivity.this); |
|
|
|
popUpClass.showPopupWindow(inputImageView); |
|
|
|
popUpClass.showPopupWindow(toggleAudio); |
|
|
|
popUpClass.Impressum(); |
|
|
|
return true; |
|
|
|
case R.id.Detection: |
|
|
|
popUpClass = new PopUpClass(MainActivity.this); |
|
|
|
popUpClass.showPopupWindow(inputImageView); |
|
|
|
popUpClass.showPopupWindow(toggleAudio); |
|
|
|
popUpClass.DetectionTotal(num); |
|
|
|
return true; |
|
|
|
default: |
|
|
@@ -169,7 +145,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
|
|
|
public void onServiceConnected(ComponentName name, IBinder service) { |
|
|
|
DetectorService.ServiceBinder binder = (DetectorService.ServiceBinder) service; |
|
|
|
detectorService = binder.getBoundService(); |
|
|
|
detectorService.videoDetector.debugProcessing(null, outputImageView); //inputImageView |
|
|
|
// detectorService.videoDetector.debugProcessing(null, outputImageView); //inputImageView |
|
|
|
|
|
|
|
detectorService.setOnDetectionListener(new DetectorService.OnDetectionListener() { |
|
|
|
@Override |
|
|
@@ -212,28 +188,4 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
|
|
|
aktuellesFragment = null ; |
|
|
|
} |
|
|
|
} |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
if (v == toggleKamera) { |
|
|
|
if (toggleKamera.isChecked()) { |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (v == toggleAudio) { |
|
|
|
if (toggleAudio.isChecked()) { |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (v == toggleBewegung) { |
|
|
|
if (toggleBewegung.isChecked()) { |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |