diff options
author | likaid <likaid@codeaurora.org> | 2015-03-21 09:42:17 +0800 |
---|---|---|
committer | likaid <likaid@codeaurora.org> | 2015-03-21 09:42:18 +0800 |
commit | b27ff6151f0ded21e0742206fab4d2f905a64f74 (patch) | |
tree | ddfc20a176ba0e4420f6fa472fd6e1c71a35a0b6 /src/com/android | |
parent | 40164962c72f9a5032a07fc03fee4f791eb7d62b (diff) | |
download | android_packages_apps_Snap-b27ff6151f0ded21e0742206fab4d2f905a64f74.tar.gz android_packages_apps_Snap-b27ff6151f0ded21e0742206fab4d2f905a64f74.tar.bz2 android_packages_apps_Snap-b27ff6151f0ded21e0742206fab4d2f905a64f74.zip |
SnapdragonCamera: Stop panorama capture when move to opposite direction
In panorama capture mode, when user moved to the opposite from the
original direction, stop the capture and save current picture.
Change-Id: I716a08f2fc497301fb8a6c6a124211b855cd9a77
CRs-Fixed: 801022
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/camera/PanoProgressBar.java | 12 | ||||
-rw-r--r-- | src/com/android/camera/WideAnglePanoramaModule.java | 11 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/com/android/camera/PanoProgressBar.java b/src/com/android/camera/PanoProgressBar.java index 2a0589066..d20878a84 100644 --- a/src/com/android/camera/PanoProgressBar.java +++ b/src/com/android/camera/PanoProgressBar.java @@ -44,6 +44,8 @@ class PanoProgressBar extends ImageView { private RectF mDrawBounds; private OnDirectionChangeListener mListener = null; + private int mOldProgress = 0; + public interface OnDirectionChangeListener { public void onDirectionChange(int direction); } @@ -137,6 +139,12 @@ class PanoProgressBar extends ImageView { setRightIncreasing(false); } } + // When user move to the opposite direction more than 10 degrees, + // change the direction and stop the capture progress in PanoramaModule. + if (Math.abs(mOldProgress) - Math.abs(progress) > 10) { + mListener.onDirectionChange(mDirection/2 + 1); + return; + } // mDirection might be modified by setRightIncreasing() above. Need to check again. if (mDirection != DIRECTION_NONE) { mProgress = progress * mWidth / mMaxProgress + mProgressOffset; @@ -152,11 +160,15 @@ class PanoProgressBar extends ImageView { } invalidate(); } + if (Math.abs(mOldProgress) < Math.abs(progress)) { + mOldProgress = progress; + } } public void reset() { mProgress = 0; mProgressOffset = 0; + mOldProgress = 0; setDirection(DIRECTION_NONE); invalidate(); } diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java index f7432bfb0..446259a1a 100644 --- a/src/com/android/camera/WideAnglePanoramaModule.java +++ b/src/com/android/camera/WideAnglePanoramaModule.java @@ -153,6 +153,8 @@ public class WideAnglePanoramaModule private boolean mPreviewFocused = true; private boolean mPreviewLayoutChanged = false; + private boolean mDirectionChanged = false; + @Override public void onPreviewUIReady() { configMosaicPreview(); @@ -225,9 +227,16 @@ public class WideAnglePanoramaModule new PanoProgressBar.OnDirectionChangeListener() { @Override public void onDirectionChange(int direction) { + if (mDirectionChanged) { + stopCapture(false); + return; + } if (mCaptureState == CAPTURE_STATE_MOSAIC) { mUI.showDirectionIndicators(direction); } + if (direction != PanoProgressBar.DIRECTION_NONE) { + mDirectionChanged = true; + } } }); @@ -583,6 +592,7 @@ public class WideAnglePanoramaModule } private void stopCapture(boolean aborted) { + mDirectionChanged = false; mCaptureState = CAPTURE_STATE_VIEWFINDER; mUI.onStopCapture(); Parameters parameters = mCameraDevice.getParameters(); @@ -758,6 +768,7 @@ public class WideAnglePanoramaModule // This function will be called upon the first camera frame is available. private void reset() { mCaptureState = CAPTURE_STATE_VIEWFINDER; + mDirectionChanged = false; mOrientationLocked = false; mUI.setOrientation(mDeviceOrientation, true); |