summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2012-07-03 18:55:25 +0800
committerHung-ying Tyan <tyanh@google.com>2012-07-03 18:59:29 +0800
commit36d9adcad2a0e74c796737d6521ac2d29afe944c (patch)
tree71e5203c45f4fe2f675637792df4bb2ec11ff2d0
parent7aac26484af3d40df81e1d08c673bd925856a7fa (diff)
downloadandroid_packages_apps_Snap-36d9adcad2a0e74c796737d6521ac2d29afe944c.tar.gz
android_packages_apps_Snap-36d9adcad2a0e74c796737d6521ac2d29afe944c.tar.bz2
android_packages_apps_Snap-36d9adcad2a0e74c796737d6521ac2d29afe944c.zip
Add ExifTags to hold tag names that are not available in ExifInterface
prior to API level 11. Bug: 6775786 Change-Id: Iab564f577d9a0b87c8fb7b91eda6cabc12b5a11a
-rw-r--r--gallerycommon/src/com/android/gallery3d/common/ExifTags.java27
-rw-r--r--src/com/android/gallery3d/app/CropImage.java13
-rw-r--r--src/com/android/gallery3d/data/MediaDetails.java7
3 files changed, 38 insertions, 9 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/ExifTags.java b/gallerycommon/src/com/android/gallery3d/common/ExifTags.java
new file mode 100644
index 000000000..9b11fe416
--- /dev/null
+++ b/gallerycommon/src/com/android/gallery3d/common/ExifTags.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gallery3d.common;
+
+/**
+ * The class holds the EXIF tag names that are not available in
+ * {@link android.media.ExifInterface} prior to API level 11.
+ */
+public interface ExifTags {
+ static final String TAG_ISO = "ISOSpeedRatings";
+ static final String TAG_EXPOSURE_TIME = "ExposureTime";
+ static final String TAG_APERTURE = "FNumber";
+}
diff --git a/src/com/android/gallery3d/app/CropImage.java b/src/com/android/gallery3d/app/CropImage.java
index 294e285ea..a587624ed 100644
--- a/src/com/android/gallery3d/app/CropImage.java
+++ b/src/com/android/gallery3d/app/CropImage.java
@@ -49,6 +49,7 @@ import android.widget.Toast;
import com.android.gallery3d.R;
import com.android.gallery3d.common.ApiHelper;
import com.android.gallery3d.common.BitmapUtils;
+import com.android.gallery3d.common.ExifTags;
import com.android.gallery3d.common.Utils;
import com.android.gallery3d.data.DataManager;
import com.android.gallery3d.data.LocalImage;
@@ -989,11 +990,11 @@ public class CropImage extends AbstractGalleryActivity {
}
// Handle some special values here
- String value = oldExif.getAttribute(ExifInterface.TAG_APERTURE);
+ String value = oldExif.getAttribute(ExifTags.TAG_APERTURE);
if (value != null) {
try {
float aperture = Float.parseFloat(value);
- newExif.setAttribute(ExifInterface.TAG_APERTURE,
+ newExif.setAttribute(ExifTags.TAG_APERTURE,
String.valueOf((int) (aperture * 10 + 0.5f)) + "/10");
} catch (NumberFormatException e) {
Log.w(TAG, "cannot parse aperture: " + value);
@@ -1002,22 +1003,22 @@ public class CropImage extends AbstractGalleryActivity {
// TODO: The code is broken, need to fix the JHEAD lib
/*
- value = oldExif.getAttribute(ExifInterface.TAG_EXPOSURE_TIME);
+ value = oldExif.getAttribute(ExifTags.TAG_EXPOSURE_TIME);
if (value != null) {
try {
double exposure = Double.parseDouble(value);
testToRational("test exposure", exposure);
- newExif.setAttribute(ExifInterface.TAG_EXPOSURE_TIME, value);
+ newExif.setAttribute(ExifTags.TAG_EXPOSURE_TIME, value);
} catch (NumberFormatException e) {
Log.w(TAG, "cannot parse exposure time: " + value);
}
}
- value = oldExif.getAttribute(ExifInterface.TAG_ISO);
+ value = oldExif.getAttribute(ExifTags.TAG_ISO);
if (value != null) {
try {
int iso = Integer.parseInt(value);
- newExif.setAttribute(ExifInterface.TAG_ISO, String.valueOf(iso) + "/1");
+ newExif.setAttribute(ExifTags.TAG_ISO, String.valueOf(iso) + "/1");
} catch (NumberFormatException e) {
Log.w(TAG, "cannot parse exposure time: " + value);
}
diff --git a/src/com/android/gallery3d/data/MediaDetails.java b/src/com/android/gallery3d/data/MediaDetails.java
index 9663dd0e6..c18365df0 100644
--- a/src/com/android/gallery3d/data/MediaDetails.java
+++ b/src/com/android/gallery3d/data/MediaDetails.java
@@ -19,6 +19,7 @@ package com.android.gallery3d.data;
import android.media.ExifInterface;
import com.android.gallery3d.R;
+import com.android.gallery3d.common.ExifTags;
import java.io.IOException;
import java.util.HashMap;
@@ -126,11 +127,11 @@ public class MediaDetails implements Iterable<Entry<Integer, Object>> {
MediaDetails.INDEX_HEIGHT);
setExifData(details, exif, ExifInterface.TAG_MAKE, MediaDetails.INDEX_MAKE);
setExifData(details, exif, ExifInterface.TAG_MODEL, MediaDetails.INDEX_MODEL);
- setExifData(details, exif, ExifInterface.TAG_APERTURE, MediaDetails.INDEX_APERTURE);
- setExifData(details, exif, ExifInterface.TAG_ISO, MediaDetails.INDEX_ISO);
+ setExifData(details, exif, ExifTags.TAG_APERTURE, MediaDetails.INDEX_APERTURE);
+ setExifData(details, exif, ExifTags.TAG_ISO, MediaDetails.INDEX_ISO);
setExifData(details, exif, ExifInterface.TAG_WHITE_BALANCE,
MediaDetails.INDEX_WHITE_BALANCE);
- setExifData(details, exif, ExifInterface.TAG_EXPOSURE_TIME,
+ setExifData(details, exif, ExifTags.TAG_EXPOSURE_TIME,
MediaDetails.INDEX_EXPOSURE_TIME);
double data = exif.getAttributeDouble(ExifInterface.TAG_FOCAL_LENGTH, 0);