diff options
author | Jack Yoo <jyoo@codeaurora.org> | 2016-01-25 11:12:46 -0800 |
---|---|---|
committer | Michael Bestas <mikeioannina@cyanogenmod.org> | 2016-02-16 15:44:54 +0200 |
commit | 22c9b14239c5fd517f2ebff84d499e3b30a36551 (patch) | |
tree | 84085dec4ca0cd04248dae2e541bd689424cfe19 /src/com/android/camera | |
parent | 7c89a6d6ad841ddad0f017a02941388c7af8711e (diff) | |
download | android_packages_apps_Snap-22c9b14239c5fd517f2ebff84d499e3b30a36551.tar.gz android_packages_apps_Snap-22c9b14239c5fd517f2ebff84d499e3b30a36551.tar.bz2 android_packages_apps_Snap-22c9b14239c5fd517f2ebff84d499e3b30a36551.zip |
SnapdragonCamera: Calculate in top bottom margin for the preview
Subtract top and bottom margin from the max height of the preview
Let it be aligned correctly to the top and center horizontally.
Change-Id: I6c5b3fde57c1a514725a6316dbe8e0c799a928d0
CRs-Fixed: 965033
Diffstat (limited to 'src/com/android/camera')
-rw-r--r-- | src/com/android/camera/PhotoUI.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java index 88cc2b856..19aa3a71b 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 || |