diff options
author | Jack Yoo <jyoo@codeaurora.org> | 2016-02-22 17:40:11 -0800 |
---|---|---|
committer | Jack Yoo <jyoo@codeaurora.org> | 2016-04-06 09:50:12 -0700 |
commit | cef16d76d423dbdb426046ad5a339c32b9ac6f75 (patch) | |
tree | 6bf09e496b9a59a5d83127b32ef1b7fe7938e17d /src/com/android/camera/PhotoUI.java | |
parent | 3618eb79912c36216b197580e54e366ab19d2a61 (diff) | |
download | android_packages_apps_Snap-cef16d76d423dbdb426046ad5a339c32b9ac6f75.tar.gz android_packages_apps_Snap-cef16d76d423dbdb426046ad5a339c32b9ac6f75.tar.bz2 android_packages_apps_Snap-cef16d76d423dbdb426046ad5a339c32b9ac6f75.zip |
SnapdragonCamera: Adjusting view initialization
Instead of removing and adding the entire root view, changing only
core surface view on module change.
Change-Id: I5c39cf23b2a58280f4e4e8484865bbed0b12e1cf
CRs-Fixed: 979254
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 7e3659f0f..0cc1512b3 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; |