summaryrefslogtreecommitdiffstats
path: root/gallerycommon/src/com
diff options
context:
space:
mode:
authorEarl Ou <shunhsingou@google.com>2012-12-07 15:58:19 +0800
committerEarl Ou <shunhsingou@google.com>2012-12-19 21:25:48 +0800
commit05a551fa030f0c40c0f522ecbe6f8663a04c02ee (patch)
treef055597eee1bbbc39bc54d267fb7089563fef682 /gallerycommon/src/com
parent6905fe1e9a08f8f18aa0919265d782c5ee83b2c6 (diff)
downloadandroid_packages_apps_Snap-05a551fa030f0c40c0f522ecbe6f8663a04c02ee.zip
android_packages_apps_Snap-05a551fa030f0c40c0f522ecbe6f8663a04c02ee.tar.gz
android_packages_apps_Snap-05a551fa030f0c40c0f522ecbe6f8663a04c02ee.tar.bz2
Replace original tags when add tags in ExifTag
Change-Id: I80d1507467dcde8c8b157a120cfe9a5f5c664d0f
Diffstat (limited to 'gallerycommon/src/com')
-rw-r--r--gallerycommon/src/com/android/gallery3d/exif/ExifData.java32
1 files changed, 12 insertions, 20 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/exif/ExifData.java b/gallerycommon/src/com/android/gallery3d/exif/ExifData.java
index b226dd4..88593e6 100644
--- a/gallerycommon/src/com/android/gallery3d/exif/ExifData.java
+++ b/gallerycommon/src/com/android/gallery3d/exif/ExifData.java
@@ -270,7 +270,7 @@ public class ExifData {
/**
* Adds a tag with the given tag ID. If the tag of the given ID already exists,
- * the original tag will be returned. Otherwise, a new ExifTag will be created. For tags
+ * the original tag will be replaced. For tags
* related to interoperability or thumbnail, call {@link #addInteroperabilityTag(short)} or
* {@link #addThumbnailTag(short)} respectively.
* @exception IllegalArgumentException if the tag ID is invalid.
@@ -278,11 +278,8 @@ public class ExifData {
public ExifTag addTag(short tagId) {
int ifdId = ExifTag.getIfdIdFromTagId(tagId);
IfdData ifdData = getOrCreateIfdData(ifdId);
- ExifTag tag = ifdData.getTag(tagId);
- if (tag == null) {
- tag = ExifTag.buildTag(tagId);
- ifdData.setTag(tag);
- }
+ ExifTag tag = ExifTag.buildTag(tagId);
+ ifdData.setTag(tag);
return tag;
}
@@ -296,36 +293,31 @@ public class ExifData {
/**
* Adds a thumbnail-related tag with the given tag ID. If the tag of the given ID
- * already exists, the original tag will be returned. Otherwise, a new ExifTag will
- * be created.
+ * already exists, the original tag will be replaced.
* @exception IllegalArgumentException if the tag ID is invalid.
*/
public ExifTag addThumbnailTag(short tagId) {
IfdData ifdData = getOrCreateIfdData(IfdId.TYPE_IFD_1);
- ExifTag tag = ifdData.getTag(tagId);
- if (tag == null) {
- tag = ExifTag.buildThumbnailTag(tagId);
- ifdData.setTag(tag);
- }
+ ExifTag tag = ExifTag.buildThumbnailTag(tagId);
+ ifdData.setTag(tag);
return tag;
}
/**
* Adds an interoperability-related tag with the given tag ID. If the tag of the given ID
- * already exists, the original tag will be returned. Otherwise, a new ExifTag will
- * be created.
+ * already exists, the original tag will be replaced.
* @exception IllegalArgumentException if the tag ID is invalid.
*/
public ExifTag addInteroperabilityTag(short tagId) {
IfdData ifdData = getOrCreateIfdData(IfdId.TYPE_IFD_INTEROPERABILITY);
- ExifTag tag = ifdData.getTag(tagId);
- if (tag == null) {
- tag = ExifTag.buildInteroperabilityTag(tagId);
- ifdData.setTag(tag);
- }
+ ExifTag tag = ExifTag.buildInteroperabilityTag(tagId);
+ ifdData.setTag(tag);
return tag;
}
+ /**
+ * Removes the thumbnail and its related tags. IFD1 will be removed.
+ */
public void removeThumbnailData() {
mThumbnail = null;
mStripBytes.clear();