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; 312d4be2576b265a4abfbabbda20862fcea19c1395Sascha Haeberlingimport com.android.camera.SoundPlayer; 32e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberlingimport com.android.camera.module.ModuleController; 3308b3c94a7d7aff30b5da8e99649346e37b67a5c5Sascha Haeberlingimport com.android.camera.one.OneCameraManager; 34357b7673f03d9b45d281d585cc3f4f87dc7d727bErin Dahlgrenimport com.android.camera.settings.SettingsManager; 35c813ce181810a444b6fea4a399e6685aef4103e2Sascha Haeberlingimport com.android.camera.ui.AbstractTutorialOverlay; 3606db742814dd635d100639f977fcfdc904deb778Doris Liuimport com.android.camera.ui.PreviewStatusListener; 37fa27423125e78f43d8dbae987c34314a238f205cAngus Kong 38fa27423125e78f43d8dbae987c34314a238f205cAngus Kong/** 39fa27423125e78f43d8dbae987c34314a238f205cAngus Kong * The controller at app level. 40fa27423125e78f43d8dbae987c34314a238f205cAngus Kong */ 41831347d9cb5c0e3f03db7aadfc89e91b231104e7Angus Kongpublic interface AppController { 42fa27423125e78f43d8dbae987c34314a238f205cAngus Kong 43fa27423125e78f43d8dbae987c34314a238f205cAngus Kong /** 4451ae7a844570f85b68a989034f7391260d88a783Angus Kong * An interface which defines the shutter events listener. 45fa27423125e78f43d8dbae987c34314a238f205cAngus Kong */ 4651ae7a844570f85b68a989034f7391260d88a783Angus Kong public interface ShutterEventsListener { 4751ae7a844570f85b68a989034f7391260d88a783Angus Kong /** 4851ae7a844570f85b68a989034f7391260d88a783Angus Kong * Called when the shutter state is changed to pressed. 4951ae7a844570f85b68a989034f7391260d88a783Angus Kong */ 5051ae7a844570f85b68a989034f7391260d88a783Angus Kong public void onShutterPressed(); 5151ae7a844570f85b68a989034f7391260d88a783Angus Kong 5251ae7a844570f85b68a989034f7391260d88a783Angus Kong /** 5351ae7a844570f85b68a989034f7391260d88a783Angus Kong * Called when the shutter state is changed to released. 5451ae7a844570f85b68a989034f7391260d88a783Angus Kong */ 5551ae7a844570f85b68a989034f7391260d88a783Angus Kong public void onShutterReleased(); 5651ae7a844570f85b68a989034f7391260d88a783Angus Kong 5751ae7a844570f85b68a989034f7391260d88a783Angus Kong /** 5851ae7a844570f85b68a989034f7391260d88a783Angus Kong * Called when the shutter is clicked. 5951ae7a844570f85b68a989034f7391260d88a783Angus Kong */ 6051ae7a844570f85b68a989034f7391260d88a783Angus Kong public void onShutterClicked(); 61fa27423125e78f43d8dbae987c34314a238f205cAngus Kong 6251ae7a844570f85b68a989034f7391260d88a783Angus Kong /** 6351ae7a844570f85b68a989034f7391260d88a783Angus Kong * Called when the shutter is long pressed. 6451ae7a844570f85b68a989034f7391260d88a783Angus Kong */ 6551ae7a844570f85b68a989034f7391260d88a783Angus Kong public void onShutterLongPressed(); 6651ae7a844570f85b68a989034f7391260d88a783Angus Kong } 67fa27423125e78f43d8dbae987c34314a238f205cAngus Kong 68fa27423125e78f43d8dbae987c34314a238f205cAngus Kong /** 690eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong * @return the {@link android.content.Context} being used. 70fa27423125e78f43d8dbae987c34314a238f205cAngus Kong */ 7151ae7a844570f85b68a989034f7391260d88a783Angus Kong public Context getAndroidContext(); 7251ae7a844570f85b68a989034f7391260d88a783Angus Kong 73c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren /** 746190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren * @return the current camera id. 756190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren */ 766190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren public int getCurrentCameraId(); 776190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren 786190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren /** 796190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren * @return a String scope uniquely identifing the current module. 806190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren */ 816190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren public String getModuleScope(); 826190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren 836190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren /** 846190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren * @return a String scope uniquely identifing the current camera id. 856190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren */ 866190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren public String getCameraScope(); 876190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren 886190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren /** 890eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong * Starts an activity. 900eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong * 910eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong * @param intent Used to start the activity. 920eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong */ 930eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong public void launchActivityByIntent(Intent intent); 940eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong 950eaf01670a1198c95b6472ec0dc076c9f84971deAngus Kong /** 96e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling * See {@link Activity#openContextMenu(View)} 97e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling */ 98e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling public void openContextMenu(View view); 99e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling 100e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling /** 101e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling * See {@link Activity#registerForContextMenu(View)} 102e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling */ 103e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling public void registerForContextMenu(View view); 104e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling 105e8959e7a72cd6f057ac4cd8bd47075272700e62eSascha Haeberling /** 106c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren * Returns whether the app is currently paused. 107c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren */ 108c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren public boolean isPaused(); 109c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren 110f55f3c461c5a6ae6b61fa75562ca01683aa93f9aDoris Liu /** 1110a6a8d8e4e1c9796aac606379a42970cdffb8911Erin Dahlgren * Returns the current module controller. 1120a6a8d8e4e1c9796aac606379a42970cdffb8911Erin Dahlgren */ 1130a6a8d8e4e1c9796aac606379a42970cdffb8911Erin Dahlgren public ModuleController getCurrentModuleController(); 1140a6a8d8e4e1c9796aac606379a42970cdffb8911Erin Dahlgren 1150a6a8d8e4e1c9796aac606379a42970cdffb8911Erin Dahlgren /** 116831347d9cb5c0e3f03db7aadfc89e91b231104e7Angus Kong * Returns the currently active module index. 117831347d9cb5c0e3f03db7aadfc89e91b231104e7Angus Kong */ 118831347d9cb5c0e3f03db7aadfc89e91b231104e7Angus Kong public int getCurrentModuleIndex(); 119831347d9cb5c0e3f03db7aadfc89e91b231104e7Angus Kong 120831347d9cb5c0e3f03db7aadfc89e91b231104e7Angus Kong /** 121bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu * Gets the mode that can be switched to from the given mode id through 122bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu * quick switch. 123bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu * 124bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu * @param currentModuleIndex index of the current mode 125bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu * @return mode id to quick switch to if index is valid, otherwise returns 126bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu * the given mode id itself 127bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu */ 128bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu public int getQuickSwitchToModuleId(int currentModuleIndex); 129bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu 130bd1b8f910d6f2c94daac304f4bd1a098939474c3Doris Liu /** 1311ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren * Based on a mode switcher index, choose the correct module index. 1321ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren * 1331ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren * @param modeIndex mode switcher index. 1341ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren * @return module index. 1351ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren */ 1361ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren public int getPreferredChildModeIndex(int modeIndex); 1371ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren 1381ba90e3ea4b8280c28cf6d87e5b4cc6b3b5f1645Erin Dahlgren /** 139f55f3c461c5a6ae6b61fa75562ca01683aa93f9aDoris Liu * This gets called when mode is changed. 140f55f3c461c5a6ae6b61fa75562ca01683aa93f9aDoris Liu * 141f55f3c461c5a6ae6b61fa75562ca01683aa93f9aDoris Liu * @param moduleIndex index of the new module to switch to 142f55f3c461c5a6ae6b61fa75562ca01683aa93f9aDoris Liu */ 143f55f3c461c5a6ae6b61fa75562ca01683aa93f9aDoris Liu public void onModeSelected(int moduleIndex); 144f55f3c461c5a6ae6b61fa75562ca01683aa93f9aDoris Liu 1459d264309a341c52601bdccdeff6647e0ce58c31fDoris Liu /** 1469d264309a341c52601bdccdeff6647e0ce58c31fDoris Liu * This gets called when settings is selected and settings dialog needs to open. 1479d264309a341c52601bdccdeff6647e0ce58c31fDoris Liu */ 1489d264309a341c52601bdccdeff6647e0ce58c31fDoris Liu public void onSettingsSelected(); 1499d264309a341c52601bdccdeff6647e0ce58c31fDoris Liu 1509f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong /********************** UI / Camera preview **********************/ 151fa27423125e78f43d8dbae987c34314a238f205cAngus Kong 1526809eb840f358430d3032c0532fb42d6dcfd06efDoris Liu 1536809eb840f358430d3032c0532fb42d6dcfd06efDoris Liu /** 1546809eb840f358430d3032c0532fb42d6dcfd06efDoris Liu * Freeze what is currently shown on screen until the next preview frame comes 1556809eb840f358430d3032c0532fb42d6dcfd06efDoris Liu * in. This can be used for camera switch to hide the UI changes underneath 1566809eb840f358430d3032c0532fb42d6dcfd06efDoris Liu * until preview is ready. 1576809eb840f358430d3032c0532fb42d6dcfd06efDoris Liu */ 1586809eb840f358430d3032c0532fb42d6dcfd06efDoris Liu public void freezeScreenUntilPreviewReady(); 1596809eb840f358430d3032c0532fb42d6dcfd06efDoris Liu 160fa27423125e78f43d8dbae987c34314a238f205cAngus Kong /** 16151ae7a844570f85b68a989034f7391260d88a783Angus Kong * Returns the {@link android.graphics.SurfaceTexture} used by the preview 16251ae7a844570f85b68a989034f7391260d88a783Angus Kong * UI. 163fa27423125e78f43d8dbae987c34314a238f205cAngus Kong */ 16451ae7a844570f85b68a989034f7391260d88a783Angus Kong public SurfaceTexture getPreviewBuffer(); 165fa27423125e78f43d8dbae987c34314a238f205cAngus Kong 166fa27423125e78f43d8dbae987c34314a238f205cAngus Kong /** 1675a367545ab931a308c8d8555ef5a747dc9565cafDoris Liu * Gets called from module when preview is ready to start. 1685a367545ab931a308c8d8555ef5a747dc9565cafDoris Liu */ 1695a367545ab931a308c8d8555ef5a747dc9565cafDoris Liu public void onPreviewReadyToStart(); 1705a367545ab931a308c8d8555ef5a747dc9565cafDoris Liu 1715a367545ab931a308c8d8555ef5a747dc9565cafDoris Liu /** 1722b906b8c9754b564d5113c7a342654c82f97f180Doris Liu * Gets called from module when preview is started. 1732b906b8c9754b564d5113c7a342654c82f97f180Doris Liu */ 1742b906b8c9754b564d5113c7a342654c82f97f180Doris Liu public void onPreviewStarted(); 1752b906b8c9754b564d5113c7a342654c82f97f180Doris Liu 1762b906b8c9754b564d5113c7a342654c82f97f180Doris Liu /** 1772bacca795a1b0adb0daf515c43c48234b44bbba5Angus Kong * Adds a listener to receive callbacks when preview area changes. 178482de029dc20e0a577388a602985fb31c3200309Doris Liu */ 179482de029dc20e0a577388a602985fb31c3200309Doris Liu public void addPreviewAreaSizeChangedListener( 1802bacca795a1b0adb0daf515c43c48234b44bbba5Angus Kong PreviewStatusListener.PreviewAreaChangedListener listener); 181482de029dc20e0a577388a602985fb31c3200309Doris Liu 182482de029dc20e0a577388a602985fb31c3200309Doris Liu /** 1832bacca795a1b0adb0daf515c43c48234b44bbba5Angus Kong * Removes a listener that receives callbacks when preview area changes. 184482de029dc20e0a577388a602985fb31c3200309Doris Liu */ 185482de029dc20e0a577388a602985fb31c3200309Doris Liu public void removePreviewAreaSizeChangedListener( 1862bacca795a1b0adb0daf515c43c48234b44bbba5Angus Kong PreviewStatusListener.PreviewAreaChangedListener listener); 187482de029dc20e0a577388a602985fb31c3200309Doris Liu 188482de029dc20e0a577388a602985fb31c3200309Doris Liu /** 1894d4a4bc8891bbfc5a7ca842f2981829ac3a716e8Doris Liu * Sets up one shot preview callback in order to notify UI when the next 1904d4a4bc8891bbfc5a7ca842f2981829ac3a716e8Doris Liu * preview frame comes in. 1914d4a4bc8891bbfc5a7ca842f2981829ac3a716e8Doris Liu */ 1924d4a4bc8891bbfc5a7ca842f2981829ac3a716e8Doris Liu public void setupOneShotPreviewListener(); 1934d4a4bc8891bbfc5a7ca842f2981829ac3a716e8Doris Liu 1944d4a4bc8891bbfc5a7ca842f2981829ac3a716e8Doris Liu /** 19570da918464276b110c43868caa272c97baadb89eDoris Liu * Gets called from module when preview aspect ratio has changed. 19670da918464276b110c43868caa272c97baadb89eDoris Liu * 19770da918464276b110c43868caa272c97baadb89eDoris Liu * @param aspectRatio aspect ratio of preview stream 19870da918464276b110c43868caa272c97baadb89eDoris Liu */ 19970da918464276b110c43868caa272c97baadb89eDoris Liu public void updatePreviewAspectRatio(float aspectRatio); 20070da918464276b110c43868caa272c97baadb89eDoris Liu 20170da918464276b110c43868caa272c97baadb89eDoris Liu /** 20202c129a598b6a165885fe950275675d62993d2eeSeth Raphael * Gets called from module when the module needs to change the transform 20302c129a598b6a165885fe950275675d62993d2eeSeth Raphael * matrix of the preview TextureView. It does not modify the matrix before 20402c129a598b6a165885fe950275675d62993d2eeSeth Raphael * applying it. 20508b3c94a7d7aff30b5da8e99649346e37b67a5c5Sascha Haeberling * 20602c129a598b6a165885fe950275675d62993d2eeSeth Raphael * @param matrix transform matrix to be set on preview TextureView 2076382c70a769b9ec94a3b0372ee27c0cd075e8be8Seth Raphael * @param aspectRatio the desired aspect ratio of the preview 20802c129a598b6a165885fe950275675d62993d2eeSeth Raphael */ 2096382c70a769b9ec94a3b0372ee27c0cd075e8be8Seth Raphael public void updatePreviewTransformFullscreen(Matrix matrix, float aspectRatio); 21002c129a598b6a165885fe950275675d62993d2eeSeth Raphael 21102c129a598b6a165885fe950275675d62993d2eeSeth Raphael /** 21202c129a598b6a165885fe950275675d62993d2eeSeth Raphael * Call this to find the full rect available for a full screen preview 21308b3c94a7d7aff30b5da8e99649346e37b67a5c5Sascha Haeberling * 21402c129a598b6a165885fe950275675d62993d2eeSeth Raphael * @return the rect of the full screen minus any decor. 21502c129a598b6a165885fe950275675d62993d2eeSeth Raphael */ 21602c129a598b6a165885fe950275675d62993d2eeSeth Raphael public RectF getFullscreenRect(); 21702c129a598b6a165885fe950275675d62993d2eeSeth Raphael 21802c129a598b6a165885fe950275675d62993d2eeSeth Raphael /** 21902c129a598b6a165885fe950275675d62993d2eeSeth Raphael * Gets called from module when the module needs to change the transform 22002c129a598b6a165885fe950275675d62993d2eeSeth Raphael * matrix of the preview TextureView. It is encouraged to use 22102c129a598b6a165885fe950275675d62993d2eeSeth Raphael * {@link #updatePreviewAspectRatio(float)} over this function, unless the 22202c129a598b6a165885fe950275675d62993d2eeSeth Raphael * module needs to rotate the surface texture using transform matrix. 22308b3c94a7d7aff30b5da8e99649346e37b67a5c5Sascha Haeberling * 22470da918464276b110c43868caa272c97baadb89eDoris Liu * @param matrix transform matrix to be set on preview TextureView 22570da918464276b110c43868caa272c97baadb89eDoris Liu */ 22670da918464276b110c43868caa272c97baadb89eDoris Liu public void updatePreviewTransform(Matrix matrix); 22770da918464276b110c43868caa272c97baadb89eDoris Liu 22870da918464276b110c43868caa272c97baadb89eDoris Liu /** 22906db742814dd635d100639f977fcfdc904deb778Doris Liu * Sets the preview status listener, which will get notified when TextureView 23006db742814dd635d100639f977fcfdc904deb778Doris Liu * surface has changed 23106db742814dd635d100639f977fcfdc904deb778Doris Liu * 23206db742814dd635d100639f977fcfdc904deb778Doris Liu * @param previewStatusListener the listener to get callbacks 23306db742814dd635d100639f977fcfdc904deb778Doris Liu */ 23406db742814dd635d100639f977fcfdc904deb778Doris Liu public void setPreviewStatusListener(PreviewStatusListener previewStatusListener); 23506db742814dd635d100639f977fcfdc904deb778Doris Liu 23606db742814dd635d100639f977fcfdc904deb778Doris Liu /** 23751ae7a844570f85b68a989034f7391260d88a783Angus Kong * Returns the {@link android.widget.FrameLayout} as the root of the module 23851ae7a844570f85b68a989034f7391260d88a783Angus Kong * layout. 239fa27423125e78f43d8dbae987c34314a238f205cAngus Kong */ 24051ae7a844570f85b68a989034f7391260d88a783Angus Kong public FrameLayout getModuleLayoutRoot(); 24151ae7a844570f85b68a989034f7391260d88a783Angus Kong 2429f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong /** 2439f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong * Locks the system orientation. 2449f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong */ 2459f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong public void lockOrientation(); 2469f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong 2479f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong /** 2489f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong * Unlocks the system orientation. 2499f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong */ 2509f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong public void unlockOrientation(); 2519f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong 25251ae7a844570f85b68a989034f7391260d88a783Angus Kong /********************** Shutter button **********************/ 253fa27423125e78f43d8dbae987c34314a238f205cAngus Kong 254fa27423125e78f43d8dbae987c34314a238f205cAngus Kong /** 25551ae7a844570f85b68a989034f7391260d88a783Angus Kong * Sets the shutter events listener. 25651ae7a844570f85b68a989034f7391260d88a783Angus Kong * 25751ae7a844570f85b68a989034f7391260d88a783Angus Kong * @param listener The listener. 258fa27423125e78f43d8dbae987c34314a238f205cAngus Kong */ 25951ae7a844570f85b68a989034f7391260d88a783Angus Kong public void setShutterEventsListener(ShutterEventsListener listener); 260fa27423125e78f43d8dbae987c34314a238f205cAngus Kong 261fa27423125e78f43d8dbae987c34314a238f205cAngus Kong /** 262fa27423125e78f43d8dbae987c34314a238f205cAngus Kong * Enables/Disables the shutter. 263fa27423125e78f43d8dbae987c34314a238f205cAngus Kong */ 264fa27423125e78f43d8dbae987c34314a238f205cAngus Kong public void setShutterEnabled(boolean enabled); 265fa27423125e78f43d8dbae987c34314a238f205cAngus Kong 266fa27423125e78f43d8dbae987c34314a238f205cAngus Kong /** 267fa27423125e78f43d8dbae987c34314a238f205cAngus Kong * Checks whether the shutter is enabled. 268fa27423125e78f43d8dbae987c34314a238f205cAngus Kong */ 269fa27423125e78f43d8dbae987c34314a238f205cAngus Kong public boolean isShutterEnabled(); 270fa27423125e78f43d8dbae987c34314a238f205cAngus Kong 27151ae7a844570f85b68a989034f7391260d88a783Angus Kong /********************** Capture animation **********************/ 27251ae7a844570f85b68a989034f7391260d88a783Angus Kong 27351ae7a844570f85b68a989034f7391260d88a783Angus Kong /** 27417d9084e38e64f06a9d411d64fe3c2739d299cdaAndy Huibers * Starts the pre-capture animation with optional shorter flash. 27517d9084e38e64f06a9d411d64fe3c2739d299cdaAndy Huibers * 27617d9084e38e64f06a9d411d64fe3c2739d299cdaAndy Huibers * @param shortFlash true for shorter flash (faster cameras). 27717d9084e38e64f06a9d411d64fe3c2739d299cdaAndy Huibers */ 27817d9084e38e64f06a9d411d64fe3c2739d299cdaAndy Huibers public void startPreCaptureAnimation(boolean shortFlash); 27917d9084e38e64f06a9d411d64fe3c2739d299cdaAndy Huibers 28017d9084e38e64f06a9d411d64fe3c2739d299cdaAndy Huibers /** 28117d9084e38e64f06a9d411d64fe3c2739d299cdaAndy Huibers * Starts normal pre-capture animation. 28251ae7a844570f85b68a989034f7391260d88a783Angus Kong */ 28351ae7a844570f85b68a989034f7391260d88a783Angus Kong public void startPreCaptureAnimation(); 28451ae7a844570f85b68a989034f7391260d88a783Angus Kong 28551ae7a844570f85b68a989034f7391260d88a783Angus Kong /** 28651ae7a844570f85b68a989034f7391260d88a783Angus Kong * Cancels the pre-capture animation. 28751ae7a844570f85b68a989034f7391260d88a783Angus Kong */ 28851ae7a844570f85b68a989034f7391260d88a783Angus Kong public void cancelPreCaptureAnimation(); 28951ae7a844570f85b68a989034f7391260d88a783Angus Kong 29051ae7a844570f85b68a989034f7391260d88a783Angus Kong /** 29151ae7a844570f85b68a989034f7391260d88a783Angus Kong * Starts the post-capture animation with the current preview image. 29251ae7a844570f85b68a989034f7391260d88a783Angus Kong */ 29351ae7a844570f85b68a989034f7391260d88a783Angus Kong public void startPostCaptureAnimation(); 29451ae7a844570f85b68a989034f7391260d88a783Angus Kong 29551ae7a844570f85b68a989034f7391260d88a783Angus Kong /** 29651ae7a844570f85b68a989034f7391260d88a783Angus Kong * Starts the post-capture animation with the given thumbnail. 29751ae7a844570f85b68a989034f7391260d88a783Angus Kong * 29851ae7a844570f85b68a989034f7391260d88a783Angus Kong * @param thumbnail The thumbnail for the animation. 29951ae7a844570f85b68a989034f7391260d88a783Angus Kong */ 30051ae7a844570f85b68a989034f7391260d88a783Angus Kong public void startPostCaptureAnimation(Bitmap thumbnail); 30151ae7a844570f85b68a989034f7391260d88a783Angus Kong 30251ae7a844570f85b68a989034f7391260d88a783Angus Kong /** 30351ae7a844570f85b68a989034f7391260d88a783Angus Kong * Cancels the post-capture animation. 30451ae7a844570f85b68a989034f7391260d88a783Angus Kong */ 3059f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong public void cancelPostCaptureAnimation(); 30651ae7a844570f85b68a989034f7391260d88a783Angus Kong 30751ae7a844570f85b68a989034f7391260d88a783Angus Kong /********************** Media saving **********************/ 308fa27423125e78f43d8dbae987c34314a238f205cAngus Kong 309fa27423125e78f43d8dbae987c34314a238f205cAngus Kong /** 3109f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong * Notifies the app of the newly captured media. 311fa27423125e78f43d8dbae987c34314a238f205cAngus Kong */ 3129f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong public void notifyNewMedia(Uri uri); 31351ae7a844570f85b68a989034f7391260d88a783Angus Kong 31451ae7a844570f85b68a989034f7391260d88a783Angus Kong /********************** App-level resources **********************/ 31551ae7a844570f85b68a989034f7391260d88a783Angus Kong 31651ae7a844570f85b68a989034f7391260d88a783Angus Kong /** 31713e87c4d06e96e03adc229637f07baf3b56b90d6Angus Kong * Keeps the screen turned on. 31813e87c4d06e96e03adc229637f07baf3b56b90d6Angus Kong * 31913e87c4d06e96e03adc229637f07baf3b56b90d6Angus Kong * @param enabled Whether to keep the screen on. 32013e87c4d06e96e03adc229637f07baf3b56b90d6Angus Kong */ 32113e87c4d06e96e03adc229637f07baf3b56b90d6Angus Kong public void enableKeepScreenOn(boolean enabled); 32213e87c4d06e96e03adc229637f07baf3b56b90d6Angus Kong 32313e87c4d06e96e03adc229637f07baf3b56b90d6Angus Kong /** 32420fad249cbb587b8cf03e8e53bc64ff8e0bec7fdAngus Kong * Returns the {@link com.android.camera.app.CameraProvider}. 32551ae7a844570f85b68a989034f7391260d88a783Angus Kong */ 32620fad249cbb587b8cf03e8e53bc64ff8e0bec7fdAngus Kong public CameraProvider getCameraProvider(); 32751ae7a844570f85b68a989034f7391260d88a783Angus Kong 32851ae7a844570f85b68a989034f7391260d88a783Angus Kong /** 32908b3c94a7d7aff30b5da8e99649346e37b67a5c5Sascha Haeberling * Returns the new camera API manager. 33008b3c94a7d7aff30b5da8e99649346e37b67a5c5Sascha Haeberling */ 33108b3c94a7d7aff30b5da8e99649346e37b67a5c5Sascha Haeberling public OneCameraManager getCameraManager(); 33208b3c94a7d7aff30b5da8e99649346e37b67a5c5Sascha Haeberling 33308b3c94a7d7aff30b5da8e99649346e37b67a5c5Sascha Haeberling /** 3349f1db5210361802a30a7866825c3b29ef5fe0024Angus Kong * Returns the {@link OrientationManagerImpl}. 33551ae7a844570f85b68a989034f7391260d88a783Angus Kong * 33651ae7a844570f85b68a989034f7391260d88a783Angus Kong * @return {@code null} if not available yet. 33751ae7a844570f85b68a989034f7391260d88a783Angus Kong */ 33851ae7a844570f85b68a989034f7391260d88a783Angus Kong public OrientationManager getOrientationManager(); 33951ae7a844570f85b68a989034f7391260d88a783Angus Kong 34051ae7a844570f85b68a989034f7391260d88a783Angus Kong /** 34151ae7a844570f85b68a989034f7391260d88a783Angus Kong * Returns the {@link com.android.camera.LocationManager}. 34251ae7a844570f85b68a989034f7391260d88a783Angus Kong * 34351ae7a844570f85b68a989034f7391260d88a783Angus Kong * @return {@code null} if not available yet. 34451ae7a844570f85b68a989034f7391260d88a783Angus Kong */ 34551ae7a844570f85b68a989034f7391260d88a783Angus Kong public LocationManager getLocationManager(); 346c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren 347c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren /** 348c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren * Returns the {@link com.android.camera.SettingsManager}. 349c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren * 350c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren * @return {@code null} if not available yet. 351c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren */ 352c120b0f6e5ea919fcbb87f832a2b6c82509a2114Erin Dahlgren public SettingsManager getSettingsManager(); 353c4e665625b88a8363fa2bd9848bf88ec9b45637fAngus Kong 354c4e665625b88a8363fa2bd9848bf88ec9b45637fAngus Kong /** 355c4e665625b88a8363fa2bd9848bf88ec9b45637fAngus Kong * @return Common services and functionality to be shared. 356c4e665625b88a8363fa2bd9848bf88ec9b45637fAngus Kong */ 357c4e665625b88a8363fa2bd9848bf88ec9b45637fAngus Kong public CameraServices getServices(); 358357b7673f03d9b45d281d585cc3f4f87dc7d727bErin Dahlgren 359357b7673f03d9b45d281d585cc3f4f87dc7d727bErin Dahlgren /** 3606190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren * Returns the {@link com.android.camera.app.CameraAppUI}. 3610f3c4b4fc9ac87d7d4c3d04c3cb3426c711f57eaSpike Sprague * 3620f3c4b4fc9ac87d7d4c3d04c3cb3426c711f57eaSpike Sprague * @return {@code null} if not available yet. 3630f3c4b4fc9ac87d7d4c3d04c3cb3426c711f57eaSpike Sprague */ 3640f3c4b4fc9ac87d7d4c3d04c3cb3426c711f57eaSpike Sprague public CameraAppUI getCameraAppUI(); 3651848494bd09c85002d8c59d4feb8a6e0dc32871fErin Dahlgren 3661848494bd09c85002d8c59d4feb8a6e0dc32871fErin Dahlgren /** 3676190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren * Returns the {@link com.android.camera.app.ModuleManager}. 3686190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren * 3696190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren * @return {@code null} if not available yet. 3706190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren */ 3716190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren public ModuleManager getModuleManager(); 3726190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren 3736190c36db653e848f29d1caefc4fa1bb61e8a662Erin Dahlgren /** 3741848494bd09c85002d8c59d4feb8a6e0dc32871fErin Dahlgren * Returns the {@link com.android.camera.ButtonManager}. 3751848494bd09c85002d8c59d4feb8a6e0dc32871fErin Dahlgren */ 3761848494bd09c85002d8c59d4feb8a6e0dc32871fErin Dahlgren public ButtonManager getButtonManager(); 377a7cbfc04d888624858271facdbf68797c54df8b6Sascha Haeberling 3782d4be2576b265a4abfbabbda20862fcea19c1395Sascha Haeberling /** Returns a sound player that can be used to play custom sounds. */ 3792d4be2576b265a4abfbabbda20862fcea19c1395Sascha Haeberling public SoundPlayer getSoundPlayer(); 3802d4be2576b265a4abfbabbda20862fcea19c1395Sascha Haeberling 381a7cbfc04d888624858271facdbf68797c54df8b6Sascha Haeberling /** Whether auto-rotate is enabled.*/ 382a7cbfc04d888624858271facdbf68797c54df8b6Sascha Haeberling public boolean isAutoRotateScreen(); 383c813ce181810a444b6fea4a399e6685aef4103e2Sascha Haeberling 384c813ce181810a444b6fea4a399e6685aef4103e2Sascha Haeberling /** 385c813ce181810a444b6fea4a399e6685aef4103e2Sascha Haeberling * Shows the given tutorial overlay. 386c813ce181810a444b6fea4a399e6685aef4103e2Sascha Haeberling */ 387c813ce181810a444b6fea4a399e6685aef4103e2Sascha Haeberling public void showTutorial(AbstractTutorialOverlay tutorial); 3880cf4a02c13a7710dc9b26ac39bea15a95ac48bafSascha Haeberling 3890cf4a02c13a7710dc9b26ac39bea15a95ac48bafSascha Haeberling /** 3900cf4a02c13a7710dc9b26ac39bea15a95ac48bafSascha Haeberling * Shows and error message on the screen and, when dismissed, exits the 3910cf4a02c13a7710dc9b26ac39bea15a95ac48bafSascha Haeberling * activity. 3920cf4a02c13a7710dc9b26ac39bea15a95ac48bafSascha Haeberling * 3930cf4a02c13a7710dc9b26ac39bea15a95ac48bafSascha Haeberling * @param messageId the ID of the message to show on screen before exiting. 3940cf4a02c13a7710dc9b26ac39bea15a95ac48bafSascha Haeberling */ 3950cf4a02c13a7710dc9b26ac39bea15a95ac48bafSascha Haeberling public void showErrorAndFinish(int messageId); 396fa27423125e78f43d8dbae987c34314a238f205cAngus Kong} 397