diff options
author | Likai Ding <likaid@codeaurora.org> | 2014-12-18 23:25:22 +0800 |
---|---|---|
committer | Likai Ding <likaid@codeaurora.org> | 2015-01-08 17:58:23 +0800 |
commit | 37c3c7cc832adbd8b78fa0a3e1f8d074111638d9 (patch) | |
tree | 3600024572e813303d01bdcec417ed271762cb76 /src/com/android/camera/VideoUI.java | |
parent | cc56779da62644898eb319d4b296f69d6d820013 (diff) | |
download | android_packages_apps_Snap-37c3c7cc832adbd8b78fa0a3e1f8d074111638d9.tar.gz android_packages_apps_Snap-37c3c7cc832adbd8b78fa0a3e1f8d074111638d9.tar.bz2 android_packages_apps_Snap-37c3c7cc832adbd8b78fa0a3e1f8d074111638d9.zip |
SnapdragonCamera: support 4:3 preview on 16:9 screen
When preview is set to 4:3 on a 16:9 screen, resize SurfaceView to 4:3
and cover other parts of the screen. Otherwise camera controls have
a semi-transparent background.
Change-Id: Icfbe6318b6a9de9a988468078b474e842f6ddd8c
Diffstat (limited to 'src/com/android/camera/VideoUI.java')
-rw-r--r-- | src/com/android/camera/VideoUI.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java index 8a0eb8858..54a1bfcd4 100644 --- a/src/com/android/camera/VideoUI.java +++ b/src/com/android/camera/VideoUI.java @@ -22,6 +22,7 @@ import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.Matrix; +import android.graphics.Point; import android.graphics.drawable.ColorDrawable; import android.hardware.Camera.Parameters; import android.os.Handler; @@ -252,6 +253,14 @@ public class VideoUI implements PieRenderer.PieListener, mAnimationManager = new AnimationManager(); mOrientationResize = false; mPrevOrientationResize = false; + + Point size = new Point(); + mActivity.getWindowManager().getDefaultDisplay().getSize(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); + int topMargin = l / 4 * tm / (tm + bm); + mCameraControls.setMargins(topMargin, l / 4 - topMargin); } public void updatePreviewThumbnail() { @@ -355,6 +364,8 @@ public class VideoUI implements PieRenderer.PieListener, if (mPreviewWidth > 0 && mPreviewHeight > 0) { mHandler.sendEmptyMessage(UPDATE_TRANSFORM_MATRIX); } + // ensure a semi-transparent background for now + mCameraControls.setPreviewRatio(1.0f); } public int getPreviewWidth() { @@ -844,10 +855,12 @@ public class VideoUI implements PieRenderer.PieListener, } public void hideUIwhileRecording() { + mCameraControls.setWillNotDraw(true); mVideoMenu.hideUI(); } public void showUIafterRecording() { + mCameraControls.setWillNotDraw(false); mVideoMenu.showUI(); } |