diff options
Diffstat (limited to 'src/com/android/camera/PhotoUI.java')
-rw-r--r-- | src/com/android/camera/PhotoUI.java | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java index 5d428e432..d4503af77 100644 --- a/src/com/android/camera/PhotoUI.java +++ b/src/com/android/camera/PhotoUI.java @@ -160,26 +160,15 @@ public class PhotoUI implements PieListener, private int mOrientation; private float mScreenBrightness = 0.0f; + public enum SURFACE_STATUS { + HIDE, + SURFACE_VIEW; + } + public interface SurfaceTextureSizeChangedListener { public void onSurfaceTextureSizeChanged(int uncroppedWidth, int uncroppedHeight); } - 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) { - tryToCloseSubList(); - - Camera.Parameters parameters = ((PhotoModule)mController).getParameters(); - if(parameters != null) { - Camera.Size size = parameters.getPreviewSize(); - if (size != null) { - setAspectRatio((float) size.width / size.height); - } - } - } - }; - public CameraControls getCameraControls() { return mCameraControls; } @@ -233,6 +222,14 @@ public class PhotoUI implements PieListener, } } + public synchronized void applySurfaceChange(SURFACE_STATUS status) { + if(status == SURFACE_STATUS.HIDE) { + mSurfaceView.setVisibility(View.GONE); + return; + } + mSurfaceView.setVisibility(View.VISIBLE); + } + public PhotoUI(CameraActivity activity, PhotoController controller, View parent) { mActivity = activity; mController = controller; @@ -246,11 +243,8 @@ public class PhotoUI implements PieListener, 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() { + mSurfaceView.addOnLayoutChangeListener(new OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, @@ -258,6 +252,8 @@ public class PhotoUI implements PieListener, int width = right - left; int height = bottom - top; + tryToCloseSubList(); + if (mMaxPreviewWidth == 0 && mMaxPreviewHeight == 0) { mMaxPreviewWidth = width; mMaxPreviewHeight = height; |