fix: auto exposure settings
This commit is contained in:
1 parent
d706ddc569
commit
d471e052f9
4 files changed
+30
-8
No files matched your search
@@ -83,7 +83,9 @@ fun RawEditPanel(
|
||||
onSpectralFilmPrintChange: (String?) -> Unit,
|
||||
onAdjustmentStart: () -> Unit,
|
||||
onAdjustmentEnd: () -> Unit,
|
||||
onRawExposureCompensationReset: ((Float) -> Unit)? = null,
|
||||
onOpenBaselineLutSheet: (() -> Unit)? = null,
|
||||
showAutoExposureControl: Boolean = true,
|
||||
showDngMetadataControls: Boolean = false,
|
||||
contentMode: RawEditPanelContentMode = RawEditPanelContentMode.FULL,
|
||||
modifier: Modifier = Modifier
|
||||
@@ -139,17 +141,20 @@ fun RawEditPanel(
|
||||
onAdjustmentStart = onAdjustmentStart,
|
||||
onAdjustmentEnd = onAdjustmentEnd
|
||||
)
|
||||
RawSwitchSettingItem(
|
||||
title = stringResource(R.string.settings_raw_auto_exposure),
|
||||
description = stringResource(R.string.settings_raw_auto_exposure_description),
|
||||
checked = rawAutoExposure,
|
||||
onCheckedChange = onRawAutoExposureChange
|
||||
)
|
||||
if (showAutoExposureControl) {
|
||||
RawSwitchSettingItem(
|
||||
title = stringResource(R.string.settings_raw_auto_exposure),
|
||||
description = stringResource(R.string.settings_raw_auto_exposure_description),
|
||||
checked = rawAutoExposure,
|
||||
onCheckedChange = onRawAutoExposureChange
|
||||
)
|
||||
}
|
||||
SliderSettingItem(
|
||||
title = stringResource(R.string.settings_raw_exposure_compensation),
|
||||
value = rawExposureCompensation,
|
||||
valueRange = -2f..2f,
|
||||
resetValue = 0f,
|
||||
onResetValue = onRawExposureCompensationReset,
|
||||
onValueChange = {
|
||||
onAdjustmentStart()
|
||||
onRawExposureCompensationChange(it)
|
||||
|
||||
@@ -34,6 +34,7 @@ fun SliderSettingItem(
|
||||
onValueChangeFinished: (() -> Unit)? = null,
|
||||
valueTextFormatter: (Float) -> String = { String.format("%.2f", it) },
|
||||
resetValue: Float? = null,
|
||||
onResetValue: ((Float) -> Unit)? = null,
|
||||
toggleValue: Boolean? = null,
|
||||
onToggleChange: (Boolean) -> Unit = {},
|
||||
enabled: Boolean = toggleValue ?: true,
|
||||
@@ -108,8 +109,12 @@ fun SliderSettingItem(
|
||||
inactiveTrackColor = Color.White.copy(alpha = if (enabled) 0.2f else 0.12f),
|
||||
onDoubleTap = {
|
||||
if (enabled && resetValue != null) {
|
||||
onValueChange(resetValue)
|
||||
onValueChangeFinished?.invoke()
|
||||
if (onResetValue != null) {
|
||||
onResetValue(resetValue)
|
||||
} else {
|
||||
onValueChange(resetValue)
|
||||
onValueChangeFinished?.invoke()
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
@@ -1155,6 +1155,11 @@ fun GalleryEditScreen(
|
||||
onRawExposureCompensationChange = {
|
||||
viewModel.saveRawExposureCompensationValue(currentPhoto, it)
|
||||
},
|
||||
onRawExposureCompensationReset = {
|
||||
viewModel.resetRawExposureCompensationValue(currentPhoto) { success ->
|
||||
if (success) requestRawPreviewRefresh()
|
||||
}
|
||||
},
|
||||
onRawAutoExposureChange = {
|
||||
if (it) {
|
||||
viewModel.saveRawExposureCompensationValue(currentPhoto, 0f)
|
||||
@@ -1222,6 +1227,7 @@ fun GalleryEditScreen(
|
||||
onOpenBaselineLutSheet = {
|
||||
showRawBaselineLutSelectorSheet = true
|
||||
},
|
||||
showAutoExposureControl = false,
|
||||
showDngMetadataControls = true,
|
||||
contentMode = RawEditPanelContentMode.FULL,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
|
||||
@@ -2056,6 +2056,12 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
persistRawEditMetadata(mediaData, onComplete)
|
||||
}
|
||||
|
||||
fun resetRawExposureCompensationValue(mediaData: MediaData, onComplete: ((Boolean) -> Unit)? = null) {
|
||||
editRawAutoExposure.value = false
|
||||
editRawExposureCompensation.value = 0f
|
||||
persistRawEditMetadata(mediaData, onComplete)
|
||||
}
|
||||
|
||||
fun saveRawAutoExposureValue(mediaData: MediaData, enabled: Boolean, onComplete: ((Boolean) -> Unit)? = null) {
|
||||
editRawAutoExposure.value = enabled
|
||||
if (enabled) {
|
||||
|
||||
Reference in new issue
Block a user