summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorNikita <nikich340@gmail.com>2016-02-23 15:19:23 +1000
committerSteve Kondik <steve@cyngn.com>2016-11-02 12:24:51 -0700
commitb73a6aade31cb5288086aa386a4728b63f9ef72a (patch)
treee9d71a782517bc3178004b1c6df984a574ae348f /src/com/android
parent8c434177890485ea22c9e5379c466bdd33c22416 (diff)
downloadandroid_packages_apps_Snap-b73a6aade31cb5288086aa386a4728b63f9ef72a.tar.gz
android_packages_apps_Snap-b73a6aade31cb5288086aa386a4728b63f9ef72a.tar.bz2
android_packages_apps_Snap-b73a6aade31cb5288086aa386a4728b63f9ef72a.zip
Snap: Fix incorrect preview layout surface size in landscape mode
If height is smaller than width it means that orientation sets to horizontal and we should decrease width instead height to get normal preview size. Change-Id: Ifa211ad2604fb730fb85b01ae1d7c93c9b7aa2ce
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/camera/PhotoUI.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 6b8299c7c..f69420ecd 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -396,8 +396,13 @@ public class PhotoUI implements PieListener,
} else {
float width = mMaxPreviewWidth, height = mMaxPreviewHeight;
if (width == 0 || height == 0) return;
- if(mScreenRatio == CameraUtil.RATIO_4_3)
- height -= (mTopMargin + mBottomMargin);
+ if (mScreenRatio == CameraUtil.RATIO_4_3) {
+ if (height > width) {
+ height -= (mTopMargin + mBottomMargin);
+ } else {
+ width -= (mTopMargin + mBottomMargin);
+ }
+ }
if (mOrientationResize) {
scaledTextureWidth = height * mAspectRatio;
if (scaledTextureWidth > width) {
@@ -416,7 +421,7 @@ public class PhotoUI implements PieListener,
scaledTextureHeight = height;
}
} else {
- if(Math.max(height, width * mAspectRatio) > height) {
+ if (Math.max(height, width * mAspectRatio) > height) {
scaledTextureWidth = height / mAspectRatio;
scaledTextureHeight = height;
} else {
@@ -437,7 +442,7 @@ public class PhotoUI implements PieListener,
lp = new FrameLayout.LayoutParams((int) scaledTextureWidth,
(int) scaledTextureHeight, Gravity.CENTER);
}
- if(mScreenRatio == CameraUtil.RATIO_4_3) {
+ if (mScreenRatio == CameraUtil.RATIO_4_3) {
lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
lp.setMargins(0, mTopMargin, 0, mBottomMargin);
}