summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2015-04-02 17:39:55 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2015-04-02 17:39:55 -0700
commit2405cbf18879dd524120d82a21233863b79af5be (patch)
tree9b81ea3290c51f6a73cc01807f79ab91927cbc1d /src/com
parent9565d7c634a34ab68930c1f993bc6d927c33056c (diff)
parentb27ff6151f0ded21e0742206fab4d2f905a64f74 (diff)
downloadandroid_packages_apps_Snap-2405cbf18879dd524120d82a21233863b79af5be.tar.gz
android_packages_apps_Snap-2405cbf18879dd524120d82a21233863b79af5be.tar.bz2
android_packages_apps_Snap-2405cbf18879dd524120d82a21233863b79af5be.zip
Merge "SnapdragonCamera: Stop panorama capture when move to opposite direction"
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/camera/PanoProgressBar.java12
-rw-r--r--src/com/android/camera/WideAnglePanoramaModule.java11
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 c5adde802..683eabf57 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);