Skip to content

Commit cb70d02

Browse files
committed
fix: preview toggle consistency between modes
1 parent 1286d0f commit cb70d02

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

app/src/main/java/com/vandam/zero/CameraViewModel.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,20 +375,22 @@ class CameraViewModel : ViewModel() {
375375
_shutterFlash.value = true
376376
},
377377
onPreviewReady = { bitmap ->
378-
if (bitmap != null) {
378+
if (bitmap != null && _previewEnabled.value) {
379379
_capturedImageIsPortrait.value = bitmap.height > bitmap.width
380380
_capturedImageBitmap.value = bitmap
381-
if (_outputFormat.value != 2) {
382-
_isSaving.value = false
383-
}
381+
}
382+
if (_outputFormat.value != 2) {
383+
_isSaving.value = false
384384
}
385385
},
386386
onComplete = { uri ->
387387
if (uri != null && _outputFormat.value == 2) {
388-
val thumbnail = extractDngThumbnail(uri)
389-
if (thumbnail != null) {
390-
_capturedImageIsPortrait.value = thumbnail.height > thumbnail.width
391-
_capturedImageBitmap.value = thumbnail
388+
if (_previewEnabled.value) {
389+
val thumbnail = extractDngThumbnail(uri)
390+
if (thumbnail != null) {
391+
_capturedImageIsPortrait.value = thumbnail.height > thumbnail.width
392+
_capturedImageBitmap.value = thumbnail
393+
}
392394
}
393395
_isSaving.value = false
394396
}

0 commit comments

Comments
 (0)