summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/camera/PhotoUI.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 88cc2b8..19aa3a7 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -344,6 +344,7 @@ public class PhotoUI implements PieListener,
FrameLayout.LayoutParams lp;
float scaledTextureWidth, scaledTextureHeight;
int rotation = CameraUtil.getDisplayRotation(mActivity);
+ mScreenRatio = CameraUtil.determineRatio(ratio);
if (mScreenRatio == CameraUtil.RATIO_16_9
&& CameraUtil.determinCloseRatio(ratio) == CameraUtil.RATIO_4_3) {
int l = (mTopMargin + mBottomMargin) * 4;
@@ -377,7 +378,8 @@ 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 (mOrientationResize) {
scaledTextureWidth = height * mAspectRatio;
if (scaledTextureWidth > width) {
@@ -408,7 +410,6 @@ public class PhotoUI implements PieListener,
Log.v(TAG, "setTransformMatrix: scaledTextureWidth = " + scaledTextureWidth
+ ", scaledTextureHeight = " + scaledTextureHeight);
-
if (((rotation == 0 || rotation == 180) && scaledTextureWidth > scaledTextureHeight)
|| ((rotation == 90 || rotation == 270)
&& scaledTextureWidth < scaledTextureHeight)) {
@@ -418,6 +419,10 @@ public class PhotoUI implements PieListener,
lp = new FrameLayout.LayoutParams((int) scaledTextureWidth,
(int) scaledTextureHeight, Gravity.CENTER);
}
+ if(mScreenRatio == CameraUtil.RATIO_4_3) {
+ lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
+ lp.setMargins(0, mTopMargin, 0, mBottomMargin);
+ }
}
if (mSurfaceTextureUncroppedWidth != scaledTextureWidth ||