• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 package com.android.DeviceAsWebcam.view;
18 
19 import com.android.DeviceAsWebcam.CameraInfo;
20 
21 /**
22  * A class for providing the switch camera selector list item data info.
23  */
24 public class SelectorListItemData {
25     public final boolean isHeader;
26     public final int lensFacing;
27     public final CameraInfo cameraInfo;
28     public boolean isChecked = false;
29 
SelectorListItemData(boolean isHeader, CameraInfo cameraInfo)30     private SelectorListItemData(boolean isHeader, CameraInfo cameraInfo) {
31         this.isHeader = isHeader;
32         this.cameraInfo = cameraInfo;
33         lensFacing = cameraInfo.getLensFacing();
34     }
35 
SelectorListItemData(boolean isHeader, int lensFacing)36     private SelectorListItemData(boolean isHeader, int lensFacing) {
37         this.isHeader = isHeader;
38         this.lensFacing = lensFacing;
39         cameraInfo = null;
40     }
41 
42     /**
43      * Creates a header list item data for the specific lens facing.
44      */
createHeaderItemData(int lensFacing)45     public static SelectorListItemData createHeaderItemData(int lensFacing) {
46         return new SelectorListItemData(true, lensFacing);
47     }
48 
49     /**
50      * Creates a camera list item data.
51      */
createCameraItemData(CameraInfo cameraInfo)52     public static SelectorListItemData createCameraItemData(CameraInfo cameraInfo) {
53         return new SelectorListItemData(false, cameraInfo);
54     }
55 }
56