summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/Camera.java
diff options
context:
space:
mode:
authorChung-yih Wang <cywang@google.com>2011-08-05 01:14:35 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-05 01:14:35 -0700
commit0980ef20897b2b83ee1ddce300044c121192f599 (patch)
treecd0396f2a3d76b94db114627742b66146bf31410 /src/com/android/camera/Camera.java
parent141cf9386c6053e655ef054f499230cfafba3ff6 (diff)
parentb5c569214281e11dc7e8ffc313fbb27e5ff6e5c5 (diff)
downloadLegacyCamera-0980ef20897b2b83ee1ddce300044c121192f599.zip
LegacyCamera-0980ef20897b2b83ee1ddce300044c121192f599.tar.gz
LegacyCamera-0980ef20897b2b83ee1ddce300044c121192f599.tar.bz2
Merge "Add the CameraPicker for PhoneUI."
Diffstat (limited to 'src/com/android/camera/Camera.java')
-rw-r--r--src/com/android/camera/Camera.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 151eecb..2090d30 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -16,6 +16,7 @@
package com.android.camera;
+import com.android.camera.ui.CameraPicker;
import com.android.camera.ui.FocusRectangle;
import com.android.camera.ui.IndicatorControl;
import com.android.camera.ui.RotateImageView;
@@ -176,6 +177,9 @@ public class Camera extends ActivityBase implements View.OnClickListener,
private View mGpsNoSignalView;
private View mGpsHasSignalView;
+ // front/back camera switch.
+ private CameraPicker mCameraPicker;
+
/**
* An unpublished intent flag requesting to return as soon as capturing
* is completed.
@@ -586,6 +590,19 @@ public class Camera extends ActivityBase implements View.OnClickListener,
}
};
+ private void initializeCameraPicker() {
+ mCameraPicker = (CameraPicker) findViewById(R.id.camera_picker);
+ if (mCameraPicker != null) {
+ mCameraPicker.setImageResource(R.drawable.camera_toggle);
+ ListPreference pref = mPreferenceGroup.findPreference(
+ CameraSettings.KEY_CAMERA_ID);
+ if (pref != null) {
+ mCameraPicker.initialize(pref);
+ mCameraPicker.setListener(new MyCameraPickerListener());
+ }
+ }
+ }
+
private void initializeZoomPicker() {
View zoomIncrement = findViewById(R.id.zoom_increment);
View zoomDecrement = findViewById(R.id.zoom_decrement);
@@ -1051,6 +1068,7 @@ public class Camera extends ActivityBase implements View.OnClickListener,
// parameters.
initializeIndicatorControl();
initializeZoomPicker();
+ initializeCameraPicker();
}
private void overrideCameraSettings(final String flashMode,
@@ -1100,7 +1118,6 @@ public class Camera extends ActivityBase implements View.OnClickListener,
} else {
SETTING_KEYS = new String[] {
CameraSettings.KEY_FLASH_MODE,
- CameraSettings.KEY_CAMERA_ID,
CameraSettings.KEY_COLOR_EFFECT,
CameraSettings.KEY_WHITE_BALANCE};
OTHER_SETTING_KEYS = new String[] {
@@ -1124,6 +1141,7 @@ public class Camera extends ActivityBase implements View.OnClickListener,
private void enableCameraControls(boolean enable) {
if (mIndicatorControl != null) mIndicatorControl.setEnabled(enable);
+ if (mCameraPicker != null) mCameraPicker.setEnabled(enable);
if (mZoomPicker != null) mZoomPicker.setEnabled(enable);
if (mModePicker != null) mModePicker.setEnabled(enable);
}
@@ -1162,6 +1180,7 @@ public class Camera extends ActivityBase implements View.OnClickListener,
if (mModePicker != null) mModePicker.setDegree(degree);
if (mSharePopup != null) mSharePopup.setOrientation(degree);
if (mIndicatorControl != null) mIndicatorControl.setDegree(degree);
+ if (mCameraPicker != null) mCameraPicker.setDegree(degree);
}
@Override
@@ -2367,4 +2386,10 @@ public class Camera extends ActivityBase implements View.OnClickListener,
Camera.this.onOverriddenPreferencesClicked();
}
}
+
+ private class MyCameraPickerListener implements CameraPicker.Listener {
+ public void onSharedPreferenceChanged() {
+ Camera.this.onSharedPreferenceChanged();
+ }
+ }
}