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 | |
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
-rw-r--r-- | res/values/qcomarrays.xml | 9 | ||||
-rw-r--r-- | res/values/qcomstrings.xml | 5 | ||||
-rw-r--r-- | src/com/android/camera/CameraSettings.java | 19 | ||||
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 50 |
4 files changed, 23 insertions, 60 deletions
diff --git a/res/values/qcomarrays.xml b/res/values/qcomarrays.xml index a746ba172..4e2e4532f 100644 --- a/res/values/qcomarrays.xml +++ b/res/values/qcomarrays.xml @@ -186,9 +186,6 @@ <item>@string/pref_camera_jpegquality_entry_3</item> <item>@string/pref_camera_jpegquality_entry_4</item> <item>@string/pref_camera_jpegquality_entry_5</item> - <item>@string/pref_camera_jpegquality_entry_superfine</item> - <item>@string/pref_camera_jpegquality_entry_fine</item> - <item>@string/pref_camera_jpegquality_entry_normal</item> </string-array> <string-array name="pref_camera_jpegquality_entryvalues" translatable="false"> @@ -198,9 +195,6 @@ <item>85</item> <item>95</item> <item>100</item> - <item>superfine</item> - <item>fine</item> - <item>normal</item> </string-array> <!-- Rough estimates of jpeg compression ratio corresponding to qualities defined above. --> @@ -211,9 +205,6 @@ <item>20</item> <item>11</item> <item>6</item> - <item>20</item> - <item>31</item> - <item>38</item> </integer-array> <!-- Camera Preferences Color effect dialog box entries --> diff --git a/res/values/qcomstrings.xml b/res/values/qcomstrings.xml index c7fff0fbd..135ab48d5 100644 --- a/res/values/qcomstrings.xml +++ b/res/values/qcomstrings.xml @@ -545,7 +545,7 @@ <!-- Default picture quality setting. See pref_camera_jpegquality_entryvalues for possible values --> - <string name="pref_camera_jpegquality_default" translatable="false">superfine</string> + <string name="pref_camera_jpegquality_default" translatable="false">85</string> <!-- Default Picture format setting. Do not translate. --> <string name="pref_camera_picture_format_default">jpeg</string> @@ -702,9 +702,6 @@ <string name="pref_camera_jpegquality_title">Picture quality</string> <!-- Settings screen, Picture quality dialog radio button choices --> - <string name="pref_camera_jpegquality_entry_superfine">Super fine</string> - <string name="pref_camera_jpegquality_entry_fine">Fine</string> - <string name="pref_camera_jpegquality_entry_normal">Normal</string> <string name="pref_camera_jpegquality_entry_0">Jpeg 55%</string> <string name="pref_camera_jpegquality_entry_1">Jpeg 65%</string> <string name="pref_camera_jpegquality_entry_2">Jpeg 75%</string> 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(); |