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 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 38 // todo: remove after implementing post capture screen 39 val toastMessageToShow: ToastMessage? = null, 40 val snackBarToShow: SnackbarData? = null, 41 val lastBlinkTimeStamp: Long = 0, 42 val previewMode: PreviewMode 43 ) : PreviewUiState 44 } 45 46 /** 47 * Defines the current state of Video Recording 48 */ 49 enum class VideoRecordingState { 50 /** 51 * Camera is not currently recording a video 52 */ 53 INACTIVE, 54 55 /** 56 * Camera is currently recording a video 57 */ 58 ACTIVE 59 } 60