diff options
author | Earl Ou <shunhsingou@google.com> | 2012-12-07 15:58:19 +0800 |
---|---|---|
committer | Earl Ou <shunhsingou@google.com> | 2012-12-19 21:25:48 +0800 |
commit | 07ddc8ecc8a2bcc3f16bdfb712454a91726726fe (patch) | |
tree | 3ee865dc4ba5de68c4a70eea4d16412b90f6ab91 | |
parent | 2220b0e03ec1192b39d51c70cd70340b7269c3e0 (diff) | |
download | android_packages_apps_Gallery2-07ddc8ecc8a2bcc3f16bdfb712454a91726726fe.tar.gz android_packages_apps_Gallery2-07ddc8ecc8a2bcc3f16bdfb712454a91726726fe.tar.bz2 android_packages_apps_Gallery2-07ddc8ecc8a2bcc3f16bdfb712454a91726726fe.zip |
Replace original tags when add tags in ExifTag
Change-Id: I80d1507467dcde8c8b157a120cfe9a5f5c664d0f
-rw-r--r-- | gallerycommon/src/com/android/gallery3d/exif/ExifData.java | 32 |
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 b226dd4fe..88593e651 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(); |