diff --git a/core/camera/src/main/java/com/google/jetpackcamera/core/camera/CameraSession.kt b/core/camera/src/main/java/com/google/jetpackcamera/core/camera/CameraSession.kt index aaf147f53..6c6e94df6 100644 --- a/core/camera/src/main/java/com/google/jetpackcamera/core/camera/CameraSession.kt +++ b/core/camera/src/main/java/com/google/jetpackcamera/core/camera/CameraSession.kt @@ -80,6 +80,7 @@ import com.google.jetpackcamera.model.LowLightBoostState import com.google.jetpackcamera.model.SaveLocation import com.google.jetpackcamera.model.StabilizationMode import com.google.jetpackcamera.model.StreamConfig +import com.google.jetpackcamera.model.TARGET_FPS_AUTO import com.google.jetpackcamera.model.TestPattern import com.google.jetpackcamera.model.VideoQuality import com.google.jetpackcamera.model.VideoQuality.FHD diff --git a/core/camera/src/main/java/com/google/jetpackcamera/core/camera/CameraXCameraSystem.kt b/core/camera/src/main/java/com/google/jetpackcamera/core/camera/CameraXCameraSystem.kt index 36f262c6d..1bfc79c21 100644 --- a/core/camera/src/main/java/com/google/jetpackcamera/core/camera/CameraXCameraSystem.kt +++ b/core/camera/src/main/java/com/google/jetpackcamera/core/camera/CameraXCameraSystem.kt @@ -66,14 +66,17 @@ import com.google.jetpackcamera.model.LowLightBoostState import com.google.jetpackcamera.model.SaveLocation import com.google.jetpackcamera.model.StabilizationMode import com.google.jetpackcamera.model.StreamConfig +import com.google.jetpackcamera.model.TARGET_FPS_15 +import com.google.jetpackcamera.model.TARGET_FPS_30 +import com.google.jetpackcamera.model.TARGET_FPS_60 +import com.google.jetpackcamera.model.TARGET_FPS_AUTO import com.google.jetpackcamera.model.TestPattern +import com.google.jetpackcamera.model.UNLIMITED_VIDEO_DURATION import com.google.jetpackcamera.model.VideoQuality import com.google.jetpackcamera.model.ZoomStrategy import com.google.jetpackcamera.settings.SettableConstraintsRepository import com.google.jetpackcamera.settings.model.CameraAppSettings import com.google.jetpackcamera.settings.model.CameraConstraints -import com.google.jetpackcamera.settings.model.CameraConstraints.Companion.FPS_15 -import com.google.jetpackcamera.settings.model.CameraConstraints.Companion.FPS_60 import com.google.jetpackcamera.settings.model.CameraSystemConstraints import com.google.jetpackcamera.settings.model.forCurrentLens import dagger.hilt.android.scopes.ViewModelScoped @@ -96,12 +99,6 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext private const val TAG = "CameraXCameraSystem" -const val TARGET_FPS_AUTO = 0 -const val TARGET_FPS_15 = 15 -const val TARGET_FPS_30 = 30 -const val TARGET_FPS_60 = 60 - -const val UNLIMITED_VIDEO_DURATION = 0L /** * CameraX based implementation for [CameraSystem] @@ -234,8 +231,8 @@ constructor( val unsupportedStabilizationFpsMap = buildMap { for (stabilizationMode in supportedStabilizationModes) { when (stabilizationMode) { - StabilizationMode.ON -> setOf(FPS_15, FPS_60) - StabilizationMode.HIGH_QUALITY -> setOf(FPS_60) + StabilizationMode.ON -> setOf(TARGET_FPS_15, TARGET_FPS_60) + StabilizationMode.HIGH_QUALITY -> setOf(TARGET_FPS_60) StabilizationMode.OPTICAL -> emptySet() else -> null }?.let { put(stabilizationMode, it) } diff --git a/core/camera/src/main/java/com/google/jetpackcamera/core/camera/ConcurrentCameraSession.kt b/core/camera/src/main/java/com/google/jetpackcamera/core/camera/ConcurrentCameraSession.kt index 5fdf91f1f..8b3061895 100644 --- a/core/camera/src/main/java/com/google/jetpackcamera/core/camera/ConcurrentCameraSession.kt +++ b/core/camera/src/main/java/com/google/jetpackcamera/core/camera/ConcurrentCameraSession.kt @@ -26,6 +26,7 @@ import com.google.jetpackcamera.model.CaptureMode import com.google.jetpackcamera.model.DynamicRange import com.google.jetpackcamera.model.ImageOutputFormat import com.google.jetpackcamera.model.StabilizationMode +import com.google.jetpackcamera.model.TARGET_FPS_AUTO import com.google.jetpackcamera.model.VideoQuality import com.google.jetpackcamera.settings.model.CameraConstraints import kotlinx.coroutines.coroutineScope diff --git a/core/model/src/main/java/com/google/jetpackcamera/model/CameraConstants.kt b/core/model/src/main/java/com/google/jetpackcamera/model/CameraConstants.kt new file mode 100644 index 000000000..b7a3eedf6 --- /dev/null +++ b/core/model/src/main/java/com/google/jetpackcamera/model/CameraConstants.kt @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.jetpackcamera.model + +const val TARGET_FPS_AUTO = 0 +const val TARGET_FPS_15 = 15 +const val TARGET_FPS_30 = 30 +const val TARGET_FPS_60 = 60 +const val UNLIMITED_VIDEO_DURATION = 0L diff --git a/data/settings/src/main/java/com/google/jetpackcamera/settings/JcaSettingsSerializer.kt b/data/settings/src/main/java/com/google/jetpackcamera/settings/JcaSettingsSerializer.kt index 81b6382d4..f84a3248c 100644 --- a/data/settings/src/main/java/com/google/jetpackcamera/settings/JcaSettingsSerializer.kt +++ b/data/settings/src/main/java/com/google/jetpackcamera/settings/JcaSettingsSerializer.kt @@ -17,6 +17,7 @@ package com.google.jetpackcamera.settings import androidx.datastore.core.CorruptionException import androidx.datastore.core.Serializer +import com.google.jetpackcamera.model.UNLIMITED_VIDEO_DURATION import com.google.jetpackcamera.model.proto.AspectRatio import com.google.jetpackcamera.model.proto.DarkMode import com.google.jetpackcamera.model.proto.DynamicRange @@ -29,11 +30,6 @@ import com.google.jetpackcamera.model.proto.VideoQuality import com.google.protobuf.InvalidProtocolBufferException import java.io.InputStream import java.io.OutputStream -/** - * This constant is `0L` because the `DURATION_UNLIMITED` - * constant in the `OutputOptions` API [documentation](https://developer.android.com/reference/androidx/camera/video/OutputOptions#DURATION_UNLIMITED()) is `0`. - */ -const val UNLIMITED_VIDEO_DURATION = 0L object JcaSettingsSerializer : Serializer { override val defaultValue: JcaSettings = JcaSettings.newBuilder() diff --git a/data/settings/src/main/java/com/google/jetpackcamera/settings/model/CameraAppSettings.kt b/data/settings/src/main/java/com/google/jetpackcamera/settings/model/CameraAppSettings.kt index 8761e48ea..bfe325b0f 100644 --- a/data/settings/src/main/java/com/google/jetpackcamera/settings/model/CameraAppSettings.kt +++ b/data/settings/src/main/java/com/google/jetpackcamera/settings/model/CameraAppSettings.kt @@ -28,11 +28,10 @@ import com.google.jetpackcamera.model.LensFacing import com.google.jetpackcamera.model.LowLightBoostPriority import com.google.jetpackcamera.model.StabilizationMode import com.google.jetpackcamera.model.StreamConfig +import com.google.jetpackcamera.model.TARGET_FPS_AUTO +import com.google.jetpackcamera.model.UNLIMITED_VIDEO_DURATION import com.google.jetpackcamera.model.VideoQuality -const val TARGET_FPS_AUTO = 0 -const val UNLIMITED_VIDEO_DURATION = 0L - /** * Data layer representation for settings. */ diff --git a/data/settings/src/main/java/com/google/jetpackcamera/settings/model/Constraints.kt b/data/settings/src/main/java/com/google/jetpackcamera/settings/model/Constraints.kt index 0dc3275c4..3a9857d98 100644 --- a/data/settings/src/main/java/com/google/jetpackcamera/settings/model/Constraints.kt +++ b/data/settings/src/main/java/com/google/jetpackcamera/settings/model/Constraints.kt @@ -23,6 +23,8 @@ import com.google.jetpackcamera.model.ImageOutputFormat import com.google.jetpackcamera.model.LensFacing import com.google.jetpackcamera.model.StabilizationMode import com.google.jetpackcamera.model.StreamConfig +import com.google.jetpackcamera.model.TARGET_FPS_15 +import com.google.jetpackcamera.model.TARGET_FPS_30 import com.google.jetpackcamera.model.TestPattern import com.google.jetpackcamera.model.VideoQuality @@ -53,38 +55,23 @@ inline fun CameraSystemConstraints.forDevice( ) = perLensConstraints.values.asSequence().flatMap { constraintSelector(it) }.toSet() /** - * Defines the specific capabilities, limitations, and supported settings for a single camera lens. + * Defines the capabilities and limitations for a single camera lens. * - * This data class encapsulates various constraints related to video and image capture for a - * particular camera, such as supported stabilization modes, frame rates, dynamic ranges, - * image formats, and zoom capabilities. + * Encapsulates constraints for video and image capture, including stabilization, + * frame rates, dynamic ranges, formats, flash, zoom, and test patterns. * - * @property supportedStabilizationModes A set of [com.google.jetpackcamera.model.StabilizationMode] values that are supported - * by this camera lens. - * @property supportedFixedFrameRates A set of integers representing fixed frame rates (FPS) - * supported for video recording with this lens. - * May include values like [FPS_AUTO], [FPS_15], [FPS_30], [FPS_60]. - * @property supportedDynamicRanges A set of [com.google.jetpackcamera.model.DynamicRange] values (e.g., SDR, HDR10) that - * this camera lens can capture. - * @property supportedVideoQualitiesMap A map where keys are [com.google.jetpackcamera.model.DynamicRange] values and values - * are lists of [VideoQuality] settings supported for that - * dynamic range. - * @property supportedImageFormatsMap A map where keys are [com.google.jetpackcamera.model.StreamConfig] values (indicating single - * or multi-stream configurations) and values are sets of - * [ImageOutputFormat] (e.g., JPEG, DNG) supported for that - * stream configuration. - * @property supportedIlluminants A set of [com.google.jetpackcamera.model.Illuminant] values supported by this camera, typically - * indicating the type of flash unit available (e.g., FLASH_UNIT). - * @property supportedFlashModes A set of [com.google.jetpackcamera.model.FlashMode] values (e.g., OFF, ON, AUTO) that can be - * used with this camera lens. - * @property supportedZoomRange An optional [Range] of floats indicating the minimum and maximum - * zoom ratios supported by this lens. Null if zoom is not supported - * or the range is not available. - * @property unsupportedStabilizationFpsMap A map where keys are [com.google.jetpackcamera.model.StabilizationMode] values and - * values are sets of frame rates (FPS) that are - * *not* supported when that specific stabilization mode - * is active. This helps in understanding combinations - * that are disallowed. + * @property supportedStabilizationModes Set of [StabilizationMode] values supported by this lens. + * @property supportedFixedFrameRates A set of integers representing fixed frame rates that this + * lens supports for video recordings. Only 15, 30, or 60 FPS can be displayed, and a lens must + * exactly support ranges like `[15,15]` to be included in the set. + * @property supportedDynamicRanges Set of [DynamicRange] values (e.g., SDR, HLG10) this lens can capture. + * @property supportedVideoQualitiesMap Map of [DynamicRange] to a list of supported [VideoQuality] settings. + * @property supportedImageFormatsMap Map of [StreamConfig] to a set of supported [ImageOutputFormat]s. + * @property supportedIlluminants Set of supported [Illuminant] types (e.g., flash unit). + * @property supportedFlashModes Set of [FlashMode] values (e.g., ON, OFF, AUTO) supported by this lens. + * @property supportedZoomRange Optional [Range] of floats for zoom ratios. Null if zoom is not supported. + * @property unsupportedStabilizationFpsMap Map of [StabilizationMode] to a set of frame rates (FPS) that are unsupported with that mode. + * @property supportedTestPatterns Set of [TestPattern] values supported by this lens, used for debugging. */ data class CameraConstraints( val supportedStabilizationModes: Set, @@ -100,13 +87,6 @@ data class CameraConstraints( ) { val StabilizationMode.unsupportedFpsSet get() = unsupportedStabilizationFpsMap[this] ?: emptySet() - - companion object { - const val FPS_AUTO = 0 - const val FPS_15 = 15 - const val FPS_30 = 30 - const val FPS_60 = 60 - } } /** @@ -121,7 +101,7 @@ val TYPICAL_SYSTEM_CONSTRAINTS = put( lensFacing, CameraConstraints( - supportedFixedFrameRates = setOf(15, 30), + supportedFixedFrameRates = setOf(TARGET_FPS_15, TARGET_FPS_30), supportedStabilizationModes = setOf(StabilizationMode.OFF), supportedDynamicRanges = setOf(DynamicRange.SDR), supportedImageFormatsMap = mapOf( diff --git a/data/settings/src/main/java/com/google/jetpackcamera/settings/test/FakeJcaSettingsSerializer.kt b/data/settings/src/main/java/com/google/jetpackcamera/settings/test/FakeJcaSettingsSerializer.kt index 033f8ad62..e9f671991 100644 --- a/data/settings/src/main/java/com/google/jetpackcamera/settings/test/FakeJcaSettingsSerializer.kt +++ b/data/settings/src/main/java/com/google/jetpackcamera/settings/test/FakeJcaSettingsSerializer.kt @@ -17,6 +17,7 @@ package com.google.jetpackcamera.settings.test import androidx.datastore.core.CorruptionException import androidx.datastore.core.Serializer +import com.google.jetpackcamera.model.UNLIMITED_VIDEO_DURATION import com.google.jetpackcamera.model.proto.AspectRatio import com.google.jetpackcamera.model.proto.DarkMode import com.google.jetpackcamera.model.proto.DynamicRange @@ -27,7 +28,6 @@ import com.google.jetpackcamera.model.proto.StabilizationMode import com.google.jetpackcamera.model.proto.StreamConfig import com.google.jetpackcamera.model.proto.VideoQuality import com.google.jetpackcamera.settings.JcaSettings -import com.google.jetpackcamera.settings.UNLIMITED_VIDEO_DURATION import com.google.protobuf.InvalidProtocolBufferException import java.io.IOException import java.io.InputStream diff --git a/feature/settings/src/main/java/com/google/jetpackcamera/settings/SettingsUiState.kt b/feature/settings/src/main/java/com/google/jetpackcamera/settings/SettingsUiState.kt index f67f9e45b..08bb81e29 100644 --- a/feature/settings/src/main/java/com/google/jetpackcamera/settings/SettingsUiState.kt +++ b/feature/settings/src/main/java/com/google/jetpackcamera/settings/SettingsUiState.kt @@ -22,6 +22,7 @@ import com.google.jetpackcamera.model.LensFacing import com.google.jetpackcamera.model.LowLightBoostPriority import com.google.jetpackcamera.model.StabilizationMode import com.google.jetpackcamera.model.StreamConfig +import com.google.jetpackcamera.model.UNLIMITED_VIDEO_DURATION import com.google.jetpackcamera.model.VideoQuality import com.google.jetpackcamera.settings.DisabledRationale.DeviceUnsupportedRationale import com.google.jetpackcamera.settings.DisabledRationale.LensUnsupportedRationale @@ -32,13 +33,10 @@ import com.google.jetpackcamera.settings.ui.LENS_UNSUPPORTED_TAG import com.google.jetpackcamera.settings.ui.PERMISSION_RECORD_AUDIO_NOT_GRANTED_TAG import com.google.jetpackcamera.settings.ui.STABILIZATION_UNSUPPORTED_TAG import com.google.jetpackcamera.settings.ui.VIDEO_QUALITY_UNSUPPORTED_TAG - -// seconds duration in millis -const val UNLIMITED_VIDEO_DURATION = 0L -const val FIVE_SECONDS_DURATION = 5_000L -const val TEN_SECONDS_DURATION = 10_000L -const val THIRTY_SECONDS_DURATION = 30_000L -const val SIXTY_SECONDS_DURATION = 60_000L +internal const val FIVE_SECONDS_DURATION = 5_000L +internal const val TEN_SECONDS_DURATION = 10_000L +internal const val THIRTY_SECONDS_DURATION = 30_000L +internal const val SIXTY_SECONDS_DURATION = 60_000L /** * Defines the current state of the [SettingsScreen]. diff --git a/feature/settings/src/main/java/com/google/jetpackcamera/settings/SettingsViewModel.kt b/feature/settings/src/main/java/com/google/jetpackcamera/settings/SettingsViewModel.kt index 675ae7874..20e209170 100644 --- a/feature/settings/src/main/java/com/google/jetpackcamera/settings/SettingsViewModel.kt +++ b/feature/settings/src/main/java/com/google/jetpackcamera/settings/SettingsViewModel.kt @@ -30,16 +30,16 @@ import com.google.jetpackcamera.model.LensFacing import com.google.jetpackcamera.model.LowLightBoostPriority import com.google.jetpackcamera.model.StabilizationMode import com.google.jetpackcamera.model.StreamConfig +import com.google.jetpackcamera.model.TARGET_FPS_15 +import com.google.jetpackcamera.model.TARGET_FPS_30 +import com.google.jetpackcamera.model.TARGET_FPS_60 +import com.google.jetpackcamera.model.TARGET_FPS_AUTO import com.google.jetpackcamera.model.VideoQuality import com.google.jetpackcamera.settings.DisabledRationale.DeviceUnsupportedRationale import com.google.jetpackcamera.settings.DisabledRationale.FpsUnsupportedRationale import com.google.jetpackcamera.settings.DisabledRationale.StabilizationUnsupportedRationale import com.google.jetpackcamera.settings.model.CameraAppSettings import com.google.jetpackcamera.settings.model.CameraConstraints -import com.google.jetpackcamera.settings.model.CameraConstraints.Companion.FPS_15 -import com.google.jetpackcamera.settings.model.CameraConstraints.Companion.FPS_30 -import com.google.jetpackcamera.settings.model.CameraConstraints.Companion.FPS_60 -import com.google.jetpackcamera.settings.model.CameraConstraints.Companion.FPS_AUTO import com.google.jetpackcamera.settings.model.CameraSystemConstraints import com.google.jetpackcamera.settings.model.forCurrentLens import com.google.jetpackcamera.settings.model.forDevice @@ -55,7 +55,7 @@ import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch private const val TAG = "SettingsViewModel" -private val fpsOptions = setOf(FPS_15, FPS_30, FPS_60) +private val fpsOptions = setOf(TARGET_FPS_15, TARGET_FPS_30, TARGET_FPS_60) /** * [ViewModel] for [SettingsScreen]. @@ -174,7 +174,7 @@ class SettingsViewModel @Inject constructor( DeviceUnsupportedRationale(R.string.flash_llb_rationale_prefix) ) } // llb unsupported above 30fps - else if (cameraAppSettings.targetFrameRate > FPS_30) { + else if (cameraAppSettings.targetFrameRate > TARGET_FPS_30) { SingleSelectableState.Disabled( FpsUnsupportedRationale( R.string.flash_llb_rationale_prefix, @@ -460,7 +460,7 @@ class SettingsViewModel @Inject constructor( // make sure all current settings wont break constraint when changing new default lens // if new lens won't support current fps - if (currentSettings.targetFrameRate != FPS_AUTO && + if (currentSettings.targetFrameRate != TARGET_FPS_AUTO && !newLensConstraints.supportedFixedFrameRates .contains(currentSettings.targetFrameRate) ) { @@ -557,9 +557,9 @@ class SettingsViewModel @Inject constructor( return FpsUiState.Enabled( currentSelection = cameraAppSettings.targetFrameRate, fpsAutoState = SingleSelectableState.Selectable, - fpsFifteenState = optionConstraintRationale[FPS_15]!!, - fpsThirtyState = optionConstraintRationale[FPS_30]!!, - fpsSixtyState = optionConstraintRationale[FPS_60]!! + fpsFifteenState = optionConstraintRationale[TARGET_FPS_15]!!, + fpsThirtyState = optionConstraintRationale[TARGET_FPS_30]!!, + fpsSixtyState = optionConstraintRationale[TARGET_FPS_60]!! ) } diff --git a/feature/settings/src/main/java/com/google/jetpackcamera/settings/ui/SettingsComponents.kt b/feature/settings/src/main/java/com/google/jetpackcamera/settings/ui/SettingsComponents.kt index d73157723..ea96e46d4 100644 --- a/feature/settings/src/main/java/com/google/jetpackcamera/settings/ui/SettingsComponents.kt +++ b/feature/settings/src/main/java/com/google/jetpackcamera/settings/ui/SettingsComponents.kt @@ -66,6 +66,11 @@ import com.google.jetpackcamera.model.LensFacing import com.google.jetpackcamera.model.LowLightBoostPriority import com.google.jetpackcamera.model.StabilizationMode import com.google.jetpackcamera.model.StreamConfig +import com.google.jetpackcamera.model.TARGET_FPS_15 +import com.google.jetpackcamera.model.TARGET_FPS_30 +import com.google.jetpackcamera.model.TARGET_FPS_60 +import com.google.jetpackcamera.model.TARGET_FPS_AUTO +import com.google.jetpackcamera.model.UNLIMITED_VIDEO_DURATION import com.google.jetpackcamera.model.VideoQuality import com.google.jetpackcamera.settings.AspectRatioUiState import com.google.jetpackcamera.settings.AudioUiState @@ -84,12 +89,7 @@ import com.google.jetpackcamera.settings.StabilizationUiState import com.google.jetpackcamera.settings.StreamConfigUiState import com.google.jetpackcamera.settings.TEN_SECONDS_DURATION import com.google.jetpackcamera.settings.THIRTY_SECONDS_DURATION -import com.google.jetpackcamera.settings.UNLIMITED_VIDEO_DURATION import com.google.jetpackcamera.settings.VideoQualityUiState -import com.google.jetpackcamera.settings.model.CameraConstraints.Companion.FPS_15 -import com.google.jetpackcamera.settings.model.CameraConstraints.Companion.FPS_30 -import com.google.jetpackcamera.settings.model.CameraConstraints.Companion.FPS_60 -import com.google.jetpackcamera.settings.model.CameraConstraints.Companion.FPS_AUTO import com.google.jetpackcamera.settings.ui.theme.SettingsPreviewTheme /** @@ -509,12 +509,11 @@ fun MaxVideoDurationSetting( } private fun getTargetFpsTestTag(fpsOption: Int): String = when (fpsOption) { - FPS_15 -> BTN_DIALOG_FPS_OPTION_15_TAG - FPS_30 -> BTN_DIALOG_FPS_OPTION_30_TAG - FPS_60 -> BTN_DIALOG_FPS_OPTION_60_TAG - FPS_AUTO -> BTN_DIALOG_FPS_OPTION_AUTO_TAG - else -> BTN_DIALOG_FPS_OPTION_AUTO_TAG -} + TARGET_FPS_15 -> BTN_DIALOG_FPS_OPTION_15_TAG + TARGET_FPS_30 -> BTN_DIALOG_FPS_OPTION_30_TAG + TARGET_FPS_60 -> BTN_DIALOG_FPS_OPTION_60_TAG + TARGET_FPS_AUTO -> BTN_DIALOG_FPS_OPTION_AUTO_TAG + else -> TODO("Unhandled FPS option for test tag: $fpsOption")} @Composable fun TargetFpsSetting( @@ -529,12 +528,11 @@ fun TargetFpsSetting( leadingIcon = null, description = if (fpsUiState is FpsUiState.Enabled) { when (fpsUiState.currentSelection) { - FPS_15 -> stringResource(id = R.string.fps_description, FPS_15) - FPS_30 -> stringResource(id = R.string.fps_description, FPS_30) - FPS_60 -> stringResource(id = R.string.fps_description, FPS_60) - else -> stringResource( - id = R.string.fps_description_auto - ) + TARGET_FPS_15 -> stringResource(id = R.string.fps_description, TARGET_FPS_15) + TARGET_FPS_30 -> stringResource(id = R.string.fps_description, TARGET_FPS_30) + TARGET_FPS_60 -> stringResource(id = R.string.fps_description, TARGET_FPS_60) + TARGET_FPS_AUTO -> stringResource(id = R.string.fps_description_auto) + else -> TODO("Unhandled Target FPS") } } else { disabledRationaleString((fpsUiState as FpsUiState.Disabled).disabledRationale) @@ -543,7 +541,7 @@ fun TargetFpsSetting( if (fpsUiState is FpsUiState.Enabled) { Column(Modifier.selectableGroup()) { Text( - modifier = Modifier.testTag(getTargetFpsTestTag(FPS_AUTO)), + modifier = Modifier.testTag(getTargetFpsTestTag(TARGET_FPS_AUTO)), text = stringResource(id = R.string.fps_stabilization_disclaimer), fontStyle = FontStyle.Italic, color = MaterialTheme.colorScheme.onPrimaryContainer @@ -551,26 +549,26 @@ fun TargetFpsSetting( SingleChoiceSelector( text = stringResource(id = R.string.fps_selector_auto), - selected = fpsUiState.currentSelection == FPS_AUTO, - onClick = { setTargetFps(FPS_AUTO) }, + selected = fpsUiState.currentSelection == TARGET_FPS_AUTO, + onClick = { setTargetFps(TARGET_FPS_AUTO) }, enabled = fpsUiState.fpsAutoState is SingleSelectableState.Selectable ) - listOf(FPS_15, FPS_30, FPS_60).forEach { fpsOption -> + listOf(TARGET_FPS_15, TARGET_FPS_30, TARGET_FPS_60).forEach { fpsOption -> SingleChoiceSelector( modifier = Modifier.testTag(getTargetFpsTestTag(fpsOption)), text = "%d".format(fpsOption), selected = fpsUiState.currentSelection == fpsOption, onClick = { setTargetFps(fpsOption) }, enabled = when (fpsOption) { - FPS_15 -> + TARGET_FPS_15 -> fpsUiState.fpsFifteenState is SingleSelectableState.Selectable - FPS_30 -> + TARGET_FPS_30 -> fpsUiState.fpsThirtyState is SingleSelectableState.Selectable - FPS_60 -> + TARGET_FPS_60 -> fpsUiState.fpsSixtyState is SingleSelectableState.Selectable