From a05f9ce2cfa6dc7f94d38580d0ce7092b5507947 Mon Sep 17 00:00:00 2001 From: Camera Software Integration Date: Thu, 17 Dec 2015 10:32:02 -0800 Subject: SnapdragonCamera: Adjust margin on PhotoUI Adjust top and bottom margin on every ratio. Change-Id: I755c15039e355d13bcc08e6463f38deba668a234 CRs-Fixed: 951525 --- src/com/android/camera/PhotoUI.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java index 3a9a2c13c..88cc2b856 100644 --- a/src/com/android/camera/PhotoUI.java +++ b/src/com/android/camera/PhotoUI.java @@ -303,16 +303,18 @@ public class PhotoUI implements PieListener, Point size = new Point(); mActivity.getWindowManager().getDefaultDisplay().getRealSize(size); mScreenRatio = CameraUtil.determineRatio(size.x, size.y); - if (mScreenRatio == CameraUtil.RATIO_16_9) { - int l = size.x > size.y ? size.x : size.y; - int tm = mActivity.getResources().getDimensionPixelSize(R.dimen.preview_top_margin); - int bm = mActivity.getResources().getDimensionPixelSize(R.dimen.preview_bottom_margin); - mTopMargin = l / 4 * tm / (tm + bm); - mBottomMargin = l / 4 - mTopMargin; - } + calculateMargins(size); mCameraControls.setMargins(mTopMargin, mBottomMargin); } + private void calculateMargins(Point size) { + int l = size.x > size.y ? size.x : size.y; + int tm = mActivity.getResources().getDimensionPixelSize(R.dimen.preview_top_margin); + int bm = mActivity.getResources().getDimensionPixelSize(R.dimen.preview_bottom_margin); + mTopMargin = l / 4 * tm / (tm + bm); + mBottomMargin = l / 4 - mTopMargin; + } + public void setDownFactor(int factor) { mDownSampleFactor = factor; } -- cgit v1.2.3