updates to newer version
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
<uses-permission android:name="android.permission.WRITE_CONTACTS" tools:node="remove" />
|
||||
|
||||
<application
|
||||
tools:targetApi="33"
|
||||
android:name=".CleanScannerApp"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package de.softwareapp_hb.privateqrscanner.ui.components
|
||||
package com.clean.scanner.ui.components
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.util.Size
|
||||
@@ -7,6 +7,8 @@ import android.view.ScaleGestureDetector
|
||||
import androidx.camera.core.CameraSelector
|
||||
import androidx.camera.core.ImageAnalysis
|
||||
import androidx.camera.core.Preview
|
||||
import androidx.camera.core.resolutionselector.ResolutionSelector
|
||||
import androidx.camera.core.resolutionselector.ResolutionStrategy
|
||||
import androidx.camera.core.UseCaseGroup
|
||||
import androidx.camera.lifecycle.ProcessCameraProvider
|
||||
import androidx.camera.view.PreviewView
|
||||
@@ -81,9 +83,9 @@ fun CameraPreview(
|
||||
override fun onScale(detector: ScaleGestureDetector): Boolean {
|
||||
val camera = cameraRef.value ?: return false
|
||||
val zoomState = camera.cameraInfo.zoomState.value ?: return false
|
||||
val nextZoom = zoomRatio.value * detector.scaleFactor
|
||||
val nextZoom = zoomRatio.floatValue * detector.scaleFactor
|
||||
val clampedZoom = max(zoomState.minZoomRatio, min(nextZoom, zoomState.maxZoomRatio))
|
||||
zoomRatio.value = clampedZoom
|
||||
zoomRatio.floatValue = clampedZoom
|
||||
camera.cameraControl.setZoomRatio(clampedZoom)
|
||||
return true
|
||||
}
|
||||
@@ -104,12 +106,21 @@ fun CameraPreview(
|
||||
provider.unbindAll()
|
||||
|
||||
val preview = Preview.Builder().build().apply {
|
||||
setSurfaceProvider(previewView.surfaceProvider)
|
||||
surfaceProvider = previewView.surfaceProvider
|
||||
}
|
||||
|
||||
val imageAnalysis = ImageAnalysis.Builder()
|
||||
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
|
||||
.setTargetResolution(Size(1280, 720))
|
||||
.setResolutionSelector(
|
||||
ResolutionSelector.Builder()
|
||||
.setResolutionStrategy(
|
||||
ResolutionStrategy(
|
||||
Size(1280, 720),
|
||||
ResolutionStrategy.FALLBACK_RULE_CLOSEST_HIGHER_THEN_LOWER
|
||||
)
|
||||
)
|
||||
.build()
|
||||
)
|
||||
.build().apply {
|
||||
setAnalyzer(cameraExecutor, analyzer)
|
||||
}
|
||||
@@ -134,7 +145,7 @@ fun CameraPreview(
|
||||
|
||||
onTorchAvailabilityChanged(camera.cameraInfo.hasFlashUnit())
|
||||
cameraRef.value = camera
|
||||
zoomRatio.value = camera.cameraInfo.zoomState.value?.zoomRatio ?: 1f
|
||||
zoomRatio.floatValue = camera.cameraInfo.zoomState.value?.zoomRatio ?: 1f
|
||||
}
|
||||
|
||||
LaunchedEffect(torchEnabled) {
|
||||
|
||||
@@ -79,7 +79,7 @@ import de.softwareapp_hb.privateqrscanner.domain.ScanResult
|
||||
import de.softwareapp_hb.privateqrscanner.ui.BatchScanRecord
|
||||
import de.softwareapp_hb.privateqrscanner.ui.EventTicketScanDecision
|
||||
import de.softwareapp_hb.privateqrscanner.ui.UseCaseView
|
||||
import de.softwareapp_hb.privateqrscanner.ui.components.CameraPreview
|
||||
import com.clean.scanner.ui.components.CameraPreview
|
||||
import de.softwareapp_hb.privateqrscanner.ui.capabilities
|
||||
import de.softwareapp_hb.privateqrscanner.util.ClipboardUtil
|
||||
import de.softwareapp_hb.privateqrscanner.util.Intents
|
||||
|
||||
Reference in New Issue
Block a user