summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChung-yih Wang <cywang@google.com>2010-12-06 11:25:24 +0800
committerChung-yih Wang <cywang@google.com>2010-12-06 15:04:41 +0800
commit9e76e8d6eec20739203d213ead1fe1aab3b939ae (patch)
treeebf6aef43fbb6f31e3644659c3f1e821cacde183 /src
parentfa15ed300e2a487c2e305994a75fd8f162dc3be8 (diff)
downloadLegacyCamera-9e76e8d6eec20739203d213ead1fe1aab3b939ae.zip
LegacyCamera-9e76e8d6eec20739203d213ead1fe1aab3b939ae.tar.gz
LegacyCamera-9e76e8d6eec20739203d213ead1fe1aab3b939ae.tar.bz2
Move camera picker to control panel.
Change-Id: I5b2b0693bb3ef8e353b4b9c793583ed3e6522526
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/Camera.java1
-rw-r--r--src/com/android/camera/VideoCamera.java3
-rw-r--r--src/com/android/camera/ui/CameraPicker.java30
3 files changed, 12 insertions, 22 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 10e9b5d..390cad6 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -550,6 +550,7 @@ public class Camera extends NoSearchActivity 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) {
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index a7cd97d..ea5156a 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -421,6 +421,7 @@ public class VideoCamera extends NoSearchActivity
private void initializeCameraPicker() {
mCameraPicker = (CameraPicker) findViewById(R.id.camera_picker);
if (mCameraPicker != null) {
+ mCameraPicker.setImageResource(R.drawable.camera_toggle_video);
ListPreference pref = mPreferenceGroup.findPreference(
CameraSettings.KEY_CAMERA_ID);
if (pref != null) {
@@ -1419,6 +1420,7 @@ public class VideoCamera extends NoSearchActivity
updateRecordingIndicator(false);
mRecordingTimeView.setText("");
mRecordingTimeView.setVisibility(View.VISIBLE);
+ mCameraPicker.setVisibility(View.GONE);
if (mTimeLapseRecordingTimeView != null) {
mTimeLapseRecordingTimeView.setText("");
mTimeLapseRecordingTimeView.setVisibility(View.VISIBLE);
@@ -1529,6 +1531,7 @@ public class VideoCamera extends NoSearchActivity
enableCameraControls(true);
updateRecordingIndicator(true);
mRecordingTimeView.setVisibility(View.GONE);
+ mCameraPicker.setVisibility(View.VISIBLE);
if (mTimeLapseRecordingTimeView != null) {
mTimeLapseRecordingTimeView.setVisibility(View.GONE);
}
diff --git a/src/com/android/camera/ui/CameraPicker.java b/src/com/android/camera/ui/CameraPicker.java
index e2a3441..dd00c13 100644
--- a/src/com/android/camera/ui/CameraPicker.java
+++ b/src/com/android/camera/ui/CameraPicker.java
@@ -23,15 +23,12 @@ import android.content.Context;
import android.hardware.Camera.CameraInfo;
import android.util.AttributeSet;
import android.view.View;
-import android.widget.RadioButton;
-import android.widget.RadioGroup;
+import android.widget.ImageView;
/**
* A view for switching the front/back camera.
*/
-public class CameraPicker extends RadioGroup implements View.OnClickListener {
- private RadioButton mFrontCamera;
- private RadioButton mBackCamera;
+public class CameraPicker extends ImageView implements View.OnClickListener {
private Listener mListener;
private ListPreference mPreference;
private CharSequence[] mCameras;
@@ -53,35 +50,24 @@ public class CameraPicker extends RadioGroup implements View.OnClickListener {
mPreference = pref;
mCameras = pref.getEntryValues();
if (mCameras == null) return;
+ setOnClickListener(this);
String cameraId = pref.getValue();
setVisibility(View.VISIBLE);
if (mCameras[CameraInfo.CAMERA_FACING_FRONT].equals(cameraId)) {
- mFrontCamera.setChecked(true);
mCameraIndex = CameraInfo.CAMERA_FACING_FRONT;
} else {
- mBackCamera.setChecked(true);
mCameraIndex = CameraInfo.CAMERA_FACING_BACK;
}
}
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mFrontCamera = (RadioButton) findViewById(R.id.camera_switch_to_front);
- mFrontCamera.setOnClickListener(this);
- mBackCamera = (RadioButton) findViewById(R.id.camera_switch_to_back);
- mBackCamera.setOnClickListener(this);
- }
-
public void onClick(View v) {
- int newCameraIndex = (v == mFrontCamera)
+ if (mCameras == null) return;
+ int newCameraIndex = (mCameraIndex == CameraInfo.CAMERA_FACING_BACK)
? CameraInfo.CAMERA_FACING_FRONT
: CameraInfo.CAMERA_FACING_BACK;
- if (mCameraIndex != newCameraIndex) {
- mCameraIndex = newCameraIndex;
- mPreference.setValue((String) mCameras[mCameraIndex]);
- mListener.onSharedPreferenceChanged();
- }
+ mCameraIndex = newCameraIndex;
+ mPreference.setValue((String) mCameras[mCameraIndex]);
+ mListener.onSharedPreferenceChanged();
}
}