summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/WideAnglePanoramaModule.java
diff options
context:
space:
mode:
authorLikai Ding <likaid@codeaurora.org>2015-01-26 10:07:21 +0800
committerLikai Ding <likaid@codeaurora.org>2015-02-02 13:55:08 +0800
commite2fb5dc7798cf677f6a66b6a697c4a011b0a101f (patch)
tree9250c3a47e27b90e3c094c9d3ffa1365c3914178 /src/com/android/camera/WideAnglePanoramaModule.java
parent07cf80cc97c68f12d5728919fcebba28e750761d (diff)
downloadandroid_packages_apps_Snap-e2fb5dc7798cf677f6a66b6a697c4a011b0a101f.tar.gz
android_packages_apps_Snap-e2fb5dc7798cf677f6a66b6a697c4a011b0a101f.tar.bz2
android_packages_apps_Snap-e2fb5dc7798cf677f6a66b6a697c4a011b0a101f.zip
SnapdragonCamera: fix portrait orientation
Fix camera activity to portrait, so there is no delay when rotation occurs. Main changes are: 1. RotateLayout now supports padding and dynamically added child. 2. Camera controls and gesture detetion are now orientation-aware. 3. Toasts are replaced with RotateTextToast. 4. Obselete layout files are removed. Change-Id: I338849bd7fb84b847eb357f771a24a5cc09bf6fa
Diffstat (limited to 'src/com/android/camera/WideAnglePanoramaModule.java')
-rw-r--r--src/com/android/camera/WideAnglePanoramaModule.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java
index 40878581e..900951d96 100644
--- a/src/com/android/camera/WideAnglePanoramaModule.java
+++ b/src/com/android/camera/WideAnglePanoramaModule.java
@@ -50,6 +50,7 @@ import com.android.camera.CameraManager.CameraProxy;
import com.android.camera.app.OrientationManager;
import com.android.camera.data.LocalData;
import com.android.camera.exif.ExifInterface;
+import com.android.camera.ui.RotateTextToast;
import com.android.camera.util.CameraUtil;
import com.android.camera.util.UsageStatistics;
import org.codeaurora.snapcam.R;
@@ -134,6 +135,7 @@ public class WideAnglePanoramaModule
private int mDeviceOrientationAtCapture;
private int mCameraOrientation;
private int mOrientationCompensation;
+ private boolean mOrientationLocked;
private SoundClips.Player mSoundPlayer;
@@ -192,6 +194,7 @@ public class WideAnglePanoramaModule
// the camera then point the camera to floor or sky, we still have
// the correct orientation.
if (orientation == ORIENTATION_UNKNOWN) return;
+ int oldOrientation = mDeviceOrientation;
mDeviceOrientation = CameraUtil.roundOrientation(orientation, mDeviceOrientation);
// When the screen is unlocked, display rotation may change. Always
// calculate the up-to-date orientationCompensation.
@@ -200,6 +203,11 @@ public class WideAnglePanoramaModule
if (mOrientationCompensation != orientationCompensation) {
mOrientationCompensation = orientationCompensation;
}
+ if (oldOrientation != mDeviceOrientation
+ && oldOrientation != OrientationEventListener.ORIENTATION_UNKNOWN) {
+ if (!mOrientationLocked)
+ mUI.setOrientation(mDeviceOrientation, true);
+ }
}
}
@@ -555,8 +563,7 @@ public class WideAnglePanoramaModule
mUI.showCaptureProgress();
mDeviceOrientationAtCapture = mDeviceOrientation;
keepScreenOn();
- // TODO: mActivity.getOrientationManager().lockOrientation();
- mOrientationManager.lockOrientation();
+ mOrientationLocked = true;
int degrees = CameraUtil.getDisplayRotation(mActivity);
int cameraId = CameraHolder.instance().getBackCameraId();
int orientation = CameraUtil.getDisplayOrientation(degrees, cameraId);
@@ -744,7 +751,8 @@ public class WideAnglePanoramaModule
private void reset() {
mCaptureState = CAPTURE_STATE_VIEWFINDER;
- mOrientationManager.unlockOrientation();
+ mOrientationLocked = false;
+ mUI.setOrientation(mDeviceOrientation, true);
mUI.reset();
mActivity.setSwipingEnabled(true);
// Orientation change will trigger onLayoutChange->configMosaicPreview->
@@ -901,7 +909,7 @@ public class WideAnglePanoramaModule
@Override
public void onSwitchSavePath() {
mPreferences.edit().putString(CameraSettings.KEY_CAMERA_SAVEPATH, "1").apply();
- Toast.makeText(mActivity, R.string.on_switch_save_path_to_sdcard,
+ RotateTextToast.makeText(mActivity, R.string.on_switch_save_path_to_sdcard,
Toast.LENGTH_SHORT).show();
}