summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorByunghun Jeon <bjeon@codeaurora.org>2015-06-16 20:17:22 -0700
committerByunghun Jeon <bjeon@codeaurora.org>2015-07-28 16:12:58 -0700
commitad2d0e655d1320044bc675cc959a0b023c394936 (patch)
tree00174e277345675a8d569e68ceb6b1400ec4b8a9
parent69a6c4f032c0acc993b009b0275c39de1e756057 (diff)
downloadandroid_packages_apps_Snap-ad2d0e655d1320044bc675cc959a0b023c394936.tar.gz
android_packages_apps_Snap-ad2d0e655d1320044bc675cc959a0b023c394936.tar.bz2
android_packages_apps_Snap-ad2d0e655d1320044bc675cc959a0b023c394936.zip
SnapdragonCamera: remove nav bar to enable full screen preview
Remove the navigation bar in order to take advantage of full screen. Change-Id: I25f42af825c4f3b7ad6521c2ee6d62fa4219044a CRs-Fixed: 865254
-rw-r--r--res/layout/photo_module.xml1
-rw-r--r--res/layout/video_module.xml1
-rw-r--r--src/com/android/camera/CameraActivity.java15
-rw-r--r--src/com/android/camera/PhotoUI.java136
-rw-r--r--src/com/android/camera/VideoUI.java168
5 files changed, 153 insertions, 168 deletions
diff --git a/res/layout/photo_module.xml b/res/layout/photo_module.xml
index a8ea2a169..afc637773 100644
--- a/res/layout/photo_module.xml
+++ b/res/layout/photo_module.xml
@@ -26,6 +26,7 @@
android:layout_gravity="center" >
<include layout="@layout/count_down_to_capture" />
<FrameLayout
+ android:id="@+id/preview_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|center_horizontal" >
diff --git a/res/layout/video_module.xml b/res/layout/video_module.xml
index 6f36081e2..8fe42e178 100644
--- a/res/layout/video_module.xml
+++ b/res/layout/video_module.xml
@@ -19,6 +19,7 @@
android:layout_height="match_parent"
android:layout_gravity="center" >
<FrameLayout
+ android:id="@+id/preview_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|center_horizontal" >
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index dd8e64fc0..ef3e48f72 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -224,7 +224,8 @@ public class CameraActivity extends Activity
private LocalMediaObserver mLocalImagesObserver;
private LocalMediaObserver mLocalVideosObserver;
- private final int DEFAULT_SYSTEM_UI_VISIBILITY = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
+ private final int DEFAULT_SYSTEM_UI_VISIBILITY = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
private boolean mPendingDeletion = false;
@@ -637,12 +638,16 @@ public class CameraActivity extends Activity
private void setSystemBarsVisibility(boolean visible, boolean hideLater) {
mMainHandler.removeMessages(HIDE_ACTION_BAR);
- int currentSystemUIVisibility = mAboveFilmstripControlLayout.getSystemUiVisibility();
+ View decorView = getWindow().getDecorView();
+ int currentSystemUIVisibility = decorView.getSystemUiVisibility();
int newSystemUIVisibility = DEFAULT_SYSTEM_UI_VISIBILITY
- | (visible ? View.SYSTEM_UI_FLAG_VISIBLE : View.SYSTEM_UI_FLAG_LOW_PROFILE
- | View.SYSTEM_UI_FLAG_FULLSCREEN);
+ | (visible ? View.SYSTEM_UI_FLAG_VISIBLE :
+ View.SYSTEM_UI_FLAG_LOW_PROFILE
+ | View.SYSTEM_UI_FLAG_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
if (newSystemUIVisibility != currentSystemUIVisibility) {
- mAboveFilmstripControlLayout.setSystemUiVisibility(newSystemUIVisibility);
+ decorView.setSystemUiVisibility(newSystemUIVisibility);
}
boolean currentActionBarVisibility = mActionBar.isShowing();
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 70cf5174f..b31b7314f 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -19,33 +19,32 @@ package com.android.camera;
import java.util.List;
+import org.codeaurora.snapcam.R;
+
import android.app.AlertDialog;
import android.content.DialogInterface;
-import android.content.res.Configuration;
+import android.content.DialogInterface.OnDismissListener;
import android.content.SharedPreferences;
+import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Matrix;
-import android.graphics.RectF;
import android.graphics.Point;
+import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.ColorDrawable;
import android.hardware.Camera;
import android.hardware.Camera.Face;
import android.os.AsyncTask;
-import android.os.Handler;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.Gravity;
-import android.view.Surface;
-import android.view.SurfaceView;
-import android.view.SurfaceHolder;
-import android.view.SurfaceHolder.Callback;
import android.view.MotionEvent;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLayoutChangeListener;
import android.view.ViewGroup;
-import android.view.ViewPropertyAnimator;
import android.view.ViewStub;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
@@ -54,7 +53,6 @@ import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.Toast;
-import android.graphics.drawable.AnimationDrawable;
import com.android.camera.CameraPreference.OnPreferenceChangedListener;
import com.android.camera.FocusOverlayManager.FocusUI;
@@ -75,7 +73,6 @@ import com.android.camera.ui.RotateLayout;
import com.android.camera.ui.RotateTextToast;
import com.android.camera.ui.ZoomRenderer;
import com.android.camera.util.CameraUtil;
-import org.codeaurora.snapcam.R;
public class PhotoUI implements PieListener,
PreviewGestures.SingleTapListener,
@@ -123,10 +120,8 @@ public class PhotoUI implements PieListener,
private int mZoomMax;
private List<Integer> mZoomRatios;
- private int mPreviewWidth = 0;
- private int mPreviewHeight = 0;
- private int mOriginalPreviewWidth = 0;
- private int mOriginalPreviewHeight = 0;
+ private int mMaxPreviewWidth = 0;
+ private int mMaxPreviewHeight = 0;
public boolean mMenuInitialized = false;
private float mSurfaceTextureUncroppedWidth;
@@ -137,7 +132,6 @@ public class PhotoUI implements PieListener,
private SurfaceTextureSizeChangedListener mSurfaceTextureSizeListener;
private SurfaceView mSurfaceView = null;
- private Matrix mMatrix = null;
private float mAspectRatio = 4f / 3f;
private boolean mAspectRatioResize;
@@ -165,38 +159,6 @@ public class PhotoUI implements PieListener,
@Override
public void onLayoutChange(View v, int left, int top, int right,
int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
- int width = right - left;
- int height = bottom - top;
-
- int orientation = mActivity.getResources().getConfiguration().orientation;
- if ((orientation == Configuration.ORIENTATION_PORTRAIT && width > height)
- || (orientation == Configuration.ORIENTATION_LANDSCAPE && width < height)) {
- // The screen has rotated; swap SurfaceView width & height
- // to ensure correct preview
- int oldWidth = width;
- width = height;
- height = oldWidth;
- Log.d(TAG, "Swapping SurfaceView width & height dimensions");
- if (mOriginalPreviewWidth != 0 && mOriginalPreviewHeight != 0) {
- int temp = mOriginalPreviewWidth;
- mOriginalPreviewWidth = mOriginalPreviewHeight;
- mOriginalPreviewHeight = temp;
- }
- }
-
- if (mPreviewWidth != width || mPreviewHeight != height
- || (mOrientationResize != mPrevOrientationResize)
- || mAspectRatioResize) {
- if (mOriginalPreviewWidth == 0) mOriginalPreviewWidth = width;
- if (mOriginalPreviewHeight == 0) mOriginalPreviewHeight = height;
- mPreviewWidth = width;
- mPreviewHeight = height;
- setTransformMatrix(mPreviewWidth, mPreviewHeight);
- mController.onScreenSizeChanged((int) mSurfaceTextureUncroppedWidth,
- (int) mSurfaceTextureUncroppedHeight);
- mAspectRatioResize = false;
- }
-
if (mMenu != null)
mMenu.tryToCloseSubList();
}
@@ -267,6 +229,43 @@ public class PhotoUI implements PieListener,
mSurfaceView.addOnLayoutChangeListener(mLayoutListener);
Log.v(TAG, "Using mdp_preview_content (MDP path)");
+ View surfaceContainer = mRootView.findViewById(R.id.preview_container);
+ surfaceContainer.addOnLayoutChangeListener(new OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right,
+ int bottom, int oldLeft, int oldTop, int oldRight,
+ int oldBottom) {
+ int width = right - left;
+ int height = bottom - top;
+
+ if (mMaxPreviewWidth == 0 && mMaxPreviewHeight == 0) {
+ mMaxPreviewWidth = width;
+ mMaxPreviewHeight = height;
+ }
+
+ int orientation = mActivity.getResources().getConfiguration().orientation;
+ if ((orientation == Configuration.ORIENTATION_PORTRAIT && width > height)
+ || (orientation == Configuration.ORIENTATION_LANDSCAPE && width < height)) {
+ // The screen has rotated; swap SurfaceView width & height
+ // to ensure correct preview
+ int oldWidth = width;
+ width = height;
+ height = oldWidth;
+ Log.d(TAG, "Swapping SurfaceView width & height dimensions");
+ if (mMaxPreviewWidth != 0 && mMaxPreviewHeight != 0) {
+ int temp = mMaxPreviewWidth;
+ mMaxPreviewWidth = mMaxPreviewHeight;
+ mMaxPreviewHeight = temp;
+ }
+ }
+ if (mOrientationResize != mPrevOrientationResize
+ || mAspectRatioResize) {
+ layoutPreview(mAspectRatio);
+ mAspectRatioResize = false;
+ }
+ }
+ });
+
mRenderOverlay = (RenderOverlay) mRootView.findViewById(R.id.render_overlay);
mFlashOverlay = mRootView.findViewById(R.id.flash_overlay);
mShutterButton = (ShutterButton) mRootView.findViewById(R.id.shutter_button);
@@ -372,7 +371,7 @@ public class PhotoUI implements PieListener,
break;
}
} else {
- float width = mOriginalPreviewWidth, height = mOriginalPreviewHeight;
+ float width = mMaxPreviewWidth, height = mMaxPreviewHeight;
if (width == 0 || height == 0) return;
if (mOrientationResize) {
@@ -385,18 +384,27 @@ public class PhotoUI implements PieListener,
}
} else {
if (width > height) {
- scaledTextureWidth = Math.max(width, height * mAspectRatio);
- scaledTextureHeight = Math.max(height, width / mAspectRatio);
+ if(Math.max(width, height * mAspectRatio) > width) {
+ scaledTextureWidth = width;
+ scaledTextureHeight = width / mAspectRatio;
+ } else {
+ scaledTextureWidth = height * mAspectRatio;
+ scaledTextureHeight = height;
+ }
} else {
- scaledTextureWidth = Math.max(width, height / mAspectRatio);
- scaledTextureHeight = Math.max(height, width * mAspectRatio);
+ if(Math.max(height, width * mAspectRatio) > height) {
+ scaledTextureWidth = height / mAspectRatio;
+ scaledTextureHeight = height;
+ } else {
+ scaledTextureWidth = width;
+ scaledTextureHeight = width * mAspectRatio;
+ }
}
}
Log.v(TAG, "setTransformMatrix: scaledTextureWidth = " + scaledTextureWidth
+ ", scaledTextureHeight = " + scaledTextureHeight);
- int orientation = mActivity.getResources().getConfiguration().orientation;
if (((rotation == 0 || rotation == 180) && scaledTextureWidth > scaledTextureHeight)
|| ((rotation == 90 || rotation == 270)
&& scaledTextureWidth < scaledTextureHeight)) {
@@ -425,21 +433,15 @@ public class PhotoUI implements PieListener,
if (mFaceView != null) {
mFaceView.setLayoutParams(lp);
}
+
+ mController.onScreenSizeChanged((int) mSurfaceTextureUncroppedWidth,
+ (int) mSurfaceTextureUncroppedHeight);
}
public void setSurfaceTextureSizeChangedListener(SurfaceTextureSizeChangedListener listener) {
mSurfaceTextureSizeListener = listener;
}
- private void setTransformMatrix(int width, int height) {
- mMatrix = mSurfaceView.getMatrix();
-
- // Calculate the new preview rectangle.
- RectF previewRect = new RectF(0, 0, width, height);
- mMatrix.mapRect(previewRect);
- mController.onPreviewRectChanged(CameraUtil.rectFToRect(previewRect));
- }
-
// SurfaceHolder callbacks
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
@@ -451,10 +453,6 @@ public class PhotoUI implements PieListener,
Log.v(TAG, "surfaceCreated");
mSurfaceHolder = holder;
mController.onPreviewUIReady();
- if (mPreviewWidth != 0 && mPreviewHeight != 0) {
- // Re-apply transform matrix for new surface texture
- setTransformMatrix(mPreviewWidth, mPreviewHeight);
- }
mActivity.updateThumbnail(mThumbnail);
}
@@ -669,6 +667,12 @@ public class PhotoUI implements PieListener,
mLocationDialog = null;
}
})
+ .setOnDismissListener(new DialogInterface.OnDismissListener() {
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ mActivity.setSystemBarsVisibility(false);
+ }
+ })
.show();
}
diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java
index caebbd434..82d6e2987 100644
--- a/src/com/android/camera/VideoUI.java
+++ b/src/com/android/camera/VideoUI.java
@@ -18,26 +18,23 @@ package com.android.camera;
import java.util.List;
+import org.codeaurora.snapcam.R;
+
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;
-import android.os.Message;
import android.util.Log;
import android.view.Gravity;
+import android.view.MotionEvent;
import android.view.SurfaceHolder;
-import android.view.SurfaceHolder.Callback;
import android.view.SurfaceView;
-import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLayoutChangeListener;
import android.view.ViewGroup;
-import android.view.ViewPropertyAnimator;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import android.widget.ImageView;
@@ -58,7 +55,6 @@ import com.android.camera.ui.RotateLayout;
import com.android.camera.ui.RotateTextToast;
import com.android.camera.ui.ZoomRenderer;
import com.android.camera.util.CameraUtil;
-import org.codeaurora.snapcam.R;
public class VideoUI implements PieRenderer.PieListener,
PreviewGestures.SingleTapListener,
@@ -66,7 +62,6 @@ public class VideoUI implements PieRenderer.PieListener,
SurfaceHolder.Callback,
PauseButton.OnPauseButtonListener {
private static final String TAG = "CAM_VideoUI";
- private static final int UPDATE_TRANSFORM_MATRIX = 1;
// module fields
private CameraActivity mActivity;
private View mRootView;
@@ -108,13 +103,10 @@ public class VideoUI implements PieRenderer.PieListener,
private View mPreviewCover;
private SurfaceView mSurfaceView = null;
- private int mPreviewWidth = 0;
- private int mPreviewHeight = 0;
- private int mOriginalPreviewWidth = 0;
- private int mOriginalPreviewHeight = 0;
+ private int mMaxPreviewWidth = 0;
+ private int mMaxPreviewHeight = 0;
private float mAspectRatio = 4f / 3f;
private boolean mAspectRatioResize;
- private Matrix mMatrix = null;
private final AnimationManager mAnimationManager;
private boolean mUIhidden = false;
private int mPreviewOrientation = -1;
@@ -124,43 +116,13 @@ public class VideoUI implements PieRenderer.PieListener,
private int mTopMargin = 0;
private int mBottomMargin = 0;
- // temporary variables for updating SurfaceView
- private int mTempWidth;
- private int mTempHeight;
-
private OnLayoutChangeListener mLayoutListener = new OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right,
int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
- int width = right - left;
- int height = bottom - top;
-
- int orientation = mActivity.getResources().getConfiguration().orientation;
- if ((orientation == Configuration.ORIENTATION_PORTRAIT && width > height)
- || (orientation == Configuration.ORIENTATION_LANDSCAPE && width < height)) {
- // The screen has rotated; swap SurfaceView width & height
- // to ensure correct preview
- int oldWidth = width;
- width = height;
- height = oldWidth;
- Log.d(TAG, "Swapping SurfaceView width & height dimensions");
- if (mOriginalPreviewWidth != 0 && mOriginalPreviewHeight != 0) {
- int temp = mOriginalPreviewWidth;
- mOriginalPreviewWidth = mOriginalPreviewHeight;
- mOriginalPreviewHeight = temp;
- }
+ if(mVideoMenu != null) {
+ mVideoMenu.tryToCloseSubList();
}
- if (mPreviewWidth != width || mPreviewHeight != height
- || (mOrientationResize != mPrevOrientationResize)
- || mAspectRatioResize) {
- if (mOriginalPreviewWidth == 0) mOriginalPreviewWidth = width;
- if (mOriginalPreviewHeight == 0) mOriginalPreviewHeight = height;
- mPreviewWidth = width;
- mPreviewHeight = height;
- setTransformMatrix(mPreviewWidth, mPreviewHeight);
- mAspectRatioResize = false;
- }
- mVideoMenu.tryToCloseSubList();
}
};
@@ -212,12 +174,49 @@ public class VideoUI implements PieRenderer.PieListener,
mPreviewCover = mRootView.findViewById(R.id.preview_cover);
// display the view
mSurfaceView = (SurfaceView) mRootView.findViewById(R.id.mdp_preview_content);
- mSurfaceView.setVisibility(View.VISIBLE);
- mSurfaceHolder = mSurfaceView.getHolder();
- mSurfaceHolder.addCallback(this);
- mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
- mSurfaceView.addOnLayoutChangeListener(mLayoutListener);
- Log.v(TAG, "Using mdp_preview_content (MDP path)");
+ mSurfaceView.setVisibility(View.VISIBLE);
+ mSurfaceHolder = mSurfaceView.getHolder();
+ mSurfaceHolder.addCallback(this);
+ mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
+ mSurfaceView.addOnLayoutChangeListener(mLayoutListener);
+ Log.v(TAG, "Using mdp_preview_content (MDP path)");
+
+ View surfaceContainer = mRootView.findViewById(R.id.preview_container);
+ surfaceContainer.addOnLayoutChangeListener(new OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right,
+ int bottom, int oldLeft, int oldTop, int oldRight,
+ int oldBottom) {
+ int width = right - left;
+ int height = bottom - top;
+
+ if (mMaxPreviewWidth == 0 && mMaxPreviewHeight == 0) {
+ mMaxPreviewWidth = width;
+ mMaxPreviewHeight = height;
+ }
+
+ int orientation = mActivity.getResources().getConfiguration().orientation;
+ if ((orientation == Configuration.ORIENTATION_PORTRAIT && width > height)
+ || (orientation == Configuration.ORIENTATION_LANDSCAPE && width < height)) {
+ // The screen has rotated; swap SurfaceView width & height
+ // to ensure correct preview
+ int oldWidth = width;
+ width = height;
+ height = oldWidth;
+ Log.d(TAG, "Swapping SurfaceView width & height dimensions");
+ if (mMaxPreviewWidth != 0 && mMaxPreviewHeight != 0) {
+ int temp = mMaxPreviewWidth;
+ mMaxPreviewWidth = mMaxPreviewHeight;
+ mMaxPreviewHeight = temp;
+ }
+ }
+ if (mOrientationResize != mPrevOrientationResize
+ || mAspectRatioResize) {
+ layoutPreview(mAspectRatio);
+ mAspectRatioResize = false;
+ }
+ }
+ });
mFlashOverlay = mRootView.findViewById(R.id.flash_overlay);
mShutterButton = (ShutterButton) mRootView.findViewById(R.id.shutter_button);
@@ -251,9 +250,6 @@ public class VideoUI implements PieRenderer.PieListener,
mBottomMargin = l / 4 - mTopMargin;
}
mCameraControls.setMargins(mTopMargin, mBottomMargin);
-
- mOriginalPreviewWidth = size.x;
- mOriginalPreviewHeight = size.y;
}
public void cameraOrientationPreviewResize(boolean orientation){
@@ -341,16 +337,8 @@ public class VideoUI implements PieRenderer.PieListener,
layoutPreview((float)ratio);
}
- public int getPreviewWidth() {
- return mPreviewWidth;
- }
-
- public int getPreviewHeight() {
- return mPreviewHeight;
- }
-
private void layoutPreview(float ratio) {
- FrameLayout.LayoutParams lp;
+ FrameLayout.LayoutParams lp = null;
float scaledTextureWidth, scaledTextureHeight;
int rotation = CameraUtil.getDisplayRotation(mActivity);
@@ -384,8 +372,8 @@ public class VideoUI implements PieRenderer.PieListener,
scaledTextureHeight = l * 3 / 4;
break;
}
- } else {
- float width = mOriginalPreviewWidth, height = mOriginalPreviewHeight;
+ } else if (mMaxPreviewWidth != 0 && mMaxPreviewHeight != 0) {
+ float width = mMaxPreviewWidth, height = mMaxPreviewHeight;
if (mOrientationResize) {
scaledTextureWidth = height * mAspectRatio;
if (scaledTextureWidth > width) {
@@ -396,18 +384,27 @@ public class VideoUI implements PieRenderer.PieListener,
}
} else {
if (width > height) {
- scaledTextureWidth = Math.max(width, height * mAspectRatio);
- scaledTextureHeight = Math.max(height, width / mAspectRatio);
+ if(Math.max(width, height * mAspectRatio) > width) {
+ scaledTextureWidth = width;
+ scaledTextureHeight = width / mAspectRatio;
+ } else {
+ scaledTextureWidth = height * mAspectRatio;
+ scaledTextureHeight = height;
+ }
} else {
- scaledTextureWidth = Math.max(width, height / mAspectRatio);
- scaledTextureHeight = Math.max(height, width * mAspectRatio);
+ if(Math.max(height, width * mAspectRatio) > height) {
+ scaledTextureWidth = height / mAspectRatio;
+ scaledTextureHeight = height;
+ } else {
+ scaledTextureWidth = width;
+ scaledTextureHeight = width * mAspectRatio;
+ }
}
}
Log.v(TAG, "setTransformMatrix: scaledTextureWidth = " + scaledTextureWidth
+ ", scaledTextureHeight = " + scaledTextureHeight);
- int orientation = mActivity.getResources().getConfiguration().orientation;
if (((rotation == 0 || rotation == 180) && scaledTextureWidth > scaledTextureHeight)
|| ((rotation == 90 || rotation == 270)
&& scaledTextureWidth < scaledTextureHeight)) {
@@ -418,20 +415,11 @@ public class VideoUI implements PieRenderer.PieListener,
(int) scaledTextureHeight, Gravity.CENTER);
}
}
- mSurfaceView.setLayoutParams(lp);
- }
- private void setTransformMatrix(int width, int height) {
- if (width == 0 || height == 0) return;
- mMatrix = mSurfaceView.getMatrix();
-
- mTempWidth = (int) width;
- mTempHeight = (int) height;
- FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mSurfaceView
- .getLayoutParams();
- params.width = mTempWidth;
- params.height = mTempHeight;
- mSurfaceView.setLayoutParams(params);
+ if(lp != null) {
+ mSurfaceView.setLayoutParams(lp);
+ mSurfaceView.requestLayout();
+ }
}
/**
@@ -569,14 +557,10 @@ public class VideoUI implements PieRenderer.PieListener,
public void hideSurfaceView() {
mSurfaceView.setVisibility(View.GONE);
-
- setTransformMatrix(mPreviewWidth, mPreviewHeight);
}
public void showSurfaceView() {
mSurfaceView.setVisibility(View.VISIBLE);
-
- setTransformMatrix(mPreviewWidth, mPreviewHeight);
}
private void initializeOverlay() {
@@ -671,12 +655,6 @@ public class VideoUI implements PieRenderer.PieListener,
mIsTimeLapse = enable;
}
- private void openMenu() {
- if (mPieRenderer != null) {
- mPieRenderer.showInCenter();
- }
- }
-
public void dismissPopup(boolean topLevelOnly) {
// In review mode, we do not want to bring up the camera UI
if (mController.isInReviewMode()) return;
@@ -1063,10 +1041,6 @@ public class VideoUI implements PieRenderer.PieListener,
Log.v(TAG, "surfaceCreated");
mSurfaceHolder = holder;
mController.onPreviewUIReady();
- if (mPreviewWidth != 0 && mPreviewHeight != 0) {
- // Re-apply transform matrix for new surface texture
- setTransformMatrix(mPreviewWidth, mPreviewHeight);
- }
mActivity.updateThumbnail(mThumbnail);
}