diff options
author | Wei-Ta Chen <weita@google.com> | 2011-11-15 17:18:12 -0800 |
---|---|---|
committer | Wei-Ta Chen <weita@google.com> | 2011-11-15 18:01:37 -0800 |
commit | 2d3391e6be57aeeb7e713f25a484445660b101e3 (patch) | |
tree | 7bccbffd365e4e93aabaeaa7ffea3d248ac7e121 /src | |
parent | 948e75e8e3fd2ec98a08e65efdb6e5eb6d02c33b (diff) | |
download | packages_apps_LegacyCamera-2d3391e6be57aeeb7e713f25a484445660b101e3.zip packages_apps_LegacyCamera-2d3391e6be57aeeb7e713f25a484445660b101e3.tar.gz packages_apps_LegacyCamera-2d3391e6be57aeeb7e713f25a484445660b101e3.tar.bz2 |
Update the panorama capturing progress correctly.
Fix an issue that the termination condition on the sweeping angle is broken.
Fix another issue that the panning speed and sweeping angle does not
consider the cases that users hold a device in portrait or panning the
device vertically.
Bug: 5623138
Change-Id: I9d1e2e5ad63a97beb8cfe2404974329c70d46991
Diffstat (limited to 'src')
-rwxr-xr-x | src/com/android/camera/panorama/PanoramaActivity.java | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java index 6978477..93782a6 100755 --- a/src/com/android/camera/panorama/PanoramaActivity.java +++ b/src/com/android/camera/panorama/PanoramaActivity.java @@ -140,11 +140,6 @@ public class PanoramaActivity extends ActivityBase implements private int mTraversedAngleX; private int mTraversedAngleY; private long mTimestamp; - // Control variables for the terminate condition. - private int mMinAngleX; - private int mMaxAngleX; - private int mMinAngleY; - private int mMaxAngleY; private RotateImageView mThumbnailView; private Thumbnail mThumbnail; @@ -165,6 +160,7 @@ public class PanoramaActivity extends ActivityBase implements private boolean mCancelComputation; private float[] mTransformMatrix; private float mHorizontalViewAngle; + private float mVerticalViewAngle; // Prefer FOCUS_MODE_INFINITY to FOCUS_MODE_CONTINUOUS_VIDEO because of // getting a better image quality by the former. @@ -410,8 +406,8 @@ public class PanoramaActivity extends ActivityBase implements parameters.setRecordingHint(false); - mHorizontalViewAngle = (((mDeviceOrientation / 90) % 2) == 0) ? - parameters.getHorizontalViewAngle() : parameters.getVerticalViewAngle(); + mHorizontalViewAngle = parameters.getHorizontalViewAngle(); + mVerticalViewAngle = parameters.getVerticalViewAngle(); } public int getPreviewBufSize() { @@ -546,22 +542,23 @@ public class PanoramaActivity extends ActivityBase implements mCompassValueXStart = mCompassValueXStartBuffer; mCompassValueYStart = mCompassValueYStartBuffer; - mMinAngleX = 0; - mMaxAngleX = 0; - mMinAngleY = 0; - mMaxAngleY = 0; mTimestamp = 0; mMosaicFrameProcessor.setProgressListener(new MosaicFrameProcessor.ProgressListener() { @Override public void onProgress(boolean isFinished, float panningRateX, float panningRateY, float progressX, float progressY) { + float accumulatedHorizontalAngle = progressX * mHorizontalViewAngle; + float accumulatedVerticalAngle = progressY * mVerticalViewAngle; if (isFinished - || (mMaxAngleX - mMinAngleX >= DEFAULT_SWEEP_ANGLE) - || (mMaxAngleY - mMinAngleY >= DEFAULT_SWEEP_ANGLE)) { + || (Math.abs(accumulatedHorizontalAngle) >= DEFAULT_SWEEP_ANGLE) + || (Math.abs(accumulatedVerticalAngle) >= DEFAULT_SWEEP_ANGLE)) { stopCapture(false); } else { - updateProgress(panningRateX, progressX, progressY); + float panningRateXInDegree = panningRateX * mHorizontalViewAngle; + float panningRateYInDegree = panningRateY * mVerticalViewAngle; + updateProgress(panningRateXInDegree, panningRateYInDegree, + accumulatedHorizontalAngle, accumulatedVerticalAngle); } } }); @@ -630,19 +627,25 @@ public class PanoramaActivity extends ActivityBase implements mRightIndicator.setEnabled(false); } - private void updateProgress(float panningRate, float progressX, float progressY) { + private void updateProgress(float panningRateXInDegree, float panningRateYInDegree, + float progressHorizontalAngle, float progressVerticalAngle) { mMosaicView.setReady(); mMosaicView.requestRender(); // TODO: Now we just display warning message by the panning speed. // Since we only support horizontal panning, we should display a warning message // in UI when there're significant vertical movements. - if (Math.abs(panningRate * mHorizontalViewAngle) > PANNING_SPEED_THRESHOLD) { + if ((Math.abs(panningRateXInDegree) > PANNING_SPEED_THRESHOLD) + || (Math.abs(panningRateYInDegree) > PANNING_SPEED_THRESHOLD)) { showTooFastIndication(); } else { hideTooFastIndication(); } - mPanoProgressBar.setProgress((int) (progressX * mHorizontalViewAngle)); + int angleInMajorDirection = + (Math.abs(progressHorizontalAngle) > Math.abs(progressVerticalAngle)) + ? (int) progressHorizontalAngle + : (int) progressVerticalAngle; + mPanoProgressBar.setProgress((angleInMajorDirection)); } private void createContentView() { |