PreviewStatusListener.java revision a1ec04a9f9526418f5cb17a5afbfc48aca1e02d0
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
17package com.android.camera.ui;
18
19import android.graphics.RectF;
20import android.view.GestureDetector;
21import android.view.TextureView;
22import android.view.View;
23
24/**
25 * This interface defines a listener that watches preview status, including SurfaceTexture
26 * change and preview gestures.
27 */
28public interface PreviewStatusListener extends TextureView.SurfaceTextureListener {
29    /**
30     * The preview status listener needs to provide an
31     * {@link android.view.GestureDetector.OnGestureListener} in order to listen
32     * to the touch events that happen on preview.
33     *
34     * @return a listener that listens to touch events
35     */
36    public GestureDetector.OnGestureListener getGestureListener();
37
38    /**
39     * Gets called when preview TextureView gets a layout change call.
40     */
41    public void onPreviewLayoutChanged(View v, int left, int top, int right,
42            int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom);
43
44    /**
45     * This listener gets notified when the actual preview frame changes size due
46     * to a transform matrix being applied to the TextureView
47     */
48    public interface PreviewAreaSizeChangedListener {
49        public void onPreviewAreaSizeChanged(RectF previewArea);
50    }
51
52    /**
53     * The preview status listener needs to know for the specific module whether
54     * preview TextureView should automatically adjust its transform matrix based
55     * on the current aspect ratio, width and height of the TextureView.
56     *
57     * @return whether transform matrix should be automatically adjusted
58     */
59    public boolean shouldAutoAdjustTransformMatrixOnLayout();
60
61    /**
62     * The preview status listener needs to know for the specific module whether
63     * bottom bar should be automatically adjusted when preview has changed size
64     * or orientation.
65     *
66     * @return whether bottom bar should be automatically adjusted
67     */
68    public boolean shouldAutoAdjustBottomBar();
69
70    /**
71     * Gets called when the preview is flipped (i.e. 180-degree rotated).
72     */
73    public void onPreviewFlipped();
74}
75