diff options
Diffstat (limited to 'src/com/android/camera/PhotoUI.java')
-rw-r--r-- | src/com/android/camera/PhotoUI.java | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java index 40672547a..48fb2f704 100644 --- a/src/com/android/camera/PhotoUI.java +++ b/src/com/android/camera/PhotoUI.java @@ -103,7 +103,6 @@ public class PhotoUI implements PieListener, private View mMenuButton; private PhotoMenu mMenu; - private CustomPhotoMenu mCustomPhotoMenu; private ModuleSwitcher mSwitcher; private CameraControls mCameraControls; private AlertDialog mLocationDialog; @@ -120,8 +119,10 @@ public class PhotoUI implements PieListener, private int mPreviewWidth = 0; private int mPreviewHeight = 0; + private int mOriginalPreviewWidth = 0; + private int mOriginalPreviewHeight = 0; + public boolean mMenuInitialized = false; - public boolean mCustomPhotoMenuInitialized = false; private float mSurfaceTextureUncroppedWidth; private float mSurfaceTextureUncroppedHeight; @@ -181,21 +182,28 @@ public class PhotoUI implements PieListener, 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(width, height); + setTransformMatrix(mOriginalPreviewWidth, mOriginalPreviewHeight); mController.onScreenSizeChanged((int) mSurfaceTextureUncroppedWidth, (int) mSurfaceTextureUncroppedHeight); mAspectRatioResize = false; } - if (mCustomPhotoMenu != null) - mCustomPhotoMenu.tryToCloseSubList(); + if (mMenu != null) + mMenu.tryToCloseSubList(); } }; @@ -373,7 +381,6 @@ public class PhotoUI implements PieListener, + ", scaledTextureHeight = " + scaledTextureHeight); mTempWidth = (int) scaledTextureWidth; mTempHeight = (int) scaledTextureHeight; - mSurfaceView.requestLayout(); mSurfaceViewUpdateHandler.post(updateSurfaceView); // Calculate the new preview rectangle. @@ -429,19 +436,12 @@ public class PhotoUI implements PieListener, } if (mMenu == null) { - mMenu = new PhotoMenu(mActivity, this, mPieRenderer); + mMenu = new PhotoMenu(mActivity, this); mMenu.setListener(listener); } mMenu.initialize(prefGroup); mMenuInitialized = true; - if (mCustomPhotoMenu == null) { - mCustomPhotoMenu = new CustomPhotoMenu(mActivity, this); - mCustomPhotoMenu.setListener(listener); - } - mCustomPhotoMenu.initialize(prefGroup); - mCustomPhotoMenuInitialized = true; - if (mZoomRenderer == null) { mZoomRenderer = new ZoomRenderer(mActivity); mRenderOverlay.addRenderer(mZoomRenderer); @@ -452,7 +452,7 @@ public class PhotoUI implements PieListener, mGestures = new PreviewGestures(mActivity, this, mZoomRenderer, mPieRenderer); mRenderOverlay.setGestures(mGestures); } - mGestures.setCustomPhotoMenu(mCustomPhotoMenu); + mGestures.setPhotoMenu(mMenu); mGestures.setZoomEnabled(params.isZoomSupported()); mGestures.setRenderOverlay(mRenderOverlay); @@ -493,7 +493,7 @@ public class PhotoUI implements PieListener, mMenuButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - mCustomPhotoMenu.openFirstLevel(); + mMenu.openFirstLevel(); } }); if (mController.isImageCaptureIntent()) { @@ -538,7 +538,7 @@ public class PhotoUI implements PieListener, } public void showUI() { - if (!mUIhidden || (mCustomPhotoMenu != null && mCustomPhotoMenu.isMenuBeingShown())) + if (!mUIhidden || (mMenu != null && mMenu.isMenuBeingShown())) return; mUIhidden = false; mCameraControls.showUI(); @@ -589,9 +589,6 @@ public class PhotoUI implements PieListener, if (mMenu != null) { mMenu.reloadPreferences(); } - if (mCustomPhotoMenu != null) { - mCustomPhotoMenu.reloadPreferences(); - } } public void showLocationDialog() { @@ -645,8 +642,6 @@ public class PhotoUI implements PieListener, public void hideGpsOnScreenIndicator() { } public void overrideSettings(final String ... keyvalues) { - if (mCustomPhotoMenu != null) - mCustomPhotoMenu.overrideSettings(keyvalues); if (mMenu == null) return; mMenu.overrideSettings(keyvalues); @@ -696,7 +691,7 @@ public class PhotoUI implements PieListener, } public boolean onBackPressed() { - if (mCustomPhotoMenu != null && mCustomPhotoMenu.handleBackKey()) { + if (mMenu != null && mMenu.handleBackKey()) { return true; } @@ -783,9 +778,9 @@ public class PhotoUI implements PieListener, } if (animate) { if (level == 1) - mCustomPhotoMenu.animateSlideIn(popup, CameraActivity.SETTING_LIST_WIDTH_1, true); + mMenu.animateSlideIn(popup, CameraActivity.SETTING_LIST_WIDTH_1, true); if (level == 2) - mCustomPhotoMenu.animateFadeIn(popup); + mMenu.animateFadeIn(popup); } else popup.setAlpha(0.85f); } @@ -809,7 +804,7 @@ public class PhotoUI implements PieListener, @Override public void onDismiss() { mPopup = null; - mMenu.popupDismissed(mDismissAll); + // mMenu.popupDismissed(mDismissAll); mDismissAll = false; showUI(); @@ -899,8 +894,8 @@ public class PhotoUI implements PieListener, mSwitcher.closePopup(); // Remove all the popups/dialog boxes boolean ret = false; - if (mCustomPhotoMenu != null) { - mCustomPhotoMenu.closeAllView(); + if (mMenu != null) { + mMenu.closeAllView(); } if (mPopup != null) { dismissAllPopup(); @@ -939,9 +934,9 @@ public class PhotoUI implements PieListener, mFaceView.setDisplayOrientation(orientation); } if ((mPreviewOrientation == -1 || mPreviewOrientation != orientation) - && mCustomPhotoMenu != null && mCustomPhotoMenu.isPreviewMenuBeingShown()) { + && mMenu != null && mMenu.isPreviewMenuBeingShown()) { dismissSceneModeMenu(); - mCustomPhotoMenu.addModeBack(); + mMenu.addModeBack(); } mPreviewOrientation = orientation; } |