diff options
Diffstat (limited to 'src/com/android/camera/Camera.java')
| -rw-r--r-- | src/com/android/camera/Camera.java | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 8973bac..ffd2137 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -105,10 +105,6 @@ public class Camera extends ActivityBase implements FocusManager.Listener, // needed to be updated in mUpdateSet. private int mUpdateSet; - // The brightness settings used when it is set to automatic in the system. - // The reason why it is set to 0.7 is just because 1.0 is too bright. - private static final float DEFAULT_CAMERA_BRIGHTNESS = 0.7f; - private static final int SCREEN_DELAY = 2 * 60 * 1000; private static final int ZOOM_STOPPED = 0; @@ -145,6 +141,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener, private boolean mOpenCameraFail = false; private boolean mCameraDisabled = false; + private View mPreviewPanel; // The container of PreviewFrameLayout. private PreviewFrameLayout mPreviewFrameLayout; private View mPreviewFrame; // Preview frame area. @@ -365,7 +362,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener, mFocusIndicator = (RotateLayout) findViewById(R.id.focus_indicator_rotate_layout); mFocusManager.initialize(mFocusIndicator, mPreviewFrame, mFaceView, this); mFocusManager.initializeToneGenerator(); - initializeScreenBrightness(); + Util.initializeScreenBrightness(getWindow(), getContentResolver()); installIntentFilter(); initializeZoom(); // Show the tap to focus toast if this is the first start. @@ -1192,20 +1189,6 @@ public class Camera extends ActivityBase implements FocusManager.Listener, mDidRegister = true; } - private void initializeScreenBrightness() { - Window win = getWindow(); - // Overright the brightness settings if it is automatic - int mode = Settings.System.getInt( - getContentResolver(), - Settings.System.SCREEN_BRIGHTNESS_MODE, - Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); - if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) { - WindowManager.LayoutParams winParams = win.getAttributes(); - winParams.screenBrightness = DEFAULT_CAMERA_BRIGHTNESS; - win.setAttributes(winParams); - } - } - @Override protected void onResume() { super.onResume(); @@ -1342,7 +1325,8 @@ public class Camera extends ActivityBase implements FocusManager.Listener, // Preview area is touched. Handle touch focus. @Override public boolean onTouch(View v, MotionEvent e) { - if (mPausing || !mFirstTimeInitialized || mCameraState == SNAPSHOT_IN_PROGRESS) { + if (mPausing || mCameraDevice == null || !mFirstTimeInitialized + || mCameraState == SNAPSHOT_IN_PROGRESS) { return false; } @@ -1605,7 +1589,8 @@ public class Camera extends ActivityBase implements FocusManager.Listener, // Set the preview frame aspect ratio according to the picture size. Size size = mParameters.getPictureSize(); - mPreviewFrameLayout = (PreviewFrameLayout) findViewById(R.id.frame_layout); + mPreviewPanel = findViewById(R.id.frame_layout); + mPreviewFrameLayout = (PreviewFrameLayout) findViewById(R.id.frame); mPreviewFrameLayout.setAspectRatio((double) size.width / size.height); // Set a preview size that is closest to the viewfinder height and has @@ -1953,8 +1938,9 @@ public class Camera extends ActivityBase implements FocusManager.Listener, private void showSharePopup() { Uri uri = mThumbnail.getUri(); if (mSharePopup == null || !uri.equals(mSharePopup.getUri())) { + // SharePopup window takes the mPreviewPanel as its size reference. mSharePopup = new SharePopup(this, uri, mThumbnail.getBitmap(), - mOrientationCompensation, mPreviewFrameLayout); + mOrientationCompensation, mPreviewPanel); } mSharePopup.showAtLocation(mThumbnailView, Gravity.NO_GRAVITY, 0, 0); } |
