1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.google.jetpackcamera.feature.preview
17 
18 import com.google.jetpackcamera.feature.preview.ui.SnackbarData
19 import com.google.jetpackcamera.feature.preview.ui.ToastMessage
20 import com.google.jetpackcamera.settings.model.CameraAppSettings
21 import com.google.jetpackcamera.settings.model.SystemConstraints
22 
23 /**
24  * Defines the current state of the [PreviewScreen].
25  */
26 sealed interface PreviewUiState {
27     data object NotReady : PreviewUiState
28 
29     data class Ready(
30         // "quick" settings
31         val currentCameraSettings: CameraAppSettings,
32         val systemConstraints: SystemConstraints,
33         val zoomScale: Float = 1f,
34         val videoRecordingState: VideoRecordingState = VideoRecordingState.INACTIVE,
35         val quickSettingsIsOpen: Boolean = false,
36         val audioAmplitude: Double = 0.0,
37         val audioMuted: Boolean = false,
38 
39         // todo: remove after implementing post capture screen
40         val toastMessageToShow: ToastMessage? = null,
41         val snackBarToShow: SnackbarData? = null,
42         val lastBlinkTimeStamp: Long = 0,
43         val previewMode: PreviewMode,
44         val captureModeToggleUiState: CaptureModeToggleUiState,
45         val sessionFirstFrameTimestamp: Long = 0L,
46         val currentPhysicalCameraId: String? = null,
47         val currentLogicalCameraId: String? = null,
48         val isDebugMode: Boolean = false
49     ) : PreviewUiState
50 }
51 
52 /**
53  * Defines the current state of Video Recording
54  */
55 enum class VideoRecordingState {
56     /**
57      * Camera is not currently recording a video
58      */
59     INACTIVE,
60 
61     /**
62      * Camera is currently recording a video
63      */
64     ACTIVE
65 }
66