diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/Camera.java | 43 | ||||
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 34 |
2 files changed, 44 insertions, 33 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 390cad6..badc18c 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -1036,8 +1036,6 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, // ignore } - loadCameraPreferences(); - // Do this after starting preview because it depends on camera // parameters. initializeControlPanel(); @@ -1090,31 +1088,40 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, private void loadCameraPreferences() { CameraSettings settings = new CameraSettings(this, mInitialParams, mCameraId, CameraHolder.instance().getCameraInfo()); - mPreferenceGroup = settings.getPreferenceGroup( - R.xml.camera_preferences); - mFrontCameraId = - settings.getCameraIdByIndex(CameraInfo.CAMERA_FACING_FRONT); - mBackCameraId = - settings.getCameraIdByIndex(CameraInfo.CAMERA_FACING_BACK); + // Only need to load camera IDs once + if (mPreferenceGroup == null) { + mPreferenceGroup = settings.getPreferenceGroup( + R.xml.camera_preferences); + mFrontCameraId = + settings.getCameraIdByIndex(CameraInfo.CAMERA_FACING_FRONT); + mBackCameraId = + settings.getCameraIdByIndex(CameraInfo.CAMERA_FACING_BACK); + } else { + mPreferenceGroup = settings.getPreferenceGroup( + R.xml.camera_preferences); + } } private void initializeControlPanel() { + mControlPanel = (ControlPanel) findViewById(R.id.control_panel); + if (mControlPanel == null) return; + loadCameraPreferences(); + String[] keys = new String[]{CameraSettings.KEY_FLASH_MODE, CameraSettings.KEY_WHITE_BALANCE, CameraSettings.KEY_COLOR_EFFECT, CameraSettings.KEY_SCENE_MODE}; - mControlPanel = (ControlPanel) findViewById(R.id.control_panel); - if (mControlPanel != null) { - mControlPanel.initialize(this, mPreferenceGroup, keys, true); - mControlPanel.setListener(new MyControlPanelListener()); - mPopupGestureDetector = new GestureDetector(this, - new PopupGestureListener()); - updateSceneModeUI(); - } + mControlPanel.initialize(this, mPreferenceGroup, keys, true); + mControlPanel.setListener(new MyControlPanelListener()); + mPopupGestureDetector = new GestureDetector(this, + new PopupGestureListener()); + updateSceneModeUI(); } private void initializeHeadUpDisplay() { if (mHeadUpDisplay == null) return; + loadCameraPreferences(); + // If we have zoom picker, do not show zoom control on head-up display. float[] zoomRatios = null; if (mZoomPicker == null) zoomRatios = getZoomRatios(); @@ -2227,9 +2234,7 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, initializeZoom(); // Reload the UI. - if (mFirstTimeInitialized) { - initializeHeadUpDisplay(); - } + initializeHeadUpDisplay(); initializeControlPanel(); } diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index ea5156a..abfa52e 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -389,8 +389,6 @@ public class VideoCamera extends NoSearchActivity resizeForPreviewAspectRatio(); - loadCameraPreferences(); - // Initialize after startPreview becuase this need mParameters. initializeControlPanel(); // xlarge devices use control panel. Other devices use head-up display. @@ -435,15 +433,22 @@ public class VideoCamera extends NoSearchActivity CameraSettings settings = new CameraSettings(this, mParameters, mCameraId, CameraHolder.instance().getCameraInfo()); - mPreferenceGroup = settings.getPreferenceGroup(R.xml.video_preferences); - mFrontCameraId = - settings.getCameraIdByIndex(CameraInfo.CAMERA_FACING_FRONT); - mBackCameraId = - settings.getCameraIdByIndex(CameraInfo.CAMERA_FACING_BACK); + // Only need to load camera ID's once + if (mPreferenceGroup == null) { + mPreferenceGroup = settings.getPreferenceGroup(R.xml.video_preferences); + mFrontCameraId = + settings.getCameraIdByIndex(CameraInfo.CAMERA_FACING_FRONT); + mBackCameraId = + settings.getCameraIdByIndex(CameraInfo.CAMERA_FACING_BACK); + } else { + mPreferenceGroup = settings.getPreferenceGroup(R.xml.video_preferences); + } } private void initializeHeadUpDisplay() { if (mHeadUpDisplay == null) return; + loadCameraPreferences(); + if (mIsVideoCaptureIntent) { mPreferenceGroup = filterPreferenceScreenByIntent(mPreferenceGroup); } @@ -481,17 +486,18 @@ public class VideoCamera extends NoSearchActivity } private void initializeControlPanel() { + mControlPanel = (ControlPanel) findViewById(R.id.control_panel); + if (mControlPanel == null) return; + loadCameraPreferences(); + String[] keys = new String[]{CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE, CameraSettings.KEY_WHITE_BALANCE, CameraSettings.KEY_COLOR_EFFECT, CameraSettings.KEY_VIDEO_QUALITY}; - mControlPanel = (ControlPanel) findViewById(R.id.control_panel); - if (mControlPanel != null) { - mControlPanel.initialize(this, mPreferenceGroup, keys, false); - mControlPanel.setListener(new MyControlPanelListener()); - mPopupGestureDetector = new GestureDetector(this, - new PopupGestureListener()); - } + mControlPanel.initialize(this, mPreferenceGroup, keys, false); + mControlPanel.setListener(new MyControlPanelListener()); + mPopupGestureDetector = new GestureDetector(this, + new PopupGestureListener()); } public static int roundOrientation(int orientation) { |