summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCheng-Ru Lin <owenlin@google.com>2009-10-04 15:19:52 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2009-10-04 15:19:52 -0700
commitb0a7d570c1586690f5c33379c5a3172c0080ec58 (patch)
tree4c21234ebbc5932d86e2a2af7e0469b3a60019ae /src
parent59063f75c4ed9947306fd2a89bffba6923282dd7 (diff)
parent7ee55b673e2dc579bd3e904240f71a24402dae1f (diff)
downloadpackages_apps_LegacyCamera-b0a7d570c1586690f5c33379c5a3172c0080ec58.zip
packages_apps_LegacyCamera-b0a7d570c1586690f5c33379c5a3172c0080ec58.tar.gz
packages_apps_LegacyCamera-b0a7d570c1586690f5c33379c5a3172c0080ec58.tar.bz2
am 7ee55b67: Merge change I8f184b8a into eclair
Merge commit '7ee55b673e2dc579bd3e904240f71a24402dae1f' into eclair-mr2 * commit '7ee55b673e2dc579bd3e904240f71a24402dae1f': Fix the issue that focus options shown on those device without focus support.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/Camera.java30
-rw-r--r--src/com/android/camera/CameraSettings.java15
2 files changed, 17 insertions, 28 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index b6a7ac5..777a0b4 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -113,6 +113,7 @@ public class Camera extends Activity implements View.OnClickListener,
public static final String ZOOM_SPEED = "99";
private Parameters mParameters;
+ private Parameters mInitialParameters;
// The non-standard parameter strings to communicate with camera driver.
// This will be removed in the future.
@@ -973,27 +974,20 @@ public class Camera extends Activity implements View.OnClickListener,
updateStorageHint(mPicturesRemaining);
}
- private boolean mScreenComplete = false;
private void showOnScreenSettings() {
if (mSettings == null) {
mSettings = new OnScreenSettings(
findViewById(R.id.camera_preview));
- CameraSettings helper = new CameraSettings(this, mParameters);
+ CameraSettings helper =
+ new CameraSettings(this, mInitialParameters);
mSettings.setPreferenceScreen(helper
.getPreferenceScreen(R.xml.camera_preferences));
mSettings.setOnVisibilityChangedListener(this);
- // If the current screne mode is not auto, then the supported
- // options is not complete, we need to read it again later.
- // For example: in the scene mode "ACTION", the supported focus mode
- // will change from {infinite, macro, auto} to {infinite}.
String sceneMode = mParameters.getSceneMode();
- boolean autoSceneMode = sceneMode == null
- || Parameters.SCENE_MODE_AUTO.equals(sceneMode);
- mScreenComplete = autoSceneMode;
-
- if (autoSceneMode) {
+ if (sceneMode == null
+ || Parameters.SCENE_MODE_AUTO.equals(sceneMode)) {
// If scene mode is auto, cancel override in settings
mSettings.overrideSettings(CameraSettings.KEY_FLASH_MODE, null);
mSettings.overrideSettings(CameraSettings.KEY_FOCUS_MODE, null);
@@ -1516,6 +1510,7 @@ public class Camera extends Activity implements View.OnClickListener,
private void ensureCameraDevice() throws CameraHardwareException {
if (mCameraDevice == null) {
mCameraDevice = CameraHolder.instance().open();
+ mInitialParameters = mCameraDevice.getParameters();
}
}
@@ -1802,19 +1797,6 @@ public class Camera extends Activity implements View.OnClickListener,
}
mCameraDevice.setParameters(mParameters);
-
- // The complete preference has not been read, read it now
- if (!mScreenComplete && mSettings != null) {
- // The current scene mode is auto and thus the supported values
- // of the three settings (flash mode, white balance, and focus
- // mode) are complete now. If we didn't have the complete
- // preference screen, read it now.
- mScreenComplete = true;
- mParameters = mCameraDevice.getParameters();
- CameraSettings helper = new CameraSettings(this, mParameters);
- mSettings.setPreferenceScreen(helper
- .getPreferenceScreen(R.xml.camera_preferences));
- }
}
// We post the runner because this function can be called from
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index e4737be..2cdce3a 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -126,6 +126,8 @@ public class CameraSettings {
(ListPreference) screen.findPreference(KEY_SCENE_MODE);
ListPreference flashMode =
(ListPreference) screen.findPreference(KEY_FLASH_MODE);
+ ListPreference focusMode =
+ (ListPreference) screen.findPreference(KEY_FOCUS_MODE);
// Since the screen could be loaded from different resources, we need
// to check if the preference is available here
@@ -159,6 +161,10 @@ public class CameraSettings {
filterUnsupportedOptions(screen,
flashMode, mParameters.getSupportedFlashModes());
}
+ if (focusMode != null) {
+ filterUnsupportedOptions(screen,
+ focusMode, mParameters.getSupportedFocusModes());
+ }
}
private static boolean removePreference(PreferenceGroup group,
@@ -179,14 +185,15 @@ public class CameraSettings {
private void filterUnsupportedOptions(PreferenceScreen screen,
ListPreference pref, List<String> supported) {
- // Remove the preference if the parameter is not supported.
- if (supported == null) {
+ CharSequence[] allEntries = pref.getEntries();
+
+ // Remove the preference if the parameter is not supported or there is
+ // only one options for the settings.
+ if (supported == null || allEntries.length <= 1) {
removePreference(screen, pref);
return;
}
- // Prepare setting entries and entry values.
- CharSequence[] allEntries = pref.getEntries();
CharSequence[] allEntryValues = pref.getEntryValues();
Drawable[] allIcons = (pref instanceof IconListPreference)
? ((IconListPreference) pref).getIcons()