diff options
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/camera/Camera.java | 3 | ||||
-rw-r--r-- | src/com/android/camera/CameraSettings.java | 13 | ||||
-rwxr-xr-x | src/com/android/camera/VideoCamera.java | 3 | ||||
-rw-r--r-- | src/com/android/camera/ui/CameraPicker.java | 16 |
4 files changed, 9 insertions, 26 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 8c74d24..2ca7944 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -2175,8 +2175,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener, .setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { CameraSettings.writePreferredCameraId(mPreferences, - ((mCameraId == mFrontCameraId) - ? mBackCameraId : mFrontCameraId)); + (mCameraId + 1) % mNumberOfCameras); onSharedPreferenceChanged(); return true; } diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index c861366..2d33b69 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java @@ -225,16 +225,9 @@ public class CameraSettings { return; } - CharSequence[] entryValues = new CharSequence[2]; - for (int i = 0; i < mCameraInfo.length; ++i) { - int index = - (mCameraInfo[i].facing == CameraInfo.CAMERA_FACING_FRONT) - ? CameraInfo.CAMERA_FACING_FRONT - : CameraInfo.CAMERA_FACING_BACK; - if (entryValues[index] == null) { - entryValues[index] = "" + i; - if (entryValues[((index == 1) ? 0 : 1)] != null) break; - } + CharSequence[] entryValues = new CharSequence[numOfCameras]; + for (int i = 0; i < numOfCameras; ++i) { + entryValues[i] = "" + i; } preference.setEntryValues(entryValues); } diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index e93fbca..b2626ed 100755 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -1481,8 +1481,7 @@ public class VideoCamera extends ActivityBase .setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { CameraSettings.writePreferredCameraId(mPreferences, - ((mCameraId == mFrontCameraId) - ? mBackCameraId : mFrontCameraId)); + (mCameraId + 1) % mNumberOfCameras); onSharedPreferenceChanged(); return true; } diff --git a/src/com/android/camera/ui/CameraPicker.java b/src/com/android/camera/ui/CameraPicker.java index ac8b8a8..21d3efe 100644 --- a/src/com/android/camera/ui/CameraPicker.java +++ b/src/com/android/camera/ui/CameraPicker.java @@ -33,7 +33,6 @@ public class CameraPicker extends RotateImageView implements View.OnClickListene private OnPreferenceChangedListener mListener; private ListPreference mPreference; private CharSequence[] mCameras; - private int mCameraFacing; public CameraPicker(Context context) { super(context); @@ -55,23 +54,16 @@ public class CameraPicker extends RotateImageView implements View.OnClickListene mCameras = pref.getEntryValues(); if (mCameras == null) return; setOnClickListener(this); - String cameraId = pref.getValue(); setVisibility(View.VISIBLE); - if (mCameras[CameraInfo.CAMERA_FACING_FRONT].equals(cameraId)) { - mCameraFacing = CameraInfo.CAMERA_FACING_FRONT; - } else { - mCameraFacing = CameraInfo.CAMERA_FACING_BACK; - } } @Override public void onClick(View v) { if (mCameras == null) return; - int newCameraIndex = (mCameraFacing == CameraInfo.CAMERA_FACING_BACK) - ? CameraInfo.CAMERA_FACING_FRONT - : CameraInfo.CAMERA_FACING_BACK; - mCameraFacing = newCameraIndex; - mPreference.setValue((String) mCameras[mCameraFacing]); + int index = mPreference.findIndexOfValue(mPreference.getValue()); + CharSequence[] values = mPreference.getEntryValues(); + index = (index + 1) % values.length; + mPreference.setValue((String) mCameras[index]); mListener.onSharedPreferenceChanged(); } } |