mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-06 07:24:49 +00:00
Move usage of LocalInspectionMode.current into the deeper block.
This commit is contained in:
+12
-12
@@ -48,15 +48,6 @@ fun QrCodeCameraView(
|
||||
isScanning: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
if (LocalInspectionMode.current) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.background(color = ElementTheme.colors.bgSubtlePrimary),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Text("CameraView")
|
||||
}
|
||||
} else {
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
val localContext = LocalContext.current
|
||||
val lifecycleOwner = LocalLifecycleOwner.current
|
||||
@@ -90,7 +81,7 @@ fun QrCodeCameraView(
|
||||
lifecycleOwner,
|
||||
cameraSelector,
|
||||
previewUseCase,
|
||||
imageAnalysis
|
||||
imageAnalysis,
|
||||
)
|
||||
lastFrame = null
|
||||
} catch (e: Exception) {
|
||||
@@ -120,6 +111,15 @@ fun QrCodeCameraView(
|
||||
}
|
||||
|
||||
Box(modifier.clipToBounds()) {
|
||||
if (LocalInspectionMode.current) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.background(color = ElementTheme.colors.bgSubtlePrimary),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Text("CameraView")
|
||||
}
|
||||
} else {
|
||||
AndroidView(
|
||||
factory = { context ->
|
||||
val previewView = PreviewView(context)
|
||||
@@ -145,11 +145,11 @@ fun QrCodeCameraView(
|
||||
cameraProvider = null
|
||||
},
|
||||
)
|
||||
}
|
||||
lastFrame?.let {
|
||||
Image(bitmap = it.asImageBitmap(), contentDescription = null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun Context.getCameraProvider(): ProcessCameraProvider =
|
||||
@@ -159,7 +159,7 @@ private suspend fun Context.getCameraProvider(): ProcessCameraProvider =
|
||||
{
|
||||
continuation.resume(cameraProvider.get())
|
||||
},
|
||||
ContextCompat.getMainExecutor(this)
|
||||
ContextCompat.getMainExecutor(this),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user