diff options
author | Paul Rohde <codelogic@google.com> | 2014-12-05 12:17:15 -0800 |
---|---|---|
committer | Michael Bestas <mikeioannina@gmail.com> | 2017-01-04 21:57:44 +0200 |
commit | a83d9afd1b0eab6f5ad5aaf300ae7e5e6eb2c092 (patch) | |
tree | d807835b35152ff8116abf6bfbb0e1c34ad3074e /src/com/android/camera/PhotoModule.java | |
parent | e29d34af65c92b85f43ec114fa8d13391bffabab (diff) | |
download | android_packages_apps_Snap-a83d9afd1b0eab6f5ad5aaf300ae7e5e6eb2c092.tar.gz android_packages_apps_Snap-a83d9afd1b0eab6f5ad5aaf300ae7e5e6eb2c092.tar.bz2 android_packages_apps_Snap-a83d9afd1b0eab6f5ad5aaf300ae7e5e6eb2c092.zip |
Drop new focus indicator into Camera2.
* Create a new custom focus view that interacts with physical lens diopter changes.
* Replace all occurances of the old focus indicator with the new one.
Change-Id: Ia02646ce4d1eb059ecb8a1dfccc15dfc9c167e1b
Diffstat (limited to 'src/com/android/camera/PhotoModule.java')
-rwxr-xr-x | src/com/android/camera/PhotoModule.java | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index 7d4af4454..3123bfd36 100755 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -710,7 +710,7 @@ public class PhotoModule Log.v(TAG, "onCameraOpened"); openCameraCommon(); resizeForPreviewAspectRatio(); - updateFocusManager(mUI); + mFocusManager.setFocusRing(mUI.getFocusRing()); } private void switchCamera() { @@ -743,7 +743,6 @@ public class PhotoModule } closeCamera(); mUI.collapseCameraControls(); - mUI.clearFaces(); if (mFocusManager != null) mFocusManager.removeMessages(); // Restart the camera and initialize the UI. From onCreate. @@ -1009,7 +1008,6 @@ public class PhotoModule if (mParameters.getMaxNumDetectedFaces() > 0) { mFaceDetectionStarted = false; mCameraDevice.setFaceDetectionCallback(null, null); - mUI.pauseFaceDetection(); mCameraDevice.stopFaceDetection(); mUI.onStopFaceDetection(); } @@ -1227,8 +1225,6 @@ public class PhotoModule return; } - mFocusManager.updateFocusUI(); // Ensure focus indicator is hidden. - String jpegFilePath = new String(jpegData); mNamedImages.nameNewImage(mCaptureStartTime); NamedEntity name = mNamedImages.getNextNameEntity(); @@ -1344,8 +1340,6 @@ public class PhotoModule Log.v(TAG, "mPictureDisplayedToJpegCallbackTime = " + mPictureDisplayedToJpegCallbackTime + "ms"); - mFocusManager.updateFocusUI(); // Ensure focus indicator is hidden. - boolean needRestartPreview = !mIsImageCaptureIntent && !mPreviewRestartSupport && (mCameraState != LONGSHOT) @@ -1384,7 +1378,6 @@ public class PhotoModule || CameraUtil.FOCUS_MODE_MW_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) { mCameraDevice.cancelAutoFocus(); } - mUI.resumeFaceDetection(); if (!mIsImageCaptureIntent) { setCameraState(IDLE); } @@ -2284,7 +2277,7 @@ public class PhotoModule setCameraState(IDLE); mFocusManager.resetTouchFocus(); if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals( - mFocusManager.getFocusMode())) { + mFocusManager.getFocusMode(false))) { mCameraDevice.cancelAutoFocus(); } mUI.resumeFaceDetection(); @@ -2684,22 +2677,12 @@ public class PhotoModule if (mFocusManager == null) { mFocusManager = new FocusOverlayManager(mPreferences, defaultFocusModes, mInitialParams, this, mMirror, - mActivity.getMainLooper(), mUI); + mActivity.getMainLooper(), mUI != null ? mUI.getFocusRing() : null); } } } } - private void updateFocusManager(PhotoUI mUI) { - // Idea here is to let focus manager create in camera open thread - // (in initializeFocusManager) even if photoUI is null by that time so - // as to not block start preview process. Once UI creation is done, - // we will update focus manager with proper UI. - if (mFocusManager != null && mUI != null) { - mFocusManager.setPhotoUI(mUI); - } - } - @Override public void onConfigurationChanged(Configuration newConfig) { Log.v(TAG, "onConfigurationChanged"); @@ -2776,7 +2759,6 @@ public class PhotoModule } // Check if metering area or focus area is supported. if (!mFocusAreaSupported && !mMeteringAreaSupported) return; - if (! mFocusManager.getPreviewRect().contains(x, y)) return; mFocusManager.onSingleTapUp(x, y); } @@ -3711,9 +3693,9 @@ public class PhotoModule mParameters.setFlashMode(fMode); } - if(!mFocusManager.getFocusMode().equals(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE) && + if(!mFocusManager.getFocusMode(false).equals(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE) && !mFocusManager.isFocusCompleted()) { - mUI.clearFocus(); + mUI.getFocusRing().stopFocusAnimations(); } } |