diff options
author | Doris Liu <tianliu@google.com> | 2013-02-15 10:55:37 -0800 |
---|---|---|
committer | Doris Liu <tianliu@google.com> | 2013-02-15 17:33:00 -0800 |
commit | 9a32480db4e07fe437dd119d6f1d8471382d503f (patch) | |
tree | 24ea5b07106ea1482aad58da327236b88760b087 /src/com/android/camera/CameraActivity.java | |
parent | a54931e070a9134cf0a8d16cc628997844fc93dc (diff) | |
download | android_packages_apps_Gallery2-9a32480db4e07fe437dd119d6f1d8471382d503f.tar.gz android_packages_apps_Gallery2-9a32480db4e07fe437dd119d6f1d8471382d503f.tar.bz2 android_packages_apps_Gallery2-9a32480db4e07fe437dd119d6f1d8471382d503f.zip |
Make photo orientation consistent with UI
Also fixed the wrong animation orientation.
Bug: 7302506
Change-Id: I58615a7b3cc2e08c2a8dc4e174512a502c2482f5
Diffstat (limited to 'src/com/android/camera/CameraActivity.java')
-rw-r--r-- | src/com/android/camera/CameraActivity.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index bf1ec2483..b0374986c 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -23,11 +23,14 @@ import android.content.Context; import android.content.ComponentName; import android.content.Intent; import android.content.ServiceConnection; +import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.IBinder; import android.provider.MediaStore; +import android.provider.Settings; +import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -57,6 +60,7 @@ public class CameraActivity extends ActivityBase private Drawable[] mDrawables; private int mCurrentModuleIndex; private MotionEvent mDown; + private boolean mAutoRotateScreen; private MyOrientationEventListener mOrientationListener; // The degrees of the device rotated clockwise from its natural orientation. @@ -140,6 +144,12 @@ public class CameraActivity extends ActivityBase super.onDestroy(); } + // Return whether the auto-rotate screen in system settings + // is turned on. + public boolean isAutoRotateScreen() { + return mAutoRotateScreen; + } + private class MyOrientationEventListener extends OrientationEventListener { public MyOrientationEventListener(Context context) { @@ -317,6 +327,14 @@ public class CameraActivity extends ActivityBase @Override public void onResume() { mPaused = false; + if (Settings.System.getInt(getContentResolver(), + Settings.System.ACCELEROMETER_ROTATION, 0) == 0) {// auto-rotate off + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); + mAutoRotateScreen = false; + } else { + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR); + mAutoRotateScreen = true; + } mOrientationListener.enable(); mCurrentModule.onResumeBeforeSuper(); super.onResume(); |