1 /*
2  * Copyright (C) 2024 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 android.net.Uri
19 
20 /**
21  * This interface is determined before the Preview UI is launched and passed into PreviewScreen. The
22  * UX differs depends on which mode the Preview is launched under.
23  */
24 sealed interface PreviewMode {
25     /**
26      * The default mode for the app.
27      */
28     data class StandardMode(
29         val onImageCapture: (PreviewViewModel.ImageCaptureEvent) -> Unit
30     ) : PreviewMode
31 
32     /**
33      * Under this mode, the app is launched by an external intent to capture an image.
34      */
35     data class ExternalImageCaptureMode(
36         val imageCaptureUri: Uri?,
37         val onImageCapture: (PreviewViewModel.ImageCaptureEvent) -> Unit
38     ) : PreviewMode
39 
40     /**
41      * Under this mode, the app is launched by an external intent to capture a video.
42      */
43     data class ExternalVideoCaptureMode(
44         val videoCaptureUri: Uri?,
45         val onVideoCapture: (PreviewViewModel.VideoCaptureEvent) -> Unit
46     ) : PreviewMode
47 }
48