diff options
author | Brint E. Kriebel <bekit@cyngn.com> | 2014-11-03 19:07:51 -0800 |
---|---|---|
committer | Brint E. Kriebel <bekit@cyngn.com> | 2014-11-03 19:07:51 -0800 |
commit | a96c64c80dfa1180fef0e4e5e11379cef029f602 (patch) | |
tree | 12e0e78eb9abae2b30fc1fa6cd1b2b005193e8bf /src/com/android/camera/PhotoUI.java | |
parent | 3566d8289d9d70b4581c170f01544011054dd514 (diff) | |
parent | f19adb54a1dc0103751f581772983ef77a357457 (diff) | |
download | android_packages_apps_Camera2-a96c64c80dfa1180fef0e4e5e11379cef029f602.tar.gz android_packages_apps_Camera2-a96c64c80dfa1180fef0e4e5e11379cef029f602.tar.bz2 android_packages_apps_Camera2-a96c64c80dfa1180fef0e4e5e11379cef029f602.zip |
Merge branch 'cm-11.0' into stable/cm-11.0
Conflicts:
res/values-az/cm_strings.xml
res/values-in/cm_strings.xml
res/values-it/cm_strings.xml
res/values-iw/cm_strings.xml
res/values-ku/qcomstrings.xml
res/values-nb/cm_strings.xml
res/values-pl/cm_strings.xml
res/values-sk/cm_strings.xml
res/values-th/cm_strings.xml
res/values/qcomarrays.xml
res/values/qcomstrings.xml
Change-Id: Ib4294c621052fdd02ba3ab715deda052432d2fd0
Diffstat (limited to 'src/com/android/camera/PhotoUI.java')
-rw-r--r-- | src/com/android/camera/PhotoUI.java | 101 |
1 files changed, 61 insertions, 40 deletions
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java index 9b97a34ba..2b0f355f9 100644 --- a/src/com/android/camera/PhotoUI.java +++ b/src/com/android/camera/PhotoUI.java @@ -74,7 +74,7 @@ public class PhotoUI implements PieListener, private static final String TAG = "CAM_UI"; private static final String PERSIST_LONG_ENABLE = "persist.camera.longshot.enable"; - private static final int DOWN_SAMPLE_FACTOR = 4; + private int mDownSampleFactor = 4; private final AnimationManager mAnimationManager; private CameraActivity mActivity; private PhotoController mController; @@ -176,7 +176,7 @@ public class PhotoUI implements PieListener, @Override protected Bitmap doInBackground(Void... params) { // Decode image in background. - Bitmap bitmap = CameraUtil.downSample(mData, DOWN_SAMPLE_FACTOR); + Bitmap bitmap = CameraUtil.downSample(mData, mDownSampleFactor); if ((mOrientation != 0 || mMirror) && (bitmap != null)) { Matrix m = new Matrix(); if (mMirror) { @@ -218,6 +218,29 @@ public class PhotoUI implements PieListener, } } + private class SettingsPopup extends PopupWindow { + public SettingsPopup(View popup) { + super(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); + setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + setOutsideTouchable(true); + setFocusable(true); + popup.setVisibility(View.VISIBLE); + setContentView(popup); + showAtLocation(mRootView, Gravity.CENTER, 0, 0); + } + + public void dismiss() { + super.dismiss(); + popupDismissed(); + showUI(); + mMenu.popupDismissed(); + + // Switch back into fullscreen/lights-out mode after popup + // is dimissed. + mActivity.setSystemBarsVisibility(false); + } + } + public PhotoUI(CameraActivity activity, PhotoController controller, View parent) { mActivity = activity; mController = controller; @@ -257,6 +280,10 @@ public class PhotoUI implements PieListener, mPrevOrientationResize = false; } + public void setDownFactor(int factor) { + mDownSampleFactor = factor; + } + public void cameraOrientationPreviewResize(boolean orientation){ mPrevOrientationResize = mOrientationResize; mOrientationResize = orientation; @@ -269,10 +296,12 @@ public class PhotoUI implements PieListener, ratio = 1 / ratio; } - Log.d(TAG,"setAspectRatio() ratio["+ratio+"] mAspectRatio["+mAspectRatio+"]"); - mAspectRatio = ratio; - mAspectRatioResize = true; - mTextureView.requestLayout(); + if (mAspectRatio != ratio) { + Log.d(TAG,"setAspectRatio() ratio["+ratio+"] mAspectRatio["+mAspectRatio+"]"); + mAspectRatio = ratio; + mAspectRatioResize = true; + mTextureView.requestLayout(); + } } public void setSurfaceTextureSizeChangedListener(SurfaceTextureSizeChangedListener listener) { @@ -293,15 +322,11 @@ public class PhotoUI implements PieListener, } } else { if (width > height) { - scaledTextureWidth = Math.max(width, - (int) (height * mAspectRatio)); - scaledTextureHeight = Math.max(height, - (int)(width / mAspectRatio)); + scaledTextureWidth = Math.max(width, height * mAspectRatio); + scaledTextureHeight = Math.max(height, width / mAspectRatio); } else { - scaledTextureWidth = Math.max(width, - (int) (height / mAspectRatio)); - scaledTextureHeight = Math.max(height, - (int) (width * mAspectRatio)); + scaledTextureWidth = Math.max(width, height / mAspectRatio); + scaledTextureHeight = Math.max(height, width * mAspectRatio); } } @@ -594,12 +619,18 @@ public class PhotoUI implements PieListener, mOnScreenIndicators.updateExposureOnScreenIndicator(params, CameraSettings.readExposure(prefs)); mOnScreenIndicators.updateFlashOnScreenIndicator(params.getFlashMode()); - int wbIndex = 2; + int wbIndex = -1; + String wb = Camera.Parameters.WHITE_BALANCE_AUTO; + if (Camera.Parameters.SCENE_MODE_AUTO.equals(params.getSceneMode())) { + wb = params.getWhiteBalance(); + } ListPreference pref = group.findPreference(CameraSettings.KEY_WHITE_BALANCE); if (pref != null) { - wbIndex = pref.getCurrentUnfilteredIndex(); + wbIndex = pref.findIndexOfValue(wb); } - mOnScreenIndicators.updateWBIndicator(wbIndex); + // make sure the correct value was found + // otherwise use auto index + mOnScreenIndicators.updateWBIndicator(wbIndex < 0 ? 2 : wbIndex); boolean location = RecordLocationPreference.get( prefs, mActivity.getContentResolver()); mOnScreenIndicators.updateLocationIndicator(location); @@ -669,27 +700,10 @@ public class PhotoUI implements PieListener, public void showPopup(AbstractSettingPopup popup) { hideUI(); - if (mPopup == null) { - mPopup = new PopupWindow(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - mPopup.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); - mPopup.setOutsideTouchable(true); - mPopup.setFocusable(true); - mPopup.setOnDismissListener(new PopupWindow.OnDismissListener() { - @Override - public void onDismiss() { - mPopup = null; - mMenu.popupDismissed(); - showUI(); - - // Switch back into fullscreen/lights-out mode after popup - // is dimissed. - mActivity.setSystemBarsVisibility(false); - } - }); + if (mPopup != null) { + mPopup.dismiss(); } - popup.setVisibility(View.VISIBLE); - mPopup.setContentView(popup); - mPopup.showAtLocation(mRootView, Gravity.CENTER, 0, 0); + mPopup = new SettingsPopup(popup); } public void dismissPopup() { @@ -698,6 +712,10 @@ public class PhotoUI implements PieListener, } } + private void popupDismissed() { + mPopup = null; + } + public void onShowSwitcherPopup() { if (mPieRenderer != null && mPieRenderer.showsItems()) { mPieRenderer.hide(); @@ -917,17 +935,20 @@ public class PhotoUI implements PieListener, @Override public void onFocusStarted() { - getFocusIndicator().showStart(); + FocusIndicator indicator = getFocusIndicator(); + if (indicator != null) indicator.showStart(); } @Override public void onFocusSucceeded(boolean timeout) { - getFocusIndicator().showSuccess(timeout); + FocusIndicator indicator = getFocusIndicator(); + if (indicator != null) indicator.showSuccess(timeout); } @Override public void onFocusFailed(boolean timeout) { - getFocusIndicator().showFail(timeout); + FocusIndicator indicator = getFocusIndicator(); + if (indicator != null) indicator.showFail(timeout); } @Override |