diff options
author | Wu-cheng Li <> | 2009-04-13 07:02:51 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-04-13 07:02:51 -0700 |
commit | e0770004600f76cc4b440104e98e14712b4fd1c6 (patch) | |
tree | 69fd3dac6afd6a639a8341761418c5f83a9a7722 /src/com/android/camera | |
parent | 73b7a3a18a2e4ab0302c60a486f244acebe64883 (diff) | |
download | packages_apps_LegacyCamera-e0770004600f76cc4b440104e98e14712b4fd1c6.zip packages_apps_LegacyCamera-e0770004600f76cc4b440104e98e14712b4fd1c6.tar.gz packages_apps_LegacyCamera-e0770004600f76cc4b440104e98e14712b4fd1c6.tar.bz2 |
AI 145839: Add UI for JPEG quality setting.
BUG=1761244
Automated import of CL 145839
Diffstat (limited to 'src/com/android/camera')
-rw-r--r-- | src/com/android/camera/Camera.java | 68 | ||||
-rw-r--r-- | src/com/android/camera/CameraSettings.java | 10 |
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(); } } } |