blob: f6127e46f47d97b765bb2bd127320b4faf71028e [file] [log] [blame]
Angus Kong8e5e4ee2013-07-30 11:36:00 -07001/*
2 * Copyright (C) 2013 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
17package com.android.camera.data;
18
19import android.view.View;
20
21import com.android.camera.ui.FilmStripView.ImageData;
22
23/**
24 * A class implementing {@link LocalData} to represent a camera preview.
25 */
Angus Kongbd260692013-08-07 14:52:56 -070026public class CameraPreviewData extends SimpleViewData {
Angus Kong8e5e4ee2013-07-30 11:36:00 -070027
28 private boolean mPreviewLocked;
29
30 /**
31 * Constructor.
32 *
33 * @param v The {@link android.view.View} for camera preview.
34 * @param width The width of the camera preview.
35 * @param height The height of the camera preview.
36 */
37 public CameraPreviewData(View v, int width, int height) {
38 super(v, width, height, -1, -1);
39 mPreviewLocked = true;
40 }
41
42 @Override
Angus Kongc27d21b2013-08-12 15:03:45 -070043 public int getViewType() {
44 return ImageData.TYPE_STICKY_VIEW;
45 }
46
47 @Override
Sascha Haeberlingfae11a12013-08-15 14:29:49 -070048 public int getLocalDataType() {
Angus Kongc27d21b2013-08-12 15:03:45 -070049 return LOCAL_CAMERA_PREVIEW;
Angus Kong8e5e4ee2013-07-30 11:36:00 -070050 }
51
52 @Override
53 public boolean canSwipeInFullScreen() {
54 return !mPreviewLocked;
55 }
56
57 /**
58 * Locks the camera preview. When the camera preview is locked, swipe
59 * to film strip is not allowed. One case is when the video recording
60 * is in progress.
61 *
62 * @param lock {@code true} if the preview should be locked. {@code false}
63 * otherwise.
64 */
65 public void lockPreview(boolean lock) {
66 mPreviewLocked = lock;
67 }
68}