AppController.java revision 6382c70a769b9ec94a3b0372ee27c0cd075e8be8
1fa27423125e78f43d8dbae987c34314a238f205cAngus Kong/*
2fa27423125e78f43d8dbae987c34314a238f205cAngus Kong * Copyright (C) 2013 The Android Open Source Project
3fa27423125e78f43d8dbae987c34314a238f205cAngus Kong *
4fa27423125e78f43d8dbae987c34314a238f205cAngus Kong * Licensed under the Apache License, Version 2.0 (the "License");
5fa27423125e78f43d8dbae987c34314a238f205cAngus Kong * you may not use this file except in compliance with the License.
6fa27423125e78f43d8dbae987c34314a238f205cAngus Kong * You may obtain a copy of the License at
7fa27423125e78f43d8dbae987c34314a238f205cAngus Kong *
8fa27423125e78f43d8dbae987c34314a238f205cAngus Kong *      http://www.apache.org/licenses/LICENSE-2.0
9fa27423125e78f43d8dbae987c34314a238f205cAngus Kong *
10fa27423125e78f43d8dbae987c34314a238f205cAngus Kong * Unless required by applicable law or agreed to in writing, software
11fa27423125e78f43d8dbae987c34314a238f205cAngus Kong * distributed under the License is distributed on an "AS IS" BASIS,
12fa27423125e78f43d8dbae987c34314a238f205cAngus Kong * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13fa27423125e78f43d8dbae987c34314a238f205cAngus Kong * See the License for the specific language governing permissions and
14fa27423125e78f43d8dbae987c34314a238f205cAngus Kong * limitations under the License.
15fa27423125e78f43d8dbae987c34314a238f205cAngus Kong */
16fa27423125e78f43d8dbae987c34314a238f205cAngus Kong
17fa27423125e78f43d8dbae987c34314a238f205cAngus Kongpackage com.android.camera.app;
18fa27423125e78f43d8dbae987c34314a238f205cAngus Kong
19e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberlingimport android.app.Activity;
20fa27423125e78f43d8dbae987c34314a238f205cAngus Kongimport android.content.Context;
210eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kongimport android.content.Intent;
2251ae7a844570f85b68a989034f7391260d88a783Angus Kongimport android.graphics.Bitmap;
2370da918464276b110c43868caa272c97baadb89eDoris Liuimport android.graphics.Matrix;
2402c129a598b6a165885fe950275675d62993d2eeSeth Raphaelimport android.graphics.RectF;
2551ae7a844570f85b68a989034f7391260d88a783Angus Kongimport android.graphics.SurfaceTexture;
26fa27423125e78f43d8dbae987c34314a238f205cAngus Kongimport android.net.Uri;
27e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberlingimport android.view.View;
2851ae7a844570f85b68a989034f7391260d88a783Angus Kongimport android.widget.FrameLayout;
2951ae7a844570f85b68a989034f7391260d88a783Angus Kong
301848494bd09c85002d8c59d4feb8a6e0dc32871fErin Dahlgrenimport com.android.camera.ButtonManager;
31fa9c38908429b9a5db5d738fae3b2963c4cb177fSascha Haeberlingimport com.android.camera.CurrentModuleProvider;
32e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberlingimport com.android.camera.module.ModuleController;
33357b7673f03d9b45d281d585cc3f4f87dc7d727bErin Dahlgrenimport com.android.camera.settings.SettingsManager;
34c813ce181810a444b6fea4a399e6685aef4103e2Sascha Haeberlingimport com.android.camera.ui.AbstractTutorialOverlay;
3506db742814dd635d100639f977fcfdc904deb778Doris Liuimport com.android.camera.ui.PreviewStatusListener;
36fa27423125e78f43d8dbae987c34314a238f205cAngus Kong
37fa27423125e78f43d8dbae987c34314a238f205cAngus Kong/**
38fa27423125e78f43d8dbae987c34314a238f205cAngus Kong * The controller at app level.
39fa27423125e78f43d8dbae987c34314a238f205cAngus Kong */
40fa9c38908429b9a5db5d738fae3b2963c4cb177fSascha Haeberlingpublic interface AppController extends CurrentModuleProvider {
41fa27423125e78f43d8dbae987c34314a238f205cAngus Kong
42fa27423125e78f43d8dbae987c34314a238f205cAngus Kong    /**
4351ae7a844570f85b68a989034f7391260d88a783Angus Kong     * An interface which defines the shutter events listener.
44fa27423125e78f43d8dbae987c34314a238f205cAngus Kong     */
4551ae7a844570f85b68a989034f7391260d88a783Angus Kong    public interface ShutterEventsListener {
4651ae7a844570f85b68a989034f7391260d88a783Angus Kong        /**
4751ae7a844570f85b68a989034f7391260d88a783Angus Kong         * Called when the shutter state is changed to pressed.
4851ae7a844570f85b68a989034f7391260d88a783Angus Kong         */
4951ae7a844570f85b68a989034f7391260d88a783Angus Kong        public void onShutterPressed();
5051ae7a844570f85b68a989034f7391260d88a783Angus Kong
5151ae7a844570f85b68a989034f7391260d88a783Angus Kong        /**
5251ae7a844570f85b68a989034f7391260d88a783Angus Kong         * Called when the shutter state is changed to released.
5351ae7a844570f85b68a989034f7391260d88a783Angus Kong         */
5451ae7a844570f85b68a989034f7391260d88a783Angus Kong        public void onShutterReleased();
5551ae7a844570f85b68a989034f7391260d88a783Angus Kong
5651ae7a844570f85b68a989034f7391260d88a783Angus Kong        /**
5751ae7a844570f85b68a989034f7391260d88a783Angus Kong         * Called when the shutter is clicked.
5851ae7a844570f85b68a989034f7391260d88a783Angus Kong         */
5951ae7a844570f85b68a989034f7391260d88a783Angus Kong        public void onShutterClicked();
60fa27423125e78f43d8dbae987c34314a238f205cAngus Kong
6151ae7a844570f85b68a989034f7391260d88a783Angus Kong        /**
6251ae7a844570f85b68a989034f7391260d88a783Angus Kong         * Called when the shutter is long pressed.
6351ae7a844570f85b68a989034f7391260d88a783Angus Kong         */
6451ae7a844570f85b68a989034f7391260d88a783Angus Kong        public void onShutterLongPressed();
6551ae7a844570f85b68a989034f7391260d88a783Angus Kong    }
66fa27423125e78f43d8dbae987c34314a238f205cAngus Kong
67fa27423125e78f43d8dbae987c34314a238f205cAngus Kong    /**
680eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong     * @return the {@link android.content.Context} being used.
69fa27423125e78f43d8dbae987c34314a238f205cAngus Kong     */
7051ae7a844570f85b68a989034f7391260d88a783Angus Kong    public Context getAndroidContext();
7151ae7a844570f85b68a989034f7391260d88a783Angus Kong
72c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren    /**
730eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong     * Starts an activity.
740eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong     *
750eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong     * @param intent Used to start the activity.
760eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong     */
770eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong    public void launchActivityByIntent(Intent intent);
780eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong
790eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong    /**
80e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling     * See {@link Activity#openContextMenu(View)}
81e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling     */
82e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling    public void openContextMenu(View view);
83e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling
84e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling    /**
85e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling     * See {@link Activity#registerForContextMenu(View)}
86e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling     */
87e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling    public void registerForContextMenu(View view);
88e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling
89e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling    /**
90c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren     * Returns whether the app is currently paused.
91c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren     */
92c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren    public boolean isPaused();
93c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren
94f55f3c461c5a6ae6b61fa75562ca01683aa93f9aDoris Liu    /**
950a6a8d8e4e1c9796aac606379a42970cdffb8911Erin Dahlgren     * Returns the current module controller.
960a6a8d8e4e1c9796aac606379a42970cdffb8911Erin Dahlgren     */
970a6a8d8e4e1c9796aac606379a42970cdffb8911Erin Dahlgren    public ModuleController getCurrentModuleController();
980a6a8d8e4e1c9796aac606379a42970cdffb8911Erin Dahlgren
990a6a8d8e4e1c9796aac606379a42970cdffb8911Erin Dahlgren    /**
100bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu     * Gets the mode that can be switched to from the given mode id through
101bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu     * quick switch.
102bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu     *
103bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu     * @param currentModuleIndex index of the current mode
104bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu     * @return mode id to quick switch to if index is valid, otherwise returns
105bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu     *         the given mode id itself
106bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu     */
107bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu    public int getQuickSwitchToModuleId(int currentModuleIndex);
108bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu
109bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu    /**
1101ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren     * Based on a mode switcher index, choose the correct module index.
1111ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren     *
1121ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren     * @param modeIndex mode switcher index.
1131ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren     * @return module index.
1141ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren     */
1151ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren    public int getPreferredChildModeIndex(int modeIndex);
1161ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren
1171ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren    /**
118f55f3c461c5a6ae6b61fa75562ca01683aa93f9aDoris Liu     * This gets called when mode is changed.
119f55f3c461c5a6ae6b61fa75562ca01683aa93f9aDoris Liu     *
120f55f3c461c5a6ae6b61fa75562ca01683aa93f9aDoris Liu     * @param moduleIndex index of the new module to switch to
121f55f3c461c5a6ae6b61fa75562ca01683aa93f9aDoris Liu     */
122f55f3c461c5a6ae6b61fa75562ca01683aa93f9aDoris Liu    public void onModeSelected(int moduleIndex);
123f55f3c461c5a6ae6b61fa75562ca01683aa93f9aDoris Liu
1249d264309a341c52601bdccdeff6647e0ce58c31fDoris Liu    /**
1259d264309a341c52601bdccdeff6647e0ce58c31fDoris Liu     * This gets called when settings is selected and settings dialog needs to open.
1269d264309a341c52601bdccdeff6647e0ce58c31fDoris Liu     */
1279d264309a341c52601bdccdeff6647e0ce58c31fDoris Liu    public void onSettingsSelected();
1289d264309a341c52601bdccdeff6647e0ce58c31fDoris Liu
1299f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong    /********************** UI / Camera preview **********************/
130fa27423125e78f43d8dbae987c34314a238f205cAngus Kong
131fa27423125e78f43d8dbae987c34314a238f205cAngus Kong    /**
13251ae7a844570f85b68a989034f7391260d88a783Angus Kong     * Returns the {@link android.graphics.SurfaceTexture} used by the preview
13351ae7a844570f85b68a989034f7391260d88a783Angus Kong     * UI.
134fa27423125e78f43d8dbae987c34314a238f205cAngus Kong     */
13551ae7a844570f85b68a989034f7391260d88a783Angus Kong    public SurfaceTexture getPreviewBuffer();
136fa27423125e78f43d8dbae987c34314a238f205cAngus Kong
137fa27423125e78f43d8dbae987c34314a238f205cAngus Kong    /**
1385a367545ab931a308c8d8555ef5a747dc9565cafDoris Liu     * Gets called from module when preview is ready to start.
1395a367545ab931a308c8d8555ef5a747dc9565cafDoris Liu     */
1405a367545ab931a308c8d8555ef5a747dc9565cafDoris Liu    public void onPreviewReadyToStart();
1415a367545ab931a308c8d8555ef5a747dc9565cafDoris Liu
1425a367545ab931a308c8d8555ef5a747dc9565cafDoris Liu    /**
1432b906b8c9754b564d5113c7a342654c82f97f180Doris Liu     * Gets called from module when preview is started.
1442b906b8c9754b564d5113c7a342654c82f97f180Doris Liu     */
1452b906b8c9754b564d5113c7a342654c82f97f180Doris Liu    public void onPreviewStarted();
1462b906b8c9754b564d5113c7a342654c82f97f180Doris Liu
1472b906b8c9754b564d5113c7a342654c82f97f180Doris Liu    /**
1482bacca795a1b0adb0daf515c43c48234b44bbba5Angus Kong     * Adds a listener to receive callbacks when preview area changes.
149482de029dc20e0a577388a602985fb31c3200309Doris Liu     */
150482de029dc20e0a577388a602985fb31c3200309Doris Liu    public void addPreviewAreaSizeChangedListener(
1512bacca795a1b0adb0daf515c43c48234b44bbba5Angus Kong            PreviewStatusListener.PreviewAreaChangedListener listener);
152482de029dc20e0a577388a602985fb31c3200309Doris Liu
153482de029dc20e0a577388a602985fb31c3200309Doris Liu    /**
1542bacca795a1b0adb0daf515c43c48234b44bbba5Angus Kong     * Removes a listener that receives callbacks when preview area changes.
155482de029dc20e0a577388a602985fb31c3200309Doris Liu     */
156482de029dc20e0a577388a602985fb31c3200309Doris Liu    public void removePreviewAreaSizeChangedListener(
1572bacca795a1b0adb0daf515c43c48234b44bbba5Angus Kong            PreviewStatusListener.PreviewAreaChangedListener listener);
158482de029dc20e0a577388a602985fb31c3200309Doris Liu
159482de029dc20e0a577388a602985fb31c3200309Doris Liu    /**
1604d4a4bc8891bbfc5a7ca842f2981829ac3a716e8Doris Liu     * Sets up one shot preview callback in order to notify UI when the next
1614d4a4bc8891bbfc5a7ca842f2981829ac3a716e8Doris Liu     * preview frame comes in.
1624d4a4bc8891bbfc5a7ca842f2981829ac3a716e8Doris Liu     */
1634d4a4bc8891bbfc5a7ca842f2981829ac3a716e8Doris Liu    public void setupOneShotPreviewListener();
1644d4a4bc8891bbfc5a7ca842f2981829ac3a716e8Doris Liu
1654d4a4bc8891bbfc5a7ca842f2981829ac3a716e8Doris Liu    /**
16670da918464276b110c43868caa272c97baadb89eDoris Liu     * Gets called from module when preview aspect ratio has changed.
16770da918464276b110c43868caa272c97baadb89eDoris Liu     *
16870da918464276b110c43868caa272c97baadb89eDoris Liu     * @param aspectRatio aspect ratio of preview stream
16970da918464276b110c43868caa272c97baadb89eDoris Liu     */
17070da918464276b110c43868caa272c97baadb89eDoris Liu    public void updatePreviewAspectRatio(float aspectRatio);
17170da918464276b110c43868caa272c97baadb89eDoris Liu
17270da918464276b110c43868caa272c97baadb89eDoris Liu    /**
17302c129a598b6a165885fe950275675d62993d2eeSeth Raphael     * Gets called from module when the module needs to change the transform
17402c129a598b6a165885fe950275675d62993d2eeSeth Raphael     * matrix of the preview TextureView. It does not modify the matrix before
17502c129a598b6a165885fe950275675d62993d2eeSeth Raphael     * applying it.
17602c129a598b6a165885fe950275675d62993d2eeSeth Raphael     *
17702c129a598b6a165885fe950275675d62993d2eeSeth Raphael     * @param matrix transform matrix to be set on preview TextureView
1786382c70a769b9ec94a3b0372ee27c0cd075e8be8Seth Raphael     * @param aspectRatio the desired aspect ratio of the preview
17902c129a598b6a165885fe950275675d62993d2eeSeth Raphael     */
1806382c70a769b9ec94a3b0372ee27c0cd075e8be8Seth Raphael    public void updatePreviewTransformFullscreen(Matrix matrix, float aspectRatio);
18102c129a598b6a165885fe950275675d62993d2eeSeth Raphael
18202c129a598b6a165885fe950275675d62993d2eeSeth Raphael    /**
18302c129a598b6a165885fe950275675d62993d2eeSeth Raphael     * Call this to find the full rect available for a full screen preview
18402c129a598b6a165885fe950275675d62993d2eeSeth Raphael     *
18502c129a598b6a165885fe950275675d62993d2eeSeth Raphael     * @return the rect of the full screen minus any decor.
18602c129a598b6a165885fe950275675d62993d2eeSeth Raphael     */
18702c129a598b6a165885fe950275675d62993d2eeSeth Raphael    public RectF getFullscreenRect();
18802c129a598b6a165885fe950275675d62993d2eeSeth Raphael
18902c129a598b6a165885fe950275675d62993d2eeSeth Raphael    /**
19002c129a598b6a165885fe950275675d62993d2eeSeth Raphael     * Gets called from module when the module needs to change the transform
19102c129a598b6a165885fe950275675d62993d2eeSeth Raphael     * matrix of the preview TextureView. It is encouraged to use
19202c129a598b6a165885fe950275675d62993d2eeSeth Raphael     * {@link #updatePreviewAspectRatio(float)} over this function, unless the
19302c129a598b6a165885fe950275675d62993d2eeSeth Raphael     * module needs to rotate the surface texture using transform matrix.
19402c129a598b6a165885fe950275675d62993d2eeSeth Raphael     *
19570da918464276b110c43868caa272c97baadb89eDoris Liu     * @param matrix transform matrix to be set on preview TextureView
19670da918464276b110c43868caa272c97baadb89eDoris Liu     */
19770da918464276b110c43868caa272c97baadb89eDoris Liu    public void updatePreviewTransform(Matrix matrix);
19870da918464276b110c43868caa272c97baadb89eDoris Liu
19970da918464276b110c43868caa272c97baadb89eDoris Liu    /**
20006db742814dd635d100639f977fcfdc904deb778Doris Liu     * Sets the preview status listener, which will get notified when TextureView
20106db742814dd635d100639f977fcfdc904deb778Doris Liu     * surface has changed
20206db742814dd635d100639f977fcfdc904deb778Doris Liu     *
20306db742814dd635d100639f977fcfdc904deb778Doris Liu     * @param previewStatusListener the listener to get callbacks
20406db742814dd635d100639f977fcfdc904deb778Doris Liu     */
20506db742814dd635d100639f977fcfdc904deb778Doris Liu    public void setPreviewStatusListener(PreviewStatusListener previewStatusListener);
20606db742814dd635d100639f977fcfdc904deb778Doris Liu
20706db742814dd635d100639f977fcfdc904deb778Doris Liu    /**
20851ae7a844570f85b68a989034f7391260d88a783Angus Kong     * Returns the {@link android.widget.FrameLayout} as the root of the module
20951ae7a844570f85b68a989034f7391260d88a783Angus Kong     * layout.
210fa27423125e78f43d8dbae987c34314a238f205cAngus Kong     */
21151ae7a844570f85b68a989034f7391260d88a783Angus Kong    public FrameLayout getModuleLayoutRoot();
21251ae7a844570f85b68a989034f7391260d88a783Angus Kong
2139f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong    /**
2149f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong     * Locks the system orientation.
2159f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong     */
2169f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong    public void lockOrientation();
2179f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong
2189f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong    /**
2199f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong     * Unlocks the system orientation.
2209f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong     */
2219f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong    public void unlockOrientation();
2229f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong
22351ae7a844570f85b68a989034f7391260d88a783Angus Kong    /********************** Shutter button  **********************/
224fa27423125e78f43d8dbae987c34314a238f205cAngus Kong
225fa27423125e78f43d8dbae987c34314a238f205cAngus Kong    /**
22651ae7a844570f85b68a989034f7391260d88a783Angus Kong     * Sets the shutter events listener.
22751ae7a844570f85b68a989034f7391260d88a783Angus Kong     *
22851ae7a844570f85b68a989034f7391260d88a783Angus Kong     * @param listener The listener.
229fa27423125e78f43d8dbae987c34314a238f205cAngus Kong     */
23051ae7a844570f85b68a989034f7391260d88a783Angus Kong    public void setShutterEventsListener(ShutterEventsListener listener);
231fa27423125e78f43d8dbae987c34314a238f205cAngus Kong
232fa27423125e78f43d8dbae987c34314a238f205cAngus Kong    /**
233fa27423125e78f43d8dbae987c34314a238f205cAngus Kong     * Enables/Disables the shutter.
234fa27423125e78f43d8dbae987c34314a238f205cAngus Kong     */
235fa27423125e78f43d8dbae987c34314a238f205cAngus Kong    public void setShutterEnabled(boolean enabled);
236fa27423125e78f43d8dbae987c34314a238f205cAngus Kong
237fa27423125e78f43d8dbae987c34314a238f205cAngus Kong    /**
238fa27423125e78f43d8dbae987c34314a238f205cAngus Kong     * Checks whether the shutter is enabled.
239fa27423125e78f43d8dbae987c34314a238f205cAngus Kong     */
240fa27423125e78f43d8dbae987c34314a238f205cAngus Kong    public boolean isShutterEnabled();
241fa27423125e78f43d8dbae987c34314a238f205cAngus Kong
24251ae7a844570f85b68a989034f7391260d88a783Angus Kong    /********************** Capture animation **********************/
24351ae7a844570f85b68a989034f7391260d88a783Angus Kong
24451ae7a844570f85b68a989034f7391260d88a783Angus Kong    /**
24551ae7a844570f85b68a989034f7391260d88a783Angus Kong     * Starts the pre-capture animation.
24651ae7a844570f85b68a989034f7391260d88a783Angus Kong     */
24751ae7a844570f85b68a989034f7391260d88a783Angus Kong    public void startPreCaptureAnimation();
24851ae7a844570f85b68a989034f7391260d88a783Angus Kong
24951ae7a844570f85b68a989034f7391260d88a783Angus Kong    /**
25051ae7a844570f85b68a989034f7391260d88a783Angus Kong     * Cancels the pre-capture animation.
25151ae7a844570f85b68a989034f7391260d88a783Angus Kong     */
25251ae7a844570f85b68a989034f7391260d88a783Angus Kong    public void cancelPreCaptureAnimation();
25351ae7a844570f85b68a989034f7391260d88a783Angus Kong
25451ae7a844570f85b68a989034f7391260d88a783Angus Kong    /**
25551ae7a844570f85b68a989034f7391260d88a783Angus Kong     * Starts the post-capture animation with the current preview image.
25651ae7a844570f85b68a989034f7391260d88a783Angus Kong     */
25751ae7a844570f85b68a989034f7391260d88a783Angus Kong    public void startPostCaptureAnimation();
25851ae7a844570f85b68a989034f7391260d88a783Angus Kong
25951ae7a844570f85b68a989034f7391260d88a783Angus Kong    /**
26051ae7a844570f85b68a989034f7391260d88a783Angus Kong     * Starts the post-capture animation with the given thumbnail.
26151ae7a844570f85b68a989034f7391260d88a783Angus Kong     *
26251ae7a844570f85b68a989034f7391260d88a783Angus Kong     * @param thumbnail The thumbnail for the animation.
26351ae7a844570f85b68a989034f7391260d88a783Angus Kong     */
26451ae7a844570f85b68a989034f7391260d88a783Angus Kong    public void startPostCaptureAnimation(Bitmap thumbnail);
26551ae7a844570f85b68a989034f7391260d88a783Angus Kong
26651ae7a844570f85b68a989034f7391260d88a783Angus Kong    /**
26751ae7a844570f85b68a989034f7391260d88a783Angus Kong     * Cancels the post-capture animation.
26851ae7a844570f85b68a989034f7391260d88a783Angus Kong     */
2699f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong    public void cancelPostCaptureAnimation();
27051ae7a844570f85b68a989034f7391260d88a783Angus Kong
27151ae7a844570f85b68a989034f7391260d88a783Angus Kong    /********************** Media saving **********************/
272fa27423125e78f43d8dbae987c34314a238f205cAngus Kong
273fa27423125e78f43d8dbae987c34314a238f205cAngus Kong    /**
2749f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong     * Notifies the app of the newly captured media.
275fa27423125e78f43d8dbae987c34314a238f205cAngus Kong     */
2769f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong    public void notifyNewMedia(Uri uri);
27751ae7a844570f85b68a989034f7391260d88a783Angus Kong
27851ae7a844570f85b68a989034f7391260d88a783Angus Kong    /********************** App-level resources **********************/
27951ae7a844570f85b68a989034f7391260d88a783Angus Kong
28051ae7a844570f85b68a989034f7391260d88a783Angus Kong    /**
28113e87c4d06e96e03adc229637f07baf3b56b90d6Angus Kong     * Keeps the screen turned on.
28213e87c4d06e96e03adc229637f07baf3b56b90d6Angus Kong     *
28313e87c4d06e96e03adc229637f07baf3b56b90d6Angus Kong     * @param enabled Whether to keep the screen on.
28413e87c4d06e96e03adc229637f07baf3b56b90d6Angus Kong     */
28513e87c4d06e96e03adc229637f07baf3b56b90d6Angus Kong    public void enableKeepScreenOn(boolean enabled);
28613e87c4d06e96e03adc229637f07baf3b56b90d6Angus Kong
28713e87c4d06e96e03adc229637f07baf3b56b90d6Angus Kong    /**
28820fad249cbb587b8cf03e8e53bc64ff8e0bec7fdAngus Kong     * Returns the {@link com.android.camera.app.CameraProvider}.
28951ae7a844570f85b68a989034f7391260d88a783Angus Kong     */
29020fad249cbb587b8cf03e8e53bc64ff8e0bec7fdAngus Kong    public CameraProvider getCameraProvider();
29151ae7a844570f85b68a989034f7391260d88a783Angus Kong
29251ae7a844570f85b68a989034f7391260d88a783Angus Kong    /**
2939f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong     * Returns the {@link OrientationManagerImpl}.
29451ae7a844570f85b68a989034f7391260d88a783Angus Kong     *
29551ae7a844570f85b68a989034f7391260d88a783Angus Kong     * @return {@code null} if not available yet.
29651ae7a844570f85b68a989034f7391260d88a783Angus Kong     */
29751ae7a844570f85b68a989034f7391260d88a783Angus Kong    public OrientationManager getOrientationManager();
29851ae7a844570f85b68a989034f7391260d88a783Angus Kong
29951ae7a844570f85b68a989034f7391260d88a783Angus Kong    /**
30051ae7a844570f85b68a989034f7391260d88a783Angus Kong     * Returns the {@link com.android.camera.LocationManager}.
30151ae7a844570f85b68a989034f7391260d88a783Angus Kong     *
30251ae7a844570f85b68a989034f7391260d88a783Angus Kong     * @return {@code null} if not available yet.
30351ae7a844570f85b68a989034f7391260d88a783Angus Kong     */
30451ae7a844570f85b68a989034f7391260d88a783Angus Kong    public LocationManager getLocationManager();
305c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren
306c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren    /**
307c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren     * Returns the {@link com.android.camera.SettingsManager}.
308c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren     *
309c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren     * @return {@code null} if not available yet.
310c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren     */
311c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren    public SettingsManager getSettingsManager();
312c4e665625b88a8363fa2bd9848bf88ec9b45637fAngus Kong
313c4e665625b88a8363fa2bd9848bf88ec9b45637fAngus Kong    /**
314c4e665625b88a8363fa2bd9848bf88ec9b45637fAngus Kong     * @return Common services and functionality to be shared.
315c4e665625b88a8363fa2bd9848bf88ec9b45637fAngus Kong     */
316c4e665625b88a8363fa2bd9848bf88ec9b45637fAngus Kong    public CameraServices getServices();
317357b7673f03d9b45d281d585cc3f4f87dc7d727bErin Dahlgren
318357b7673f03d9b45d281d585cc3f4f87dc7d727bErin Dahlgren    /**
3190f3c4b4fc9ac87d7d4c3d04c3cb3426c711f57eaSpike Sprague     * Returns the {@link com.android.camera.ui.CameraAppUI}.
3200f3c4b4fc9ac87d7d4c3d04c3cb3426c711f57eaSpike Sprague     *
3210f3c4b4fc9ac87d7d4c3d04c3cb3426c711f57eaSpike Sprague     * @return {@code null} if not available yet.
3220f3c4b4fc9ac87d7d4c3d04c3cb3426c711f57eaSpike Sprague     */
3230f3c4b4fc9ac87d7d4c3d04c3cb3426c711f57eaSpike Sprague    public CameraAppUI getCameraAppUI();
3241848494bd09c85002d8c59d4feb8a6e0dc32871fErin Dahlgren
3251848494bd09c85002d8c59d4feb8a6e0dc32871fErin Dahlgren    /**
3261848494bd09c85002d8c59d4feb8a6e0dc32871fErin Dahlgren     * Returns the {@link com.android.camera.ButtonManager}.
3271848494bd09c85002d8c59d4feb8a6e0dc32871fErin Dahlgren     */
3281848494bd09c85002d8c59d4feb8a6e0dc32871fErin Dahlgren    public ButtonManager getButtonManager();
329a7cbfc04d888624858271facdbf68797c54df8b6Sascha Haeberling
330a7cbfc04d888624858271facdbf68797c54df8b6Sascha Haeberling    /** Whether auto-rotate is enabled.*/
331a7cbfc04d888624858271facdbf68797c54df8b6Sascha Haeberling    public boolean isAutoRotateScreen();
332c813ce181810a444b6fea4a399e6685aef4103e2Sascha Haeberling
333c813ce181810a444b6fea4a399e6685aef4103e2Sascha Haeberling    /**
334c813ce181810a444b6fea4a399e6685aef4103e2Sascha Haeberling     * Shows the given tutorial overlay.
335c813ce181810a444b6fea4a399e6685aef4103e2Sascha Haeberling     */
336c813ce181810a444b6fea4a399e6685aef4103e2Sascha Haeberling    public void showTutorial(AbstractTutorialOverlay tutorial);
337fa27423125e78f43d8dbae987c34314a238f205cAngus Kong}
338