summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera')
-rw-r--r--src/com/android/camera/Camera.java68
-rw-r--r--src/com/android/camera/CameraSettings.java10
2 files changed, 45 insertions, 33 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 943943d..fee6410 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -583,13 +583,9 @@ public class Camera extends Activity implements View.OnClickListener,
final int latchedOrientation =
ImageManager.roundOrientation(mLastOrientation + 90);
+ mParameters.set(PARM_ROTATION, latchedOrientation);
Location loc = mRecordLocation ? getCurrentLocation() : null;
- // Quality 75 has visible artifacts, and quality 90 looks great but
- // the files begin to get large. 85 is a good compromise between
- // the two.
- mParameters.set(PARM_JPEG_QUALITY, 85);
- mParameters.set(PARM_ROTATION, latchedOrientation);
mParameters.remove(PARM_GPS_LATITUDE);
mParameters.remove(PARM_GPS_LONGITUDE);
@@ -1372,34 +1368,7 @@ public class Camera extends Activity implements View.OnClickListener,
return;
}
- // request the preview size, the hardware may not honor it,
- // if we depended on it we would have to query the size again
- mParameters = mCameraDevice.getParameters();
- mParameters.setPreviewSize(w, h);
-
- // Set white balance parameter.
- String whiteBalance = mPreferences.getString(
- CameraSettings.KEY_WHITE_BALANCE,
- getString(R.string.pref_camera_whitebalance_default));
- mParameters.set(PARM_WHITE_BALANCE, whiteBalance);
-
- // Set effect parameter.
- String effect = mPreferences.getString(
- CameraSettings.KEY_EFFECT,
- getString(R.string.pref_camera_effect_default));
- mParameters.set(PARM_EFFECT, effect);
-
- // Set picture size parameter.
- String pictureSize = mPreferences.getString(
- CameraSettings.KEY_PICTURE_SIZE,
- getString(R.string.pref_camera_picturesize_default));
- mParameters.set(PARM_PICTURE_SIZE, pictureSize);
-
- try {
- mCameraDevice.setParameters(mParameters);
- } catch (IllegalArgumentException e) {
- // Ignore this error, it happens in the simulator.
- }
+ setCameraParameter();
final long wallTimeStart = SystemClock.elapsedRealtime();
final long threadTimeStart = Debug.threadCpuTimeNanos();
@@ -1469,6 +1438,39 @@ public class Camera extends Activity implements View.OnClickListener,
}
}
+ private void setCameraParameter() {
+ // request the preview size, the hardware may not honor it,
+ // if we depended on it we would have to query the size again
+ mParameters = mCameraDevice.getParameters();
+ mParameters.setPreviewSize(mViewFinderWidth, mViewFinderHeight);
+
+ // Set white balance parameter.
+ String whiteBalance = mPreferences.getString(
+ CameraSettings.KEY_WHITE_BALANCE,
+ getString(R.string.pref_camera_whitebalance_default));
+ mParameters.set(PARM_WHITE_BALANCE, whiteBalance);
+
+ // Set effect parameter.
+ String effect = mPreferences.getString(
+ CameraSettings.KEY_EFFECT,
+ getString(R.string.pref_camera_effect_default));
+ mParameters.set(PARM_EFFECT, effect);
+
+ // Set picture size parameter.
+ String pictureSize = mPreferences.getString(
+ CameraSettings.KEY_PICTURE_SIZE,
+ getString(R.string.pref_camera_picturesize_default));
+ mParameters.set(PARM_PICTURE_SIZE, pictureSize);
+
+ // Set JPEG quality parameter.
+ String jpegQuality = mPreferences.getString(
+ CameraSettings.KEY_JPEG_QUALITY,
+ getString(R.string.pref_camera_jpegquality_default));
+ mParameters.set(PARM_JPEG_QUALITY, jpegQuality);
+
+ mCameraDevice.setParameters(mParameters);
+ }
+
private void stopPreview() {
if (mCameraDevice != null && mPreviewing) {
mCameraDevice.stopPreview();
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index 8d0075a..d790b9f 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -38,12 +38,14 @@ public class CameraSettings extends PreferenceActivity implements
"pref_camera_whitebalance_key";
public static final String KEY_EFFECT = "pref_camera_effect_key";
public static final String KEY_PICTURE_SIZE = "pref_camera_picturesize_key";
+ public static final String KEY_JPEG_QUALITY = "pref_camera_jpegquality_key";
public static final boolean DEFAULT_VIDEO_QUALITY_VALUE = true;
private ListPreference mVideoQuality;
private ListPreference mWhiteBalance;
private ListPreference mEffect;
private ListPreference mPictureSize;
+ private ListPreference mJpegQuality;
private Parameters mParameters;
@Override
@@ -62,6 +64,7 @@ public class CameraSettings extends PreferenceActivity implements
updateWhiteBalanceSummary();
updateEffectSummary();
updatePictureSizeSummary();
+ updateJpegQualitySummary();
}
private void initUI() {
@@ -69,6 +72,7 @@ public class CameraSettings extends PreferenceActivity implements
mWhiteBalance = (ListPreference) findPreference(KEY_WHITE_BALANCE);
mEffect = (ListPreference) findPreference(KEY_EFFECT);
mPictureSize = (ListPreference) findPreference(KEY_PICTURE_SIZE);
+ mJpegQuality = (ListPreference) findPreference(KEY_JPEG_QUALITY);
getPreferenceScreen().getSharedPreferences().
registerOnSharedPreferenceChangeListener(this);
@@ -153,6 +157,10 @@ public class CameraSettings extends PreferenceActivity implements
mPictureSize.setSummary(mPictureSize.getEntry());
}
+ private void updateJpegQualitySummary() {
+ mJpegQuality.setSummary(mJpegQuality.getEntry());
+ }
+
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
if (key.equals(KEY_VIDEO_QUALITY)) {
@@ -163,6 +171,8 @@ public class CameraSettings extends PreferenceActivity implements
updateEffectSummary();
} else if (key.equals(KEY_PICTURE_SIZE)) {
updatePictureSizeSummary();
+ } else if (key.equals(KEY_JPEG_QUALITY)) {
+ updateJpegQualitySummary();
}
}
}