1 /*
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 
17 package com.android.camera;
18 
19 import android.graphics.Rect;
20 import android.view.View;
21 
22 import com.android.camera.ShutterButton.OnShutterButtonListener;
23 
24 
25 public interface PhotoController extends OnShutterButtonListener {
26 
27     public static final int PREVIEW_STOPPED = 0;
28     public static final int IDLE = 1;  // preview is active
29     // Focus is in progress. The exact focus state is in Focus.java.
30     public static final int FOCUSING = 2;
31     public static final int SNAPSHOT_IN_PROGRESS = 3;
32     // Switching between cameras.
33     public static final int SWITCHING_CAMERA = 4;
34 
onZoomChanged(float requestedZoom)35     public void onZoomChanged(float requestedZoom);
36 
isImageCaptureIntent()37     public boolean isImageCaptureIntent();
38 
isCameraIdle()39     public boolean isCameraIdle();
40 
onCaptureDone()41     public void onCaptureDone();
42 
onCaptureCancelled()43     public void onCaptureCancelled();
44 
onCaptureRetake()45     public void onCaptureRetake();
46 
cancelAutoFocus()47     public void cancelAutoFocus();
48 
stopPreview()49     public void stopPreview();
50 
getCameraState()51     public int getCameraState();
52 
onSingleTapUp(View view, int x, int y)53     public void onSingleTapUp(View view, int x, int y);
54 
updatePreviewAspectRatio(float aspectRatio)55     public void updatePreviewAspectRatio(float aspectRatio);
56 
updateCameraOrientation()57     public void updateCameraOrientation();
58 
59     /**
60      * This is the callback when the UI or buffer holder for camera preview,
61      * such as {@link android.graphics.SurfaceTexture}, is ready to be used.
62      * The controller can start the camera preview after or in this callback.
63      */
onPreviewUIReady()64     public void onPreviewUIReady();
65 
66 
67     /**
68      * This is the callback when the UI or buffer holder for camera preview,
69      * such as {@link android.graphics.SurfaceTexture}, is being destroyed.
70      * The controller should try to stop the preview in this callback.
71      */
onPreviewUIDestroyed()72     public void onPreviewUIDestroyed();
73 
74     /********************** Capture animation **********************/
75 
76     /**
77      * Starts the pre-capture animation.
78      */
startPreCaptureAnimation()79     public void startPreCaptureAnimation();
80 
81 }
82