fix: Handle unknown camera lenses

This commit is contained in:
Myzel394 2024-01-09 22:35:18 +01:00
parent 88ba0444e8
commit 9202c21125
No known key found for this signature in database
GPG Key ID: 79CC92F37B3E1A2B
4 changed files with 6 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Camera
import androidx.compose.material.icons.filled.Person
import androidx.compose.material.icons.filled.QuestionMark
import androidx.compose.material.icons.filled.Videocam
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
@ -98,4 +99,5 @@ val CAMERA_LENS_ICON_MAP = mapOf(
CameraInfo.Lens.BACK to Icons.Default.Camera,
CameraInfo.Lens.FRONT to Icons.Default.Person,
CameraInfo.Lens.EXTERNAL to Icons.Default.Videocam,
CameraInfo.Lens.UNKNOWN to Icons.Default.QuestionMark,
)

View File

@ -20,6 +20,7 @@ fun CamerasSelection(
CameraInfo.Lens.BACK to stringResource(R.string.ui_videoRecorder_action_start_settings_cameraLens_back_label),
CameraInfo.Lens.FRONT to stringResource(R.string.ui_videoRecorder_action_start_settings_cameraLens_front_label),
CameraInfo.Lens.EXTERNAL to stringResource(R.string.ui_videoRecorder_action_start_settings_cameraLens_external_label),
CameraInfo.Lens.UNKNOWN to stringResource(R.string.ui_videoRecorder_action_start_settings_cameraLens_unknown_label),
)
Column {

View File

@ -16,10 +16,11 @@ data class CameraInfo(
BACK(CameraSelector.LENS_FACING_BACK),
FRONT(CameraSelector.LENS_FACING_FRONT),
EXTERNAL(CameraSelector.LENS_FACING_EXTERNAL),
UNKNOWN(999),
}
val lens: Lens
get() = CAMERA_INT_TO_LENS_MAP[id]!!
get() = CAMERA_INT_TO_LENS_MAP[id] ?: Lens.UNKNOWN
companion object {
val CAMERA_INT_TO_LENS_MAP = mapOf(

View File

@ -187,4 +187,5 @@
<string name="ui_settings_option_saveFolder_explainMediaFolder_generalExplanation">To view your batches, open the Files app, go to the internal storage and then you will find your batches in following folders:</string>
<string name="ui_settings_option_saveFolder_explainMediaFolder_subfoldersExplanation">The final merged recordings will be saved in those folders. Each recording creates a subfolder to store the short batches in (\"%s\" for audio recordings, \"%s\" for video recordings). To view the individual batches, you may need to enable hidden files in the Files app.</string>
<string name="ui_settings_option_saveFolder_explainMediaFolder_openFolderExplanation">Tap on a folder to open it in the Files app</string>
<string name="ui_videoRecorder_action_start_settings_cameraLens_unknown_label">Unknown</string>
</resources>