From 9bb3bc11bb77ec511f96b348256939c15ba1dd11 Mon Sep 17 00:00:00 2001 From: Martin Brabham Date: Mon, 9 Nov 2015 15:11:54 -0800 Subject: Make panorama able to go 270 degrees in landscape Change-Id: Icfab44c674bcc59c1d369af64985956ccaf63ccc issue-id: SAMBAR-869 (cherry picked from commit e0ca697b97ef2d872f682d2b357d7233762cfafd) --- src/com/android/camera/WideAnglePanoramaModule.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/com/android/camera/WideAnglePanoramaModule.java') diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java index 9386e9371..77f724606 100644 --- a/src/com/android/camera/WideAnglePanoramaModule.java +++ b/src/com/android/camera/WideAnglePanoramaModule.java @@ -68,7 +68,8 @@ public class WideAnglePanoramaModule implements CameraModule, WideAnglePanoramaController, SurfaceTexture.OnFrameAvailableListener { - public static final int DEFAULT_SWEEP_ANGLE = 160; + public static final int DEFAULT_SWEEP_ANGLE_PORTRAIT = 160; + public static final int DEFAULT_SWEEP_ANGLE_LANDSCAPE = 270; public static final int DEFAULT_BLEND_MODE = Mosaic.BLENDTYPE_HORIZONTAL; public static final int DEFAULT_CAPTURE_PIXELS = 960 * 720; @@ -583,6 +584,9 @@ public class WideAnglePanoramaModule parameters.setAutoWhiteBalanceLock(true); configureCamera(parameters); + final int sweepAngle = (mDeviceOrientation == 90 || mDeviceOrientation == 270) ? + DEFAULT_SWEEP_ANGLE_LANDSCAPE : DEFAULT_SWEEP_ANGLE_PORTRAIT; + mMosaicFrameProcessor.setProgressListener(new MosaicFrameProcessor.ProgressListener() { @Override public void onProgress(boolean isFinished, float panningRateX, float panningRateY, @@ -591,8 +595,8 @@ public class WideAnglePanoramaModule float accumulatedVerticalAngle = progressY * mVerticalViewAngle; boolean isRotated = !(mDeviceOrientationAtCapture == mDeviceOrientation); if (isFinished - || (Math.abs(accumulatedHorizontalAngle) >= DEFAULT_SWEEP_ANGLE) - || (Math.abs(accumulatedVerticalAngle) >= DEFAULT_SWEEP_ANGLE) + || (Math.abs(accumulatedHorizontalAngle) >= sweepAngle) + || (Math.abs(accumulatedVerticalAngle) >= sweepAngle) || isRotated) { stopCapture(false); } else { @@ -612,7 +616,7 @@ public class WideAnglePanoramaModule mUI.resetCaptureProgress(); // TODO: calculate the indicator width according to different devices to reflect the actual // angle of view of the camera device. - mUI.setMaxCaptureProgress(DEFAULT_SWEEP_ANGLE); + mUI.setMaxCaptureProgress(sweepAngle); mUI.showCaptureProgress(); mDeviceOrientationAtCapture = mDeviceOrientation; keepScreenOn(); -- cgit v1.2.3