Compare commits
28
Commits
lm
..
19d1bfe1e3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19d1bfe1e3 | ||
|
|
e9da712882 | ||
|
|
804c5aba36 | ||
|
|
c5577b125f | ||
|
|
6100d17bd2 | ||
|
|
74a291bdd6 | ||
|
|
ba6765b1fb | ||
|
|
9fce3be6a8 | ||
|
|
9892fc35bc | ||
|
|
62a528d33b | ||
|
|
37617dbd54 | ||
|
|
569bd43163 | ||
|
|
fdb0036ea6 | ||
|
|
f9797f2dca | ||
|
|
ba75c58a23 | ||
|
|
3d799ae461 | ||
|
|
2501662737 | ||
|
|
d04d166e14 | ||
|
|
1576719d10 | ||
|
|
362af75b9a | ||
|
|
bef5d03494 | ||
|
|
80ebf77eb6 | ||
|
|
c4ed247a05 | ||
|
|
323786859e | ||
|
|
354bf937b2 | ||
|
|
39bb37f5c3 | ||
|
|
b198dc2e06 | ||
|
|
d83cd3dc32 |
No files matched your search
@@ -1,3 +0,0 @@
|
|||||||
Sensor als Service einrichten, der aus Activity heraus gestartet werden kann.
|
|
||||||
Stichwort: Intent
|
|
||||||
Siehe Skript Teil 1
|
|
||||||
@@ -36,4 +36,13 @@ dependencies {
|
|||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||||
|
|
||||||
|
// Required for CameraX
|
||||||
|
def camerax_version = "1.2.2"
|
||||||
|
implementation "androidx.camera:camera-core:${camerax_version}"
|
||||||
|
implementation "androidx.camera:camera-camera2:${camerax_version}"
|
||||||
|
implementation "androidx.camera:camera-lifecycle:${camerax_version}"
|
||||||
|
implementation "androidx.camera:camera-video:${camerax_version}"
|
||||||
|
implementation "androidx.camera:camera-view:${camerax_version}"
|
||||||
|
implementation "androidx.camera:camera-extensions:${camerax_version}"
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,9 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<uses-feature android:name="android.hardware.camera"/>
|
||||||
|
<uses-permission android:name="android.permission.CAMERA"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
|||||||
@@ -1,109 +0,0 @@
|
|||||||
package com.example.ueberwachungssystem.Detection;
|
|
||||||
|
|
||||||
import static java.lang.Math.sqrt;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.hardware.Sensor;
|
|
||||||
import android.hardware.SensorEvent;
|
|
||||||
import android.hardware.SensorEventListener;
|
|
||||||
import android.hardware.SensorManager;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Accelerometer inherits some methods from abstract Detector class (more info there)
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* USE FROM MAIN ACTIVITY:
|
|
||||||
*
|
|
||||||
* Accelerometer beschleunigungssensor = new Accelerometer(this);
|
|
||||||
* onCreate:
|
|
||||||
* //Accelerometer Setup
|
|
||||||
* beschleunigungssensor = new Accelerometer(this, logger, textViewLog); //logger and textview only for debugging necessary
|
|
||||||
* beschleunigungssensor.getSensor();
|
|
||||||
*
|
|
||||||
* //Starting Detection:
|
|
||||||
* beschleunigungssensor.startDetection();
|
|
||||||
* //Stopping Detection: also recommended at onPause to avoid unnecessary battery consumption
|
|
||||||
* beschleunigungssensor.stopDetection();
|
|
||||||
*
|
|
||||||
* */
|
|
||||||
|
|
||||||
public class Accelerometer extends Detector implements SensorEventListener {
|
|
||||||
|
|
||||||
public SensorManager sensorManager;
|
|
||||||
private static final int sensorType = Sensor.TYPE_LINEAR_ACCELERATION;
|
|
||||||
private Sensor accelerometer;
|
|
||||||
private Context context;
|
|
||||||
boolean alarm = false;
|
|
||||||
//Preallocate memory for the data of each axis of the acceleration sensor
|
|
||||||
float x;
|
|
||||||
float y;
|
|
||||||
float z;
|
|
||||||
float betrag; //Betrag aller drei Achsen sqrt(x*x + y*y + z*z)
|
|
||||||
private DetectionReport detectionReport;
|
|
||||||
|
|
||||||
// In constructor pass Activity, Context and TextView from MainActivity in Accelerometer class
|
|
||||||
public Accelerometer(Context context){
|
|
||||||
super(context); //von Detektor
|
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void getSensor(){
|
|
||||||
sensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
|
|
||||||
if(sensorManager.getSensorList(sensorType).size()==0) {
|
|
||||||
accelerometer = null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
accelerometer = sensorManager.getSensorList(sensorType).get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSensorChanged(SensorEvent event) {
|
|
||||||
try {
|
|
||||||
checkAlarm(event);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void checkAlarm (SensorEvent event) throws InterruptedException {
|
|
||||||
x = event.values[0];
|
|
||||||
y = event.values[1];
|
|
||||||
z = event.values[2];
|
|
||||||
betrag = (float) sqrt(x*x + y*y + z*z);
|
|
||||||
float threshold = 1.5F;
|
|
||||||
|
|
||||||
if (!alarm) {
|
|
||||||
if (betrag > threshold) {
|
|
||||||
alarm = true;
|
|
||||||
detectionReport = new DetectionReport("Accelerometer1", "Bewegung", betrag);
|
|
||||||
reportViolation("Accelo1", "Bewegung", betrag);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (betrag < threshold) {
|
|
||||||
alarm = false;
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void startDetection() {
|
|
||||||
// entspricht void start()
|
|
||||||
//getSensor();
|
|
||||||
if (accelerometer != null) {
|
|
||||||
sensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_GAME);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stopDetection() {
|
|
||||||
// entspricht void stop()
|
|
||||||
sensorManager.unregisterListener(this, accelerometer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.example.ueberwachungssystem.Detection;
|
package com.example.ueberwachungssystem;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
+2
-3
@@ -1,6 +1,5 @@
|
|||||||
package com.example.ueberwachungssystem.Detection;
|
package com.example.ueberwachungssystem;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
|
||||||
@@ -8,7 +7,7 @@ abstract public class Detector {
|
|||||||
private OnDetectionListener listener;
|
private OnDetectionListener listener;
|
||||||
|
|
||||||
/** Constructor - takes context of current activity */
|
/** Constructor - takes context of current activity */
|
||||||
public Detector(Context context) {};
|
public Detector() {}
|
||||||
|
|
||||||
|
|
||||||
/** On Detection Listener - runs when violation is reported */
|
/** On Detection Listener - runs when violation is reported */
|
||||||
@@ -2,71 +2,85 @@ package com.example.ueberwachungssystem;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.camera.view.PreviewView;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.camera.core.ExperimentalGetImage;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.method.ScrollingMovementMethod;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
import android.widget.ToggleButton;
|
import android.widget.ToggleButton;
|
||||||
|
|
||||||
import com.example.ueberwachungssystem.Detection.Accelerometer;
|
import com.example.ueberwachungssystem.VideoDetection.VideoDetector;
|
||||||
import com.example.ueberwachungssystem.Detection.DetectionReport;
|
|
||||||
import com.example.ueberwachungssystem.Detection.Detector;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
|
@ExperimentalGetImage
|
||||||
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private static final int CAMERA_PERMISSION_REQUEST_CODE = 101;
|
||||||
|
|
||||||
private Accelerometer beschleunigungssensor;
|
|
||||||
private TextView textViewLog;
|
|
||||||
private Button button1;
|
|
||||||
ToggleButton toggleButton1;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setTitle(this.getClass().getSimpleName());
|
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
TextView textView = findViewById(R.id.textView);
|
||||||
|
PreviewView previewView = findViewById(R.id.previewView);
|
||||||
|
|
||||||
toggleButton1 = findViewById(R.id.toggleButton1); //togglebutton um Detektion zu steuern
|
|
||||||
toggleButton1.setOnClickListener(this);
|
|
||||||
|
|
||||||
//Button to clear Log while Debugging
|
VideoDetector vd = new VideoDetector(this);
|
||||||
button1 = (Button) findViewById(R.id.button1);
|
vd.setPreviewView(previewView);
|
||||||
button1.setOnClickListener(this);
|
vd.setOnDetectionListener(new VideoDetector.OnDetectionListener() {
|
||||||
|
|
||||||
//Accelerometer Setup
|
|
||||||
beschleunigungssensor = new Accelerometer(this); //logger and textview only for debugging necessary
|
|
||||||
beschleunigungssensor.getSensor();
|
|
||||||
beschleunigungssensor.setOnDetectionListener(new Detector.OnDetectionListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onDetection(@NonNull DetectionReport detectionReport) {
|
public void onDetection(@NonNull DetectionReport detectionReport) {
|
||||||
|
detectionReport.log("OnDetection");
|
||||||
|
textView.setText(detectionReport.toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
//vd.startDetection();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
ToggleButton toggleButton = findViewById(R.id.previewButton);
|
||||||
protected void onResume() {
|
toggleButton.setOnClickListener(new View.OnClickListener() {
|
||||||
super.onResume();
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
getCameraAccess();
|
||||||
|
if (isCameraAccessAllowed() && toggleButton.isChecked())
|
||||||
|
{
|
||||||
|
vd.startDetection();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vd.stopDetection();
|
||||||
|
textView.setText("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isCameraAccessAllowed() {
|
||||||
|
return ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED;
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
protected void onPause() {
|
private void getCameraAccess() {
|
||||||
super.onPause();
|
if (!isCameraAccessAllowed())
|
||||||
beschleunigungssensor.stopDetection();
|
ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.CAMERA}, CAMERA_PERMISSION_REQUEST_CODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
if(v == toggleButton1) {
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
if (toggleButton1.isChecked()) {
|
|
||||||
beschleunigungssensor.startDetection();
|
|
||||||
|
|
||||||
|
if (requestCode == CAMERA_PERMISSION_REQUEST_CODE && grantResults.length > 0) {
|
||||||
|
boolean cameraRights = grantResults[0] == PackageManager.PERMISSION_GRANTED;
|
||||||
|
if (cameraRights) {
|
||||||
|
Toast.makeText(this, "camera permission granted", Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
beschleunigungssensor.stopDetection();
|
Toast.makeText(this, "camera permission denied", Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
} else if (v == button1) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
package com.example.ueberwachungssystem.VideoDetection;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.ImageFormat;
|
||||||
|
import android.media.Image;
|
||||||
|
import android.util.Size;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.camera.core.CameraSelector;
|
||||||
|
import androidx.camera.core.ExperimentalGetImage;
|
||||||
|
import androidx.camera.core.ImageAnalysis;
|
||||||
|
import androidx.camera.core.Preview;
|
||||||
|
import androidx.camera.lifecycle.ProcessCameraProvider;
|
||||||
|
import androidx.camera.view.PreviewView;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
|
|
||||||
|
import com.example.ueberwachungssystem.Detector;
|
||||||
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
@ExperimentalGetImage
|
||||||
|
public class VideoDetector extends Detector {
|
||||||
|
|
||||||
|
// Calling Activity
|
||||||
|
private final Context context;
|
||||||
|
// Camera Provider
|
||||||
|
private ProcessCameraProvider cameraProvider;
|
||||||
|
private Boolean isDetectionRunning = false;
|
||||||
|
// Preview Camera Image
|
||||||
|
private PreviewView previewView = null;
|
||||||
|
// Detect Violation
|
||||||
|
private static final float PIXEL_THRESHOLD = 30f; // Luminosity (brightness channel of YUV_420_888)
|
||||||
|
private static final float ALARM_THRESHOLD = 1f; // Percent of pixels changed
|
||||||
|
private ByteBuffer previousBuffer = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Constructor */
|
||||||
|
public VideoDetector(Context context) {
|
||||||
|
super();
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Starts Video Detection */
|
||||||
|
@Override
|
||||||
|
public void startDetection() {
|
||||||
|
if (isDetectionRunning)
|
||||||
|
return;
|
||||||
|
// Request Camera Provider
|
||||||
|
final ListenableFuture<ProcessCameraProvider> cameraProviderFuture = ProcessCameraProvider.getInstance(context);
|
||||||
|
//Check for Camera availability
|
||||||
|
cameraProviderFuture.addListener(() -> {
|
||||||
|
try {
|
||||||
|
cameraProvider = cameraProviderFuture.get();
|
||||||
|
bindLuminosityAnalysis(cameraProvider);
|
||||||
|
isDetectionRunning = true;
|
||||||
|
previousBuffer = null;
|
||||||
|
} catch (ExecutionException | InterruptedException e) {
|
||||||
|
// No errors need to be handled for this Future. This should never be reached.
|
||||||
|
}
|
||||||
|
},ContextCompat.getMainExecutor(context));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Stops Video Detection */
|
||||||
|
@Override
|
||||||
|
public void stopDetection() {
|
||||||
|
if (!isDetectionRunning)
|
||||||
|
return;
|
||||||
|
cameraProvider.unbindAll();
|
||||||
|
isDetectionRunning = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Set PreviewView to show Image */
|
||||||
|
public void setPreviewView(PreviewView previewView) {
|
||||||
|
this.previewView = previewView;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Binds the Luminosity Analyzer (configure and run Analysis) */
|
||||||
|
private void bindLuminosityAnalysis(@NonNull ProcessCameraProvider cameraProvider) {
|
||||||
|
// Configure and create Image Analysis
|
||||||
|
ImageAnalysis.Builder builder = new ImageAnalysis.Builder();
|
||||||
|
builder.setTargetResolution(new Size(640, 480));
|
||||||
|
builder.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST);
|
||||||
|
builder.setOutputImageFormat(ImageAnalysis.OUTPUT_IMAGE_FORMAT_YUV_420_888);
|
||||||
|
ImageAnalysis imageAnalysis = builder.build();
|
||||||
|
|
||||||
|
// Set Analyzer
|
||||||
|
imageAnalysis.setAnalyzer(ContextCompat.getMainExecutor(context), imageProxy -> {
|
||||||
|
if (imageProxy.getFormat() == ImageFormat.YUV_420_888) {
|
||||||
|
Image image = imageProxy.getImage();
|
||||||
|
assert image != null;
|
||||||
|
|
||||||
|
// Changed Pixel Detection
|
||||||
|
int pixelChanged = getChangedPixelCount(image);
|
||||||
|
int width = image.getWidth();
|
||||||
|
int height = image.getHeight();
|
||||||
|
|
||||||
|
float percentPixelChanged = (float) 100f * pixelChanged / (width * height);
|
||||||
|
|
||||||
|
if (percentPixelChanged > ALARM_THRESHOLD)
|
||||||
|
reportViolation("0", "Video", percentPixelChanged);
|
||||||
|
}
|
||||||
|
imageProxy.close();
|
||||||
|
});
|
||||||
|
// Create Preview
|
||||||
|
Preview preview = new Preview.Builder().build();
|
||||||
|
// Specify which Camera to use
|
||||||
|
CameraSelector cameraSelector = new CameraSelector.Builder().requireLensFacing(CameraSelector.LENS_FACING_BACK).build();
|
||||||
|
// Update PreviewView if set
|
||||||
|
if (previewView != null)
|
||||||
|
preview.setSurfaceProvider(previewView.getSurfaceProvider());
|
||||||
|
|
||||||
|
cameraProvider.bindToLifecycle((LifecycleOwner) context, cameraSelector, imageAnalysis, preview);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Calculate Amount of Pixels changed */
|
||||||
|
private int getChangedPixelCount(Image image) {
|
||||||
|
Image.Plane[] planes = image.getPlanes();
|
||||||
|
ByteBuffer buffer = planes[0].getBuffer();
|
||||||
|
|
||||||
|
if (previousBuffer == null) {
|
||||||
|
previousBuffer = ByteBuffer.allocate(buffer.capacity());
|
||||||
|
buffer.rewind();
|
||||||
|
previousBuffer.put(buffer);
|
||||||
|
previousBuffer.rewind();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int width = image.getWidth();
|
||||||
|
int height = image.getHeight();
|
||||||
|
|
||||||
|
int yRowStride = image.getPlanes()[0].getRowStride();
|
||||||
|
int yPixelStride = image.getPlanes()[0].getPixelStride();
|
||||||
|
|
||||||
|
int changedPixelCount = 0;
|
||||||
|
|
||||||
|
// Count changed pixels
|
||||||
|
for (int y = 0; y < height; ++y) {
|
||||||
|
for (int x = 0; x < width; x++) {
|
||||||
|
int index = (y * yRowStride) + (x * yPixelStride);
|
||||||
|
int luminosity = (buffer.get(index) & 0xff);
|
||||||
|
int previousLuminosity = (previousBuffer.get(index) & 0xff);
|
||||||
|
int diff = Math.abs(luminosity - previousLuminosity);
|
||||||
|
if (diff > PIXEL_THRESHOLD)
|
||||||
|
changedPixelCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset and copy Byte Buffer
|
||||||
|
buffer.rewind();
|
||||||
|
previousBuffer.rewind();
|
||||||
|
previousBuffer.put(buffer);
|
||||||
|
|
||||||
|
return changedPixelCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,63 +1,37 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textViewLog"
|
android:id="@+id/textView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="32dp"
|
android:text=""
|
||||||
android:layout_marginTop="60dp"
|
android:textSize="20dp"
|
||||||
android:layout_marginEnd="32dp"
|
|
||||||
android:maxLines="25"
|
|
||||||
android:scrollbars="vertical"
|
|
||||||
android:text="TextViewLoggerMain"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textViewWorkerThread"
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
app:layout_constraintVertical_bias="0.0" />
|
|
||||||
|
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
android:id="@+id/toggleButton1"
|
android:id="@+id/previewButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="161dp"
|
android:text="ToggleButton" />
|
||||||
android:layout_marginTop="115dp"
|
|
||||||
android:layout_marginEnd="162dp"
|
|
||||||
android:text="ToggleButton"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textViewWorkerThread"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="32dp"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:layout_marginEnd="32dp"
|
|
||||||
android:text="textViewWorkerThreadTextView"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/toggleButton1" />
|
|
||||||
|
|
||||||
<Button
|
<androidx.camera.view.PreviewView
|
||||||
android:id="@+id/button1"
|
android:id="@+id/previewView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginStart="35dp"
|
android:backgroundTint="@android:color/black"/>
|
||||||
android:layout_marginTop="31dp"
|
|
||||||
android:layout_marginEnd="282dp"
|
|
||||||
android:layout_marginBottom="100dp"
|
|
||||||
android:text="Clear Log"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/textViewWorkerThread"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</LinearLayout>
|
||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application' version '8.0.0' apply false
|
id 'com.android.application' version '7.4.2' apply false
|
||||||
id 'com.android.library' version '8.0.0' apply false
|
id 'com.android.library' version '7.4.2' apply false
|
||||||
}
|
}
|
||||||
@@ -19,5 +19,3 @@ android.useAndroidX=true
|
|||||||
# resources declared in the library itself and none from the library's dependencies,
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
# thereby reducing the size of the R class for that library
|
# thereby reducing the size of the R class for that library
|
||||||
android.nonTransitiveRClass=true
|
android.nonTransitiveRClass=true
|
||||||
android.defaults.buildfeatures.buildconfig=true
|
|
||||||
android.nonFinalResIds=false
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
#Thu May 11 15:04:30 CEST 2023
|
#Thu May 11 15:04:30 CEST 2023
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
Reference in new issue
Block a user