diff options
author | Mark Wagner <mxw@google.com> | 2011-10-06 10:25:49 -0700 |
---|---|---|
committer | Mark Wagner <mxw@google.com> | 2011-10-07 09:52:37 -0700 |
commit | 5201b1e0051877d8e8ed0ef5b461ffcac534eb5c (patch) | |
tree | 9d80f215f395934c8a1b166b9ec6e5f018820d61 /src/com/android/camera/panorama | |
parent | fc52f4a9bf815633739125883807bfe965cf6009 (diff) | |
download | LegacyCamera-5201b1e0051877d8e8ed0ef5b461ffcac534eb5c.zip LegacyCamera-5201b1e0051877d8e8ed0ef5b461ffcac534eb5c.tar.gz LegacyCamera-5201b1e0051877d8e8ed0ef5b461ffcac534eb5c.tar.bz2 |
bugfix 5290450 Share UI should match redlines
Incremental work towards matching the redline. This will probably
require a review pass from UX to catch any missed items.
Change-Id: I0496aa0fc1941f8ffa06050ae8fbed3fe7246878
Diffstat (limited to 'src/com/android/camera/panorama')
-rwxr-xr-x | src/com/android/camera/panorama/PanoramaActivity.java | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java index 09df1e0..d465bf7 100755 --- a/src/com/android/camera/panorama/PanoramaActivity.java +++ b/src/com/android/camera/panorama/PanoramaActivity.java @@ -174,6 +174,7 @@ public class PanoramaActivity extends ActivityBase implements // The value could be 0, 1, 2, 3 for the 4 different orientations measured in clockwise // respectively. private int mDeviceOrientation; + private int mOrientationCompensation; private class MosaicJpeg { public MosaicJpeg(byte[] data, int width, int height) { @@ -196,6 +197,10 @@ public class PanoramaActivity extends ActivityBase implements public final boolean isValid; } + public static int roundOrientation(int orientation) { + return ((orientation + 45) / 90 * 90) % 360; + } + private class PanoOrientationEventListener extends OrientationEventListener { public PanoOrientationEventListener(Context context) { super(context); @@ -203,12 +208,26 @@ public class PanoramaActivity extends ActivityBase implements @Override public void onOrientationChanged(int orientation) { - // Default to the last known orientation. + // We keep the last known orientation. So if the user first orient + // the camera then point the camera to floor or sky, we still have + // the correct orientation. if (orientation == ORIENTATION_UNKNOWN) return; - mDeviceOrientation = ((orientation + 45) / 90) % 4; + mDeviceOrientation = roundOrientation(orientation); + // When the screen is unlocked, display rotation may change. Always + // calculate the up-to-date orientationCompensation. + int orientationCompensation = mDeviceOrientation + + Util.getDisplayRotation(PanoramaActivity.this); + if (mOrientationCompensation != orientationCompensation) { + mOrientationCompensation = orientationCompensation; + setOrientationIndicator(mOrientationCompensation); + } } } + private void setOrientationIndicator(int degree) { + if (mSharePopup != null) mSharePopup.setOrientation(degree); + } + @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); @@ -814,7 +833,8 @@ public class PanoramaActivity extends ActivityBase implements Uri uri = mThumbnail.getUri(); if (mSharePopup == null || !uri.equals(mSharePopup.getUri())) { // The orientation compensation is set to 0 here because we only support landscape. - mSharePopup = new SharePopup(this, uri, mThumbnail.getBitmap(), 0, + mSharePopup = new SharePopup(this, uri, mThumbnail.getBitmap(), + mOrientationCompensation, findViewById(R.id.frame_layout)); } mSharePopup.showAtLocation(mThumbnailView, Gravity.NO_GRAVITY, 0, 0); @@ -881,6 +901,11 @@ public class PanoramaActivity extends ActivityBase implements reset(); } if (mSharePopup != null) mSharePopup.dismiss(); + + if (mThumbnail != null && !mThumbnail.fromFile()) { + mThumbnail.saveTo(new File(getFilesDir(), Thumbnail.LAST_THUMB_FILENAME)); + } + releaseCamera(); mMosaicView.onPause(); clearMosaicFrameProcessorIfNeeded(); |