feat: preset state & save
This commit is contained in:
1 parent
c773600dfa
commit
5ef12b1679
11 files changed
+195
-159
No files matched your search
@@ -232,6 +232,7 @@ fun CameraScreen(
|
||||
val currentRecipeParams by viewModel.currentRecipeParams.collectAsState()
|
||||
val lutSelectorMode by viewModel.lutSelectorMode.collectAsState()
|
||||
val activePresetId by viewModel.activePresetId.collectAsState()
|
||||
val activePresetModified by viewModel.isActivePresetModified.collectAsState()
|
||||
val customPresets by viewModel.customPresets.collectAsState()
|
||||
val currentBaselineRecipeParams by viewModel.currentBaselineRecipeParams.collectAsState()
|
||||
val categoryOrder by viewModel.categoryOrder.collectAsState(emptyList())
|
||||
@@ -1717,7 +1718,6 @@ fun CameraScreen(
|
||||
contentAlignment = Alignment.BottomCenter
|
||||
) {
|
||||
val allPresets by viewModel.allPresets.collectAsState()
|
||||
val activePresetId by viewModel.activePresetId.collectAsState()
|
||||
val defaultPresetName = stringResource(R.string.preset_new_preset_default)
|
||||
|
||||
// LUT 选择器 (内嵌 Presets 列表与统一控制,无多余背景遮挡)
|
||||
@@ -1729,6 +1729,7 @@ fun CameraScreen(
|
||||
allPresets = allPresets,
|
||||
presetModeEnabled = true,
|
||||
activePresetId = activePresetId,
|
||||
activePresetModified = activePresetModified,
|
||||
selectedMode = lutSelectorMode,
|
||||
onModeSelected = { viewModel.setLutSelectorMode(it) },
|
||||
availableFrames = viewModel.availableFrameList,
|
||||
@@ -1750,6 +1751,16 @@ fun CameraScreen(
|
||||
viewModel.prepareCurrentSettingsPresetDraft(defaultPresetName)
|
||||
onPresetEditClick(null)
|
||||
},
|
||||
onResetPresetClick = {
|
||||
discardTransientLookEdits()
|
||||
val preset = allPresets.firstOrNull { it.id == activePresetId }
|
||||
if (presetRequiresPreviewTransition(preset)) {
|
||||
runPreviewTransition { viewModel.resetActivePreset() }
|
||||
} else {
|
||||
viewModel.resetActivePreset()
|
||||
}
|
||||
},
|
||||
onSavePresetClick = viewModel::saveCurrentSettingsToActivePreset,
|
||||
onPresetManagementClick = onPresetManagementClick,
|
||||
onEditClick = {
|
||||
activePanel = ActivePanel.EDIT
|
||||
@@ -1774,7 +1785,6 @@ fun CameraScreen(
|
||||
showEffects = true,
|
||||
onDismiss = {
|
||||
previewRecipeParamsOverride = null
|
||||
viewModel.refreshActivePresetMatch()
|
||||
activePanel = ActivePanel.FILTERS
|
||||
}
|
||||
)
|
||||
|
||||
@@ -133,8 +133,10 @@ private fun LutPanelIconButton(
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun LutPanelNewPresetButton(
|
||||
private fun LutPanelPresetActionButton(
|
||||
text: String,
|
||||
onClick: () -> Unit,
|
||||
showAddIcon: Boolean = true,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val shape = RoundedCornerShape(12.dp)
|
||||
@@ -148,14 +150,16 @@ private fun LutPanelNewPresetButton(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(3.dp)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Add,
|
||||
contentDescription = null,
|
||||
tint = Color.White,
|
||||
modifier = Modifier.size(12.dp)
|
||||
)
|
||||
if (showAddIcon) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Add,
|
||||
contentDescription = null,
|
||||
tint = Color.White,
|
||||
modifier = Modifier.size(12.dp)
|
||||
)
|
||||
}
|
||||
Text(
|
||||
text = stringResource(R.string.preset_new),
|
||||
text = text,
|
||||
color = Color.White,
|
||||
fontSize = 11.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
@@ -179,6 +183,7 @@ fun LutSelector(
|
||||
allPresets: List<CameraPreset> = emptyList(),
|
||||
presetModeEnabled: Boolean = allPresets.isNotEmpty(),
|
||||
activePresetId: String? = null,
|
||||
activePresetModified: Boolean = false,
|
||||
selectedMode: LutSelectorMode = LutSelectorMode.Style,
|
||||
onModeSelected: (LutSelectorMode) -> Unit = {},
|
||||
availableFrames: List<FrameInfo> = emptyList(),
|
||||
@@ -187,6 +192,8 @@ fun LutSelector(
|
||||
onFrameManagementClick: (() -> Unit)? = null,
|
||||
onPresetSelected: (CameraPreset?) -> Unit = {},
|
||||
onCreatePresetClick: () -> Unit = {},
|
||||
onResetPresetClick: () -> Unit = {},
|
||||
onSavePresetClick: () -> Unit = {},
|
||||
onPresetManagementClick: () -> Unit = {},
|
||||
onEditClick: (() -> Unit)? = null,
|
||||
onManageClick: ((String) -> Unit)? = null,
|
||||
@@ -389,7 +396,11 @@ fun LutSelector(
|
||||
}
|
||||
} ?: ""
|
||||
Text(
|
||||
text = currentName,
|
||||
text = if (currentPreset != null && activePresetModified) {
|
||||
"$currentName*"
|
||||
} else {
|
||||
currentName
|
||||
},
|
||||
color = Color.White,
|
||||
fontSize = 13.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
@@ -403,7 +414,27 @@ fun LutSelector(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(6.dp)
|
||||
) {
|
||||
LutPanelNewPresetButton(onClick = onCreatePresetClick)
|
||||
if (currentPreset != null && activePresetModified) {
|
||||
LutPanelPresetActionButton(
|
||||
text = stringResource(R.string.preset_reset),
|
||||
onClick = onResetPresetClick,
|
||||
showAddIcon = false
|
||||
)
|
||||
LutPanelPresetActionButton(
|
||||
text = stringResource(R.string.preset_update),
|
||||
onClick = onSavePresetClick,
|
||||
showAddIcon = false
|
||||
)
|
||||
LutPanelPresetActionButton(
|
||||
text = stringResource(R.string.preset_save_as),
|
||||
onClick = onCreatePresetClick
|
||||
)
|
||||
} else {
|
||||
LutPanelPresetActionButton(
|
||||
text = stringResource(R.string.preset_new),
|
||||
onClick = onCreatePresetClick
|
||||
)
|
||||
}
|
||||
|
||||
LutPanelIconButton(
|
||||
imageVector = Icons.Default.Settings,
|
||||
@@ -440,7 +471,8 @@ fun LutSelector(
|
||||
LutSelectorModeTab(
|
||||
text = presetText,
|
||||
isSelected = actualMode == LutSelectorMode.Presets,
|
||||
onClick = { onModeSelected(LutSelectorMode.Presets) }
|
||||
onClick = { onModeSelected(LutSelectorMode.Presets) },
|
||||
badgeText = if (activePresetModified) "*" else null
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -536,6 +568,7 @@ fun LutSelector(
|
||||
// 预设列表
|
||||
PresetsPanel(
|
||||
activePresetId = activePresetId,
|
||||
activePresetModified = activePresetModified,
|
||||
allPresets = allPresets,
|
||||
onPresetSelected = onPresetSelected,
|
||||
onManagePresets = onPresetManagementClick,
|
||||
@@ -583,13 +616,11 @@ private fun LutSelectorModeTab(
|
||||
if (badgeText != null) {
|
||||
Text(
|
||||
text = badgeText,
|
||||
color = Color.Black,
|
||||
fontSize = 8.sp,
|
||||
color = LutPanelAccent,
|
||||
fontSize = 12.sp,
|
||||
lineHeight = 12.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(4.dp))
|
||||
.background(Color(0xFFFFD700))
|
||||
.padding(horizontal = 4.dp, vertical = 1.dp)
|
||||
modifier = Modifier.offset(y = 1.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -614,7 +645,7 @@ private fun LutItem(
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val itemShape = RoundedCornerShape(8.dp)
|
||||
val itemShape = RoundedCornerShape(6.dp)
|
||||
val borderColor by animateColorAsState(
|
||||
targetValue = if (isSelected) LutPanelAccent else Color.White.copy(alpha = 0.15f),
|
||||
label = "lutItemBorder"
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.hinnka.mycamera.ui.camera.ViewfinderTextShadow
|
||||
@Composable
|
||||
fun PresetsPanel(
|
||||
activePresetId: String?,
|
||||
activePresetModified: Boolean,
|
||||
allPresets: List<CameraPreset>,
|
||||
onPresetSelected: (CameraPreset?) -> Unit,
|
||||
onManagePresets: () -> Unit,
|
||||
@@ -112,7 +113,7 @@ fun PresetsPanel(
|
||||
) {
|
||||
// 预设名
|
||||
Text(
|
||||
text = displayName,
|
||||
text = if (isSelected && activePresetModified) "$displayName*" else displayName,
|
||||
color = Color.White,
|
||||
fontSize = 10.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
|
||||
@@ -96,6 +96,7 @@ fun PresetManagementScreen(
|
||||
) {
|
||||
val allPresets by viewModel.allPresets.collectAsState()
|
||||
val activePresetId by viewModel.activePresetId.collectAsState()
|
||||
val activePresetModified by viewModel.isActivePresetModified.collectAsState()
|
||||
val context = LocalContext.current
|
||||
val scope = rememberCoroutineScope()
|
||||
var localPresets by remember { mutableStateOf(allPresets) }
|
||||
@@ -278,6 +279,7 @@ fun PresetManagementScreen(
|
||||
preset = preset,
|
||||
displayName = displayName,
|
||||
isActive = activePresetId == preset.id,
|
||||
isModified = activePresetModified && activePresetId == preset.id,
|
||||
isDragging = isDragging,
|
||||
isExporting = exportingPresetId == preset.id,
|
||||
dragModifier = Modifier.draggableHandle(),
|
||||
@@ -364,6 +366,7 @@ private fun PresetManagementItem(
|
||||
preset: CameraPreset,
|
||||
displayName: String,
|
||||
isActive: Boolean,
|
||||
isModified: Boolean,
|
||||
isDragging: Boolean,
|
||||
isExporting: Boolean,
|
||||
dragModifier: Modifier,
|
||||
@@ -407,7 +410,7 @@ private fun PresetManagementItem(
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
Text(
|
||||
text = displayName,
|
||||
text = if (isModified) "$displayName*" else displayName,
|
||||
color = if (isActive) Color(0xFFFFD700) else Color.White,
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
|
||||
@@ -574,6 +574,11 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
rawMaxSharpening = saved.rawMaxSharpening,
|
||||
rawMaxNoiseReduction = saved.rawMaxNoiseReduction,
|
||||
rawMaxChromaNoiseReduction = saved.rawMaxChromaNoiseReduction,
|
||||
rawExposureCompensation = saved.rawExposureCompensation,
|
||||
rawHighlightsAdjustment = saved.rawHighlightsAdjustment,
|
||||
rawShadowsAdjustment = saved.rawShadowsAdjustment,
|
||||
rawBlackPointCorrection = saved.rawBlackPointCorrection,
|
||||
rawWhitePointCorrection = saved.rawWhitePointCorrection,
|
||||
rawOppoMasterToneMap = saved.rawOppoMasterToneMap,
|
||||
rawSpectralFilmStock = saved.rawSpectralFilmStock,
|
||||
rawSpectralFilmPrint = saved.rawSpectralFilmPrint,
|
||||
@@ -609,10 +614,58 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
.map { it.activePresetId }
|
||||
.stateIn(viewModelScope, SharingStarted.Eagerly, null)
|
||||
|
||||
private val activePresetMatchState: StateFlow<ActivePresetMatchState?> = combine(
|
||||
combine(
|
||||
userPreferencesRepository.userPreferences,
|
||||
allPresets,
|
||||
isInitialized
|
||||
) { prefs, presets, initialized ->
|
||||
if (initialized) prefs to presets else null
|
||||
},
|
||||
state.map { it.aspectRatio.name }.distinctUntilChanged(),
|
||||
currentLutId.flatMapLatest { lutId ->
|
||||
contentRepository.lutManager.getColorRecipeParams(lutId).map { recipe ->
|
||||
lutId to recipe
|
||||
}
|
||||
}
|
||||
) { inputs, aspectRatio, (lutId, recipe) ->
|
||||
inputs?.let { (prefs, presets) ->
|
||||
ActivePresetMatchState(
|
||||
prefs = prefs,
|
||||
presets = presets,
|
||||
aspectRatio = aspectRatio,
|
||||
lutId = lutId,
|
||||
recipe = recipe,
|
||||
effects = recipe.toEffectParams()
|
||||
)
|
||||
}
|
||||
}.stateIn(viewModelScope, SharingStarted.Eagerly, null)
|
||||
|
||||
private val presetApplyInProgress = MutableStateFlow(false)
|
||||
|
||||
/**
|
||||
* Whether the settings currently in use differ from the selected preset.
|
||||
* Selection and matching are deliberately independent: editing a setting keeps the preset
|
||||
* selected and only marks it as modified.
|
||||
*/
|
||||
val isActivePresetModified: StateFlow<Boolean> = combine(
|
||||
activePresetMatchState,
|
||||
presetApplyInProgress
|
||||
) { matchState, applyingPreset ->
|
||||
if (applyingPreset) {
|
||||
false
|
||||
} else {
|
||||
val presetId = matchState?.prefs?.activePresetId ?: return@combine false
|
||||
val preset = matchState.presets.firstOrNull { it.id == presetId }
|
||||
?: return@combine false
|
||||
!matchState.toPresetMatchSnapshot().matches(preset)
|
||||
}
|
||||
}
|
||||
.distinctUntilChanged()
|
||||
.stateIn(viewModelScope, SharingStarted.Eagerly, false)
|
||||
|
||||
var draftPreset: com.hinnka.mycamera.model.CameraPreset? = null
|
||||
|
||||
@Volatile
|
||||
private var isApplyingPreset = false
|
||||
private val presetApplyMutex = Mutex()
|
||||
private val presetMutationMutex = Mutex()
|
||||
private var presetApplyGeneration = 0L
|
||||
@@ -620,9 +673,23 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
private var lutLoadGeneration = 0L
|
||||
|
||||
fun prepareCurrentSettingsPresetDraft(name: String): com.hinnka.mycamera.model.CameraPreset {
|
||||
return com.hinnka.mycamera.model.CameraPreset(
|
||||
return createPresetFromCurrentSettings(
|
||||
id = UUID.randomUUID().toString(),
|
||||
name = name,
|
||||
isBuiltIn = false
|
||||
).also {
|
||||
draftPreset = it
|
||||
}
|
||||
}
|
||||
|
||||
private fun createPresetFromCurrentSettings(
|
||||
id: String,
|
||||
name: String,
|
||||
isBuiltIn: Boolean
|
||||
): com.hinnka.mycamera.model.CameraPreset {
|
||||
return com.hinnka.mycamera.model.CameraPreset(
|
||||
id = id,
|
||||
name = name,
|
||||
lutId = CameraPreset.normalizeLutId(currentLutId.value),
|
||||
colorRecipe = currentRecipeParams.value.withoutIndependentEffects(),
|
||||
effects = currentRecipeParams.value.toEffectParams(),
|
||||
@@ -648,10 +715,8 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
rawSpectralFilmPrint = rawSpectralFilmPrint.value,
|
||||
rawDROMode = droMode.value,
|
||||
rawBaselineLutId = rawBaselineLutId.value,
|
||||
isBuiltIn = false
|
||||
).also {
|
||||
draftPreset = it
|
||||
}
|
||||
isBuiltIn = isBuiltIn
|
||||
)
|
||||
}
|
||||
|
||||
fun getMergedRecipeParams(recipe: ColorRecipeParams = currentRecipeParams.value): ColorRecipeParams {
|
||||
@@ -660,13 +725,14 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
|
||||
fun applyPreset(preset: com.hinnka.mycamera.model.CameraPreset?) {
|
||||
val applyGeneration = ++presetApplyGeneration
|
||||
isApplyingPreset = true
|
||||
presetApplyInProgress.value = true
|
||||
viewModelScope.launch {
|
||||
presetApplyMutex.withLock {
|
||||
if (presetApplyGeneration != applyGeneration) {
|
||||
return@withLock
|
||||
}
|
||||
try {
|
||||
var applied = false
|
||||
try {
|
||||
presetApplyMutex.withLock {
|
||||
if (presetApplyGeneration != applyGeneration) {
|
||||
return@withLock
|
||||
}
|
||||
val currentState = state.value
|
||||
val includePhotoSettings = currentState.captureMode == CaptureMode.PHOTO
|
||||
val includeProfessionalSettings = includePhotoSettings &&
|
||||
@@ -680,14 +746,21 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
preset.toCameraFeatureUpdate(
|
||||
includePhotoSettings = includePhotoSettings,
|
||||
includeProfessionalSettings = includeProfessionalSettings
|
||||
).copy(activePresetId = SettingValue(preset?.id)),
|
||||
clearActivePresetOnMismatch = false
|
||||
).copy(activePresetId = SettingValue(preset?.id))
|
||||
)
|
||||
} finally {
|
||||
if (presetApplyGeneration == applyGeneration) {
|
||||
isApplyingPreset = false
|
||||
applied = true
|
||||
}
|
||||
|
||||
if (applied && presetApplyGeneration == applyGeneration) {
|
||||
activePresetMatchState.filterNotNull().first { matchState ->
|
||||
matchState.prefs.activePresetId == preset?.id &&
|
||||
(preset == null || matchState.toPresetMatchSnapshot().matches(preset))
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (presetApplyGeneration == applyGeneration) {
|
||||
presetApplyInProgress.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -754,10 +827,7 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
)
|
||||
}
|
||||
|
||||
private suspend fun applyCameraFeatureUpdate(
|
||||
update: CameraFeatureUpdate,
|
||||
clearActivePresetOnMismatch: Boolean = true
|
||||
) {
|
||||
private suspend fun applyCameraFeatureUpdate(update: CameraFeatureUpdate) {
|
||||
val prefs = userPreferencesRepository.userPreferences.first()
|
||||
var desiredUseRaw = prefs.useRaw
|
||||
var desiredUseJpgMax = prefs.useJpgMax
|
||||
@@ -977,9 +1047,6 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
if (needsCameraReopen) {
|
||||
reopenCamera()
|
||||
}
|
||||
if (clearActivePresetOnMismatch) {
|
||||
clearActivePresetIfCurrentSettingsMismatch()
|
||||
}
|
||||
}
|
||||
|
||||
private fun resolveCaptureRawRenderingEngine(userPrefs: UserPreferences?): RawRenderingEngine {
|
||||
@@ -1014,6 +1081,24 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
}
|
||||
}
|
||||
|
||||
fun resetActivePreset() {
|
||||
val presetId = activePresetId.value ?: return
|
||||
val preset = allPresets.value.firstOrNull { it.id == presetId } ?: return
|
||||
applyPreset(preset)
|
||||
}
|
||||
|
||||
fun saveCurrentSettingsToActivePreset() {
|
||||
val presetId = activePresetId.value ?: return
|
||||
val preset = allPresets.value.firstOrNull { it.id == presetId } ?: return
|
||||
savePreset(
|
||||
createPresetFromCurrentSettings(
|
||||
id = preset.id,
|
||||
name = preset.name,
|
||||
isBuiltIn = preset.isBuiltIn
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun exportPresetPackage(
|
||||
preset: com.hinnka.mycamera.model.CameraPreset,
|
||||
displayName: String,
|
||||
@@ -1102,83 +1187,6 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
}
|
||||
}
|
||||
|
||||
fun refreshActivePresetMatch() {
|
||||
viewModelScope.launch {
|
||||
clearActivePresetIfCurrentSettingsMismatch()
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun clearActivePresetIfCurrentSettingsMismatch() {
|
||||
if (isApplyingPreset) return
|
||||
val presetId = activePresetId.value ?: return
|
||||
val preset = allPresets.value.firstOrNull { it.id == presetId }
|
||||
if (preset == null) {
|
||||
userPreferencesRepository.saveActivePresetId(null)
|
||||
return
|
||||
}
|
||||
val snapshot = currentPresetMatchSnapshot()
|
||||
if (!snapshot.matches(preset)) {
|
||||
PLog.d(
|
||||
TAG,
|
||||
"Active preset [$presetId] no longer matches current settings; " +
|
||||
"mismatch=${snapshot.mismatchSummary(preset)}; showing default preset"
|
||||
)
|
||||
userPreferencesRepository.saveActivePresetId(null)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun clearActivePresetIfCurrentSettingsMismatch(matchState: ActivePresetMatchState) {
|
||||
if (isApplyingPreset) return
|
||||
val presetId = matchState.prefs.activePresetId ?: return
|
||||
val preset = matchState.presets.firstOrNull { it.id == presetId }
|
||||
if (preset == null) {
|
||||
userPreferencesRepository.saveActivePresetId(null)
|
||||
return
|
||||
}
|
||||
val snapshot = matchState.toPresetMatchSnapshot()
|
||||
if (!snapshot.matches(preset)) {
|
||||
PLog.d(
|
||||
TAG,
|
||||
"Active preset [$presetId] no longer matches current settings; " +
|
||||
"mismatch=${snapshot.mismatchSummary(preset)}; showing default preset"
|
||||
)
|
||||
userPreferencesRepository.saveActivePresetId(null)
|
||||
}
|
||||
}
|
||||
|
||||
private fun currentPresetMatchSnapshot(): PresetMatchSnapshot {
|
||||
return PresetMatchSnapshot(
|
||||
lutId = CameraPreset.normalizeLutId(currentLutId.value),
|
||||
colorRecipe = currentRecipeParams.value,
|
||||
effects = currentEffectParams.value,
|
||||
captureMode = state.value.captureMode,
|
||||
aspectRatio = state.value.aspectRatio.name,
|
||||
isProfessionalMode = state.value.captureMode == CaptureMode.PHOTO &&
|
||||
useRaw.value && useRawMax.value && !useJpgMax.value,
|
||||
ultraHdrGainMapEnabled = ultraHdrGainMapEnabled.value,
|
||||
frameId = currentFrameId,
|
||||
rawDcpId = rawDcpId.value,
|
||||
rawDcpIdsByLens = rawDcpIdsByLens.value,
|
||||
rawHncsProfileId = rawHncsProfileId.value,
|
||||
rawHncsRenderIntent = rawHncsRenderIntent.value,
|
||||
rawHncsFilmCurveMode = rawHncsFilmCurveMode.value,
|
||||
rawRenderingEngine = rawRenderingEngine.value,
|
||||
rawMaxSharpening = userPreferences.value.rawMaxSharpening,
|
||||
rawMaxNoiseReduction = userPreferences.value.rawMaxNoiseReduction,
|
||||
rawMaxChromaNoiseReduction = userPreferences.value.rawMaxChromaNoiseReduction,
|
||||
rawExposureCompensation = userPreferences.value.rawExposureCompensation,
|
||||
rawHighlightsAdjustment = userPreferences.value.rawHighlightsAdjustment,
|
||||
rawShadowsAdjustment = userPreferences.value.rawShadowsAdjustment,
|
||||
rawBlackPointCorrection = userPreferences.value.rawBlackPointCorrection,
|
||||
rawWhitePointCorrection = userPreferences.value.rawWhitePointCorrection,
|
||||
rawOppoMasterToneMap = rawToneMappingParameters.value.useOppoMasterToneMap,
|
||||
rawSpectralFilmStock = rawSpectralFilmStock.value,
|
||||
rawSpectralFilmPrint = rawSpectralFilmPrint.value,
|
||||
rawDROMode = droMode.value,
|
||||
rawBaselineLutId = rawBaselineLutId.value
|
||||
)
|
||||
}
|
||||
|
||||
private fun ActivePresetMatchState.toPresetMatchSnapshot(): PresetMatchSnapshot {
|
||||
return PresetMatchSnapshot(
|
||||
lutId = CameraPreset.normalizeLutId(lutId),
|
||||
@@ -2178,38 +2186,6 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
}
|
||||
}
|
||||
|
||||
viewModelScope.launch {
|
||||
val presetInputs = combine(
|
||||
userPreferencesRepository.userPreferences,
|
||||
allPresets,
|
||||
isInitialized
|
||||
) { prefs, presets, initialized ->
|
||||
if (initialized) prefs to presets else null
|
||||
}
|
||||
|
||||
combine(
|
||||
presetInputs,
|
||||
state.map { it.aspectRatio.name }.distinctUntilChanged(),
|
||||
currentLutId.flatMapLatest { lutId -> contentRepository.lutManager.getColorRecipeParams(lutId) },
|
||||
currentEffectParams
|
||||
) { inputs, aspectRatio, recipe, effects ->
|
||||
inputs?.let { (prefs, presets) ->
|
||||
ActivePresetMatchState(
|
||||
prefs = prefs,
|
||||
presets = presets,
|
||||
aspectRatio = aspectRatio,
|
||||
lutId = currentLutId.value,
|
||||
recipe = recipe,
|
||||
effects = effects
|
||||
)
|
||||
}
|
||||
}.collect { matchState ->
|
||||
if (matchState != null) {
|
||||
clearActivePresetIfCurrentSettingsMismatch(matchState)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 加载用户偏好设置
|
||||
viewModelScope.launch {
|
||||
val prefs = userPreferencesRepository.userPreferences.firstOrNull()
|
||||
@@ -2442,7 +2418,6 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
if (selection != null && selection.id == previousStock) {
|
||||
userPreferencesRepository.saveRawSpectralFilmTuning(selection.id, selection.tuning)
|
||||
}
|
||||
clearActivePresetIfCurrentSettingsMismatch()
|
||||
}
|
||||
}
|
||||
fun setRawToneMappingParameters(value: RawToneMappingParameters) {
|
||||
@@ -3902,7 +3877,6 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
userPreferencesRepository.saveVideoLutConfig(normalizedLutId)
|
||||
} else {
|
||||
userPreferencesRepository.saveLutConfig(normalizedLutId)
|
||||
clearActivePresetIfCurrentSettingsMismatch()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3931,7 +3905,6 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
}
|
||||
viewModelScope.launch {
|
||||
userPreferencesRepository.saveLutConfig(normalizedLutId)
|
||||
clearActivePresetIfCurrentSettingsMismatch()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1148,6 +1148,9 @@
|
||||
<string name="preset_builtin_cinematic">電影寬幅</string>
|
||||
<string name="preset_builtin_leica_m9_moment">徠卡一瞬</string>
|
||||
<string name="preset_save">儲存</string>
|
||||
<string name="preset_reset">重設</string>
|
||||
<string name="preset_update">同步儲存</string>
|
||||
<string name="preset_save_as">另存新檔</string>
|
||||
<string name="preset_editor_title">編輯拍攝預設</string>
|
||||
<string name="preset_new_preset_default">新預設</string>
|
||||
<string name="preset_name_label">預設名稱</string>
|
||||
|
||||
@@ -878,6 +878,9 @@
|
||||
<string name="preset_builtin_cinematic">ภาพยนตร์กว้าง</string>
|
||||
<string name="preset_builtin_leica_m9_moment">ช่วงเวลาไลก้า</string>
|
||||
<string name="preset_save">บันทึก</string>
|
||||
<string name="preset_reset">รีเซ็ต</string>
|
||||
<string name="preset_update">อัปเดต</string>
|
||||
<string name="preset_save_as">บันทึกเป็น</string>
|
||||
<string name="preset_editor_title">แก้ไขการตั้งค่าการถ่ายภาพล่วงหน้า</string>
|
||||
<string name="preset_new_preset_default">ค่าที่ตั้งล่วงหน้าใหม่</string>
|
||||
<string name="preset_name_label">ชื่อเริ่มต้น</string>
|
||||
|
||||
@@ -1167,6 +1167,9 @@
|
||||
<string name="preset_builtin_cinematic">电影宽幅</string>
|
||||
<string name="preset_builtin_leica_m9_moment">徕卡一瞬</string>
|
||||
<string name="preset_save">保存</string>
|
||||
<string name="preset_reset">重置</string>
|
||||
<string name="preset_update">同步保存</string>
|
||||
<string name="preset_save_as">另存为</string>
|
||||
<string name="preset_editor_title">编辑拍摄预设</string>
|
||||
<string name="preset_new_preset_default">新预设</string>
|
||||
<string name="preset_name_label">预设名称</string>
|
||||
|
||||
@@ -1144,6 +1144,9 @@
|
||||
<string name="preset_builtin_cinematic">電影寬幅</string>
|
||||
<string name="preset_builtin_leica_m9_moment">徠卡一瞬</string>
|
||||
<string name="preset_save">儲存</string>
|
||||
<string name="preset_reset">重設</string>
|
||||
<string name="preset_update">同步儲存</string>
|
||||
<string name="preset_save_as">另存新檔</string>
|
||||
<string name="preset_editor_title">編輯拍攝預設</string>
|
||||
<string name="preset_new_preset_default">新預設</string>
|
||||
<string name="preset_name_label">預設名稱</string>
|
||||
|
||||
@@ -1148,6 +1148,9 @@
|
||||
<string name="preset_builtin_cinematic">電影寬幅</string>
|
||||
<string name="preset_builtin_leica_m9_moment">徠卡一瞬</string>
|
||||
<string name="preset_save">儲存</string>
|
||||
<string name="preset_reset">重設</string>
|
||||
<string name="preset_update">同步儲存</string>
|
||||
<string name="preset_save_as">另存新檔</string>
|
||||
<string name="preset_editor_title">編輯拍攝預設</string>
|
||||
<string name="preset_new_preset_default">新預設</string>
|
||||
<string name="preset_name_label">預設名稱</string>
|
||||
|
||||
@@ -1169,6 +1169,9 @@
|
||||
<string name="preset_builtin_cinematic">Cinematic</string>
|
||||
<string name="preset_builtin_leica_m9_moment">Leica Moment</string>
|
||||
<string name="preset_save">Save</string>
|
||||
<string name="preset_reset">Reset</string>
|
||||
<string name="preset_update">Update</string>
|
||||
<string name="preset_save_as">Save As</string>
|
||||
|
||||
<!-- Preset Editor & Management Extensions -->
|
||||
<string name="preset_editor_title">Edit Preset</string>
|
||||
|
||||
Reference in new issue
Block a user