summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-12-10 20:41:16 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-12-10 20:41:16 -0800
commitb65537df206fd69317109ab8147440b0ba9f9c25 (patch)
treea7af10f395df64edeeef33e176206b035cbdc061 /src
parent0556720cbf19442a9a64d6296f2b69e8afc0d6fc (diff)
parentda3e9964a4a82a942d7f450e7c89904f5c5aa03f (diff)
downloadLegacyCamera-b65537df206fd69317109ab8147440b0ba9f9c25.zip
LegacyCamera-b65537df206fd69317109ab8147440b0ba9f9c25.tar.gz
LegacyCamera-b65537df206fd69317109ab8147440b0ba9f9c25.tar.bz2
Merge change Ida3e9964 into eclair-mr2
* changes: Add flash light setting in video camera.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/CameraSettings.java1
-rw-r--r--src/com/android/camera/VideoCamera.java27
2 files changed, 28 insertions, 0 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index 9f4e954..d8a0e91 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -51,6 +51,7 @@ public class CameraSettings {
public static final String KEY_JPEG_QUALITY = "pref_camera_jpegquality_key";
public static final String KEY_FOCUS_MODE = "pref_camera_focusmode_key";
public static final String KEY_FLASH_MODE = "pref_camera_flashmode_key";
+ public static final String KEY_VIDEOCAMERA_FLASH_MODE = "pref_camera_video_flashmode_key";
public static final String KEY_COLOR_EFFECT = "pref_camera_coloreffect_key";
public static final String KEY_WHITE_BALANCE =
"pref_camera_whitebalance_key";
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 315600e..bc7bca1 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -74,6 +74,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
+import java.util.List;
/**
* The Camcorder activity.
@@ -138,6 +139,7 @@ public class VideoCamera extends NoSearchActivity
private Uri mCurrentVideoUri;
private ContentValues mCurrentVideoValues;
private IconIndicator mWhitebalanceIndicator;
+ private IconIndicator mFlashIndicator;
private MediaRecorderProfile mProfile;
@@ -322,6 +324,7 @@ public class VideoCamera extends NoSearchActivity
mWhitebalanceIndicator =
(IconIndicator) findViewById(R.id.whitebalance_icon);
+ mFlashIndicator = (IconIndicator) findViewById(R.id.flash_icon);
// Make sure preview is started.
try {
@@ -340,6 +343,9 @@ public class VideoCamera extends NoSearchActivity
if (mParameters.getSupportedWhiteBalance() == null) {
mWhitebalanceIndicator.setVisibility(View.GONE);
}
+ if (mParameters.getSupportedFlashModes() == null) {
+ mFlashIndicator.setVisibility(View.GONE);
+ }
}
@Override
@@ -1379,12 +1385,31 @@ public class VideoCamera extends NoSearchActivity
UPDATE_RECORD_TIME, next_update_delay);
}
+ private static boolean isSupported(String value, List<String> supported) {
+ return supported == null ? false : supported.indexOf(value) >= 0;
+ }
+
private void setCameraParameters() {
mParameters = mCameraDevice.getParameters();
mParameters.setPreviewSize(mProfile.mVideoWidth, mProfile.mVideoHeight);
mParameters.setPreviewFrameRate(mProfile.mVideoFps);
+ // Set flash mode.
+ String flashMode = mPreferences.getString(
+ CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE,
+ getString(R.string.pref_camera_video_flashmode_default));
+ List<String> supportedFlash = mParameters.getSupportedFlashModes();
+ if (isSupported(flashMode, supportedFlash)) {
+ mParameters.setFlashMode(flashMode);
+ } else {
+ flashMode = mParameters.getFlashMode();
+ if (flashMode == null) {
+ flashMode = getString(
+ R.string.pref_camera_flashmode_no_flash);
+ }
+ }
+
// Set white balance parameter.
String whiteBalance = Parameters.WHITE_BALANCE_AUTO;
if (mParameters.getSupportedWhiteBalance() != null) {
@@ -1405,12 +1430,14 @@ public class VideoCamera extends NoSearchActivity
mCameraDevice.setParameters(mParameters);
final String finalWhiteBalance = whiteBalance;
+ final String finalFlashMode = flashMode;
// It can be execute from the startPreview thread, so we post it
// to the main UI thread
mHandler.post(new Runnable() {
public void run() {
mWhitebalanceIndicator.setMode(finalWhiteBalance);
+ mFlashIndicator.setMode(finalFlashMode);
}
});
}