diff options
author | Lars Greiss <kufikugel@googlemail.com> | 2013-12-29 12:23:33 +0100 |
---|---|---|
committer | Michael Bestas <mikeioannina@gmail.com> | 2015-09-17 23:26:03 +0300 |
commit | e453b7728763c1e20718060e0b5cf78fd342595f (patch) | |
tree | faf6d6ba5c5fe11b8f0cf68d52854b284085d0c8 /src | |
parent | 7d9c22ca00a78614afbd79e3785bab7e39ce02c4 (diff) | |
download | android_packages_apps_Snap-e453b7728763c1e20718060e0b5cf78fd342595f.tar.gz android_packages_apps_Snap-e453b7728763c1e20718060e0b5cf78fd342595f.tar.bz2 android_packages_apps_Snap-e453b7728763c1e20718060e0b5cf78fd342595f.zip |
Camera: remove fine/normal/superfine jpegquality and use always int
We use now a set of int values the user can exactly assign. Showing as
well the normal fine superfine as choice is just a duplicate. As well
we can get rid of the weird converts of the mixed values.
To take care that the user does not get into problems we updated the db
version and we make a convertion.
Change-Id: I2615666bc1c929c0c045840fad1ece55fb0640af
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/CameraSettings.java | 19 | ||||
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 50 |
2 files changed, 22 insertions, 47 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index 7db9fec80..3eab068c3 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java @@ -242,7 +242,7 @@ public class CameraSettings { public static final String VALUE_ON = "on"; public static final String VALUE_OFF = "off"; - public static final int CURRENT_VERSION = 5; + public static final int CURRENT_VERSION = 6; public static final int CURRENT_LOCAL_VERSION = 2; private static final String TAG = "CameraSettings"; @@ -1049,6 +1049,23 @@ public class CameraSettings { // Just use video quality to replace it and // ignore the current settings. editor.remove("pref_camera_videoquality_key"); + version = 4; + } + if (version == 4) { + // Just upgrade to version 5 directly + version = 5; + } + if (version == 5) { + // Change jpeg quality {normal,fine,superfine} back to {65,75,85} + String quality = pref.getString(KEY_JPEG_QUALITY, "superfine"); + if (quality.equals("normal")) { + quality = "65"; + } else if (quality.equals("fine")) { + quality = "75"; + } else { + quality = context.getString(R.string.pref_camera_jpegquality_default); + } + editor.putString(KEY_JPEG_QUALITY, quality); } editor.putInt(KEY_VERSION, CURRENT_VERSION); diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index c8cd0a0da..399f784b6 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -2862,12 +2862,11 @@ public class PhotoModule Size pic_size = mParameters.getPictureSize(); if (pic_size == null) { Log.e(TAG, "error getPictureSize: size is null"); - } - else{ - if("100".equals(jpegQuality) && (pic_size.width >= 3200)){ + } else { + if ("100".equals(jpegQuality) && (pic_size.width >= 3200)) { //mUnsupportedJpegQuality = true; - }else { - mParameters.setJpegQuality(JpegEncodingQualityMappings.getQualityNumber(jpegQuality)); + } else { + mParameters.setJpegQuality(Integer.parseInt(jpegQuality)); int jpegFileSize = estimateJpegFileSize(pic_size, jpegQuality); if (jpegFileSize != mJpegFileSizeEstimation) { mJpegFileSizeEstimation = jpegFileSize; @@ -3534,11 +3533,6 @@ public class PhotoModule } } - // Set JPEG quality. - int jpegQuality = CameraProfile.getJpegEncodingQualityParameter(mCameraId, - CameraProfile.QUALITY_HIGH); - mParameters.setJpegQuality(jpegQuality); - // For the following settings, we need to check if the settings are // still supported by latest driver, if not, ignore the settings. @@ -4508,42 +4502,6 @@ public class PhotoModule } } -/* Below is no longer needed, except to get rid of compile error - * TODO: Remove these - */ -class JpegEncodingQualityMappings { - private static final String TAG = "JpegEncodingQualityMappings"; - private static final int DEFAULT_QUALITY = 85; - private static HashMap<String, Integer> mHashMap = - new HashMap<String, Integer>(); - - static { - mHashMap.put("normal", CameraProfile.QUALITY_LOW); - mHashMap.put("fine", CameraProfile.QUALITY_MEDIUM); - mHashMap.put("superfine", CameraProfile.QUALITY_HIGH); - } - - // Retrieve and return the Jpeg encoding quality number - // for the given quality level. - public static int getQualityNumber(String jpegQuality) { - try{ - int qualityPercentile = Integer.parseInt(jpegQuality); - if(qualityPercentile >= 0 && qualityPercentile <=100) - return qualityPercentile; - else - return DEFAULT_QUALITY; - } catch(NumberFormatException nfe){ - //chosen quality is not a number, continue - } - Integer quality = mHashMap.get(jpegQuality); - if (quality == null) { - Log.w(TAG, "Unknown Jpeg quality: " + jpegQuality); - return DEFAULT_QUALITY; - } - return CameraProfile.getJpegEncodingQualityParameter(quality.intValue()); - } -} - class GraphView extends View { private Bitmap mBitmap; private Paint mPaint = new Paint(); |