summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/camera/PhotoUI.java4
-rw-r--r--src/com/android/camera/VideoUI.java8
-rw-r--r--src/com/android/camera/util/CameraUtil.java6
3 files changed, 9 insertions, 9 deletions
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 14c55101c..a3174a67d 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -344,9 +344,7 @@ public class PhotoUI implements PieListener,
public void setAspectRatio(float ratio) {
if (ratio <= 0.0) throw new IllegalArgumentException();
- if (mOrientationResize &&
- mActivity.getResources().getConfiguration().orientation
- != Configuration.ORIENTATION_PORTRAIT) {
+ if (mOrientationResize && CameraUtil.isScreenRotated(mActivity)) {
ratio = 1 / ratio;
}
diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java
index c30fceeb9..de3d1cc8a 100644
--- a/src/com/android/camera/VideoUI.java
+++ b/src/com/android/camera/VideoUI.java
@@ -382,9 +382,7 @@ public class VideoUI implements PieRenderer.PieListener,
} else {
ratio = (float) height / width;
}
- if (mOrientationResize &&
- mActivity.getResources().getConfiguration().orientation
- != Configuration.ORIENTATION_PORTRAIT) {
+ if (mOrientationResize && CameraUtil.isScreenRotated(mActivity)) {
ratio = 1 / ratio;
}
@@ -727,9 +725,7 @@ public class VideoUI implements PieRenderer.PieListener,
}
public void setAspectRatio(double ratio) {
- if (mOrientationResize &&
- mActivity.getResources().getConfiguration().orientation
- != Configuration.ORIENTATION_PORTRAIT) {
+ if (mOrientationResize && CameraUtil.isScreenRotated(mActivity)) {
ratio = 1 / ratio;
}
diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java
index 705e94924..4299dd6c8 100644
--- a/src/com/android/camera/util/CameraUtil.java
+++ b/src/com/android/camera/util/CameraUtil.java
@@ -439,6 +439,12 @@ public class CameraUtil {
return 0;
}
+ public static boolean isScreenRotated(Activity activity) {
+ int rotation = activity.getWindowManager().getDefaultDisplay()
+ .getRotation();
+ return rotation != Surface.ROTATION_0 && rotation != Surface.ROTATION_180;
+ }
+
/**
* Calculate the default orientation of the device based on the width and
* height of the display when rotation = 0 (i.e. natural width and height)