diff options
author | Wu-cheng Li <wuchengli@google.com> | 2010-11-13 15:14:20 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2010-11-13 15:23:27 +0800 |
commit | 70027ba6263ffc7958a24ad8524e7e0a00323816 (patch) | |
tree | de8cce5420d1c6c15a95a2434f78da5d34d0a017 /src/com | |
parent | fec1720cda1be572610c601ef6a6d929fb37be65 (diff) | |
download | LegacyCamera-70027ba6263ffc7958a24ad8524e7e0a00323816.zip LegacyCamera-70027ba6263ffc7958a24ad8524e7e0a00323816.tar.gz LegacyCamera-70027ba6263ffc7958a24ad8524e7e0a00323816.tar.bz2 |
Various UI changes.
- Add video quality to the indicator wheel.
- Remove the head-up display in camcorder app from xlarge devices.
- Move recording time down a little bit.
- Align the zoom control to the left of control panel.
Change-Id: I0732e80edd80a703bcb2350fb4bb01a2c473e6a5
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/camera/Camera.java | 6 | ||||
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 46 |
2 files changed, 37 insertions, 15 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 1cdb467..3cb0b71 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -250,9 +250,8 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, private String mSceneMode; private final Handler mHandler = new MainHandler(); - // Small devices use head-up display for camera settings. + // xlarge devices use control panel. Other devices use head-up display. private CameraHeadUpDisplay mHeadUpDisplay; - // xlarge devices use control panel for camera settings. private ControlPanel mControlPanel; private PreferenceGroup mPreferenceGroup; @@ -366,11 +365,12 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, installIntentFilter(); initializeFocusTone(); initializeZoom(); + // xlarge devices use control panel. Other devices use head-up display. if (mControlPanel == null) { mHeadUpDisplay = new CameraHeadUpDisplay(this); mHeadUpDisplay.setListener(new MyHeadUpDisplayListener()); + initializeHeadUpDisplay(); } - initializeHeadUpDisplay(); mFirstTimeInitialized = true; changeHeadUpDisplayState(); addIdleHandler(); diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index b7e1ff9..9978d04 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -144,6 +144,7 @@ public class VideoCamera extends NoSearchActivity private SurfaceHolder mSurfaceHolder = null; private ImageView mVideoFrame; private GLRootView mGLRootView; + // xlarge devices use control panel. Other devices use head-up display. private CamcorderHeadUpDisplay mHeadUpDisplay; private ControlPanel mControlPanel; private MenuItem mSwitchTimeLapseMenuItem; @@ -404,15 +405,18 @@ public class VideoCamera extends NoSearchActivity // ignore } - // Initialize the HeadUpDiplay after startPreview(). We need mParameters - // for HeadUpDisplay and it is initialized in that function. - mHeadUpDisplay = new CamcorderHeadUpDisplay(this); - mHeadUpDisplay.setListener(new MyHeadUpDisplayListener()); - initializeHeadUpDisplay(); + // Initialize after startPreview becuase this need mParameters. initializeControlPanel(); + // xlarge devices use control panel. Other devices use head-up display. + if (mControlPanel == null) { + mHeadUpDisplay = new CamcorderHeadUpDisplay(this); + mHeadUpDisplay.setListener(new MyHeadUpDisplayListener()); + initializeHeadUpDisplay(); + } } private void changeHeadUpDisplayState() { + if (mHeadUpDisplay == null) return; // If the camera resumes behind the lock screen, the orientation // will be portrait. That causes OOM when we try to allocation GPU // memory for the GLSurfaceView again when the orientation changes. So, @@ -428,6 +432,7 @@ public class VideoCamera extends NoSearchActivity } private void initializeHeadUpDisplay() { + if (mHeadUpDisplay == null) return; CameraSettings settings = new CameraSettings(this, mParameters, mCameraId, CameraHolder.instance().getCameraInfo()); @@ -451,10 +456,26 @@ public class VideoCamera extends NoSearchActivity mGLRootView = null; } + private boolean collapseCameraControls() { + if (mHeadUpDisplay != null && mHeadUpDisplay.collapse()) { + return true; + } + if (mControlPanel != null && mControlPanel.dismissSettingPopup()) { + return true; + } + return false; + } + + private void enableCameraControls(boolean enable) { + if (mHeadUpDisplay != null) mHeadUpDisplay.setEnabled(enable); + if (mControlPanel != null) mControlPanel.setEnabled(enable); + } + private void initializeControlPanel() { String[] keys = new String[]{CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE, CameraSettings.KEY_WHITE_BALANCE, CameraSettings.KEY_COLOR_EFFECT, + CameraSettings.KEY_VIDEO_QUALITY, CameraSettings.KEY_CAMERA_ID}; mControlPanel = (ControlPanel) findViewById(R.id.control_panel); if (mControlPanel != null) { @@ -531,8 +552,7 @@ public class VideoCamera extends NoSearchActivity public void onShutterButtonClick(ShutterButton button) { switch (button.getId()) { case R.id.shutter_button: - if (mHeadUpDisplay.collapse()) return; - if (mControlPanel != null) mControlPanel.dismissSettingPopup(); + if (collapseCameraControls()) return; if (mMediaRecorderRecording) { onStopVideoRecording(true); @@ -834,7 +854,7 @@ public class VideoCamera extends NoSearchActivity if (mPausing) return; if (mMediaRecorderRecording) { onStopVideoRecording(false); - } else if (mHeadUpDisplay == null || !mHeadUpDisplay.collapse()) { + } else if (!collapseCameraControls()) { super.onBackPressed(); } } @@ -916,7 +936,7 @@ public class VideoCamera extends NoSearchActivity // If video quality changes, the surface will change. But we need to // initialize the recorder here. So collpase the head-up display to // keep the state of recorder consistent. - mHeadUpDisplay.collapse(); + collapseCameraControls(); restartPreview(); initializeRecorder(); } @@ -1340,7 +1360,7 @@ public class VideoCamera extends NoSearchActivity Log.e(TAG, "Could not start media recorder. ", e); return; } - mHeadUpDisplay.setEnabled(false); + enableCameraControls(false); mMediaRecorderRecording = true; mRecordingStartTime = SystemClock.uptimeMillis(); @@ -1447,7 +1467,7 @@ public class VideoCamera extends NoSearchActivity Log.e(TAG, "stop fail: " + e.getMessage()); deleteVideoFile(mVideoFilename); } - mHeadUpDisplay.setEnabled(true); + enableCameraControls(true); mMediaRecorderRecording = false; } releaseMediaRecorder(); @@ -1828,7 +1848,9 @@ public class VideoCamera extends NoSearchActivity private void onRestorePreferencesClicked() { Runnable runnable = new Runnable() { public void run() { - mHeadUpDisplay.restorePreferences(mParameters); + if (mHeadUpDisplay != null) { + mHeadUpDisplay.restorePreferences(mParameters); + } } }; MenuHelper.confirmAction(this, |