summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlamefire <alex@grundis.de>2014-09-17 02:40:04 +0200
committerSteve Kondik <steve@cyngn.com>2015-03-28 14:58:54 -0700
commita1ad934b563bbd5ddc68b5e9caf460975caa34a0 (patch)
treec55991dcdc8bf58ec6cb014b4eb0d6a499c837c8 /src
parentbc5f6cc1c376878786dd70042a9e0f8c18c3723a (diff)
downloadandroid_packages_apps_Gallery2-a1ad934b563bbd5ddc68b5e9caf460975caa34a0.zip
android_packages_apps_Gallery2-a1ad934b563bbd5ddc68b5e9caf460975caa34a0.tar.gz
android_packages_apps_Gallery2-a1ad934b563bbd5ddc68b5e9caf460975caa34a0.tar.bz2
Add record time to details view
PS2: Move strings PS3: Move DateTime format to public in ExifInterface PS4: Actually use that DateTime format Change-Id: If30e19d0b79039357f393752544c655e073a46d2
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/data/MediaDetails.java29
-rw-r--r--src/com/android/gallery3d/ui/DetailsHelper.java2
-rw-r--r--src/com/android/gallery3d/ui/DialogDetailsView.java16
3 files changed, 34 insertions, 13 deletions
diff --git a/src/com/android/gallery3d/data/MediaDetails.java b/src/com/android/gallery3d/data/MediaDetails.java
index cac524b..2252660 100644
--- a/src/com/android/gallery3d/data/MediaDetails.java
+++ b/src/com/android/gallery3d/data/MediaDetails.java
@@ -17,15 +17,11 @@
package com.android.gallery3d.data;
import com.android.gallery3d.R;
-import com.android.gallery3d.common.Utils;
import com.android.gallery3d.exif.ExifInterface;
import com.android.gallery3d.exif.ExifTag;
-import com.android.gallery3d.exif.Rational;
-import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
@@ -50,15 +46,16 @@ public class MediaDetails implements Iterable<Entry<Integer, Object>> {
public static final int INDEX_SIZE = 10;
// for EXIF
- public static final int INDEX_MAKE = 100;
- public static final int INDEX_MODEL = 101;
- public static final int INDEX_FLASH = 102;
- public static final int INDEX_FOCAL_LENGTH = 103;
- public static final int INDEX_WHITE_BALANCE = 104;
- public static final int INDEX_APERTURE = 105;
- public static final int INDEX_SHUTTER_SPEED = 106;
- public static final int INDEX_EXPOSURE_TIME = 107;
- public static final int INDEX_ISO = 108;
+ public static final int INDEX_DATETIME_ORIGINAL = 100;
+ public static final int INDEX_MAKE = 101;
+ public static final int INDEX_MODEL = 102;
+ public static final int INDEX_FLASH = 103;
+ public static final int INDEX_FOCAL_LENGTH = 104;
+ public static final int INDEX_WHITE_BALANCE = 105;
+ public static final int INDEX_APERTURE = 106;
+ public static final int INDEX_SHUTTER_SPEED = 107;
+ public static final int INDEX_EXPOSURE_TIME = 108;
+ public static final int INDEX_ISO = 109;
// Put this last because it may be long.
public static final int INDEX_PATH = 200;
@@ -148,6 +145,12 @@ public class MediaDetails implements Iterable<Entry<Integer, Object>> {
MediaDetails.INDEX_WIDTH);
setExifData(details, exif.getTag(ExifInterface.TAG_IMAGE_LENGTH),
MediaDetails.INDEX_HEIGHT);
+ ExifTag recordTag = exif.getTag(ExifInterface.TAG_DATE_TIME_ORIGINAL);
+ if (recordTag == null)
+ recordTag = exif.getTag(ExifInterface.TAG_DATE_TIME_DIGITIZED);
+ if (recordTag == null)
+ recordTag = exif.getTag(ExifInterface.TAG_DATE_TIME);
+ setExifData(details, recordTag, MediaDetails.INDEX_DATETIME_ORIGINAL);
setExifData(details, exif.getTag(ExifInterface.TAG_MAKE),
MediaDetails.INDEX_MAKE);
setExifData(details, exif.getTag(ExifInterface.TAG_MODEL),
diff --git a/src/com/android/gallery3d/ui/DetailsHelper.java b/src/com/android/gallery3d/ui/DetailsHelper.java
index 47296f6..4f61040 100644
--- a/src/com/android/gallery3d/ui/DetailsHelper.java
+++ b/src/com/android/gallery3d/ui/DetailsHelper.java
@@ -139,6 +139,8 @@ public class DetailsHelper {
return context.getString(R.string.exposure_time);
case MediaDetails.INDEX_ISO:
return context.getString(R.string.iso);
+ case MediaDetails.INDEX_DATETIME_ORIGINAL:
+ return context.getString(R.string.record_time);
default:
return "Unknown key" + key;
}
diff --git a/src/com/android/gallery3d/ui/DialogDetailsView.java b/src/com/android/gallery3d/ui/DialogDetailsView.java
index 2693410..3e2af0d 100644
--- a/src/com/android/gallery3d/ui/DialogDetailsView.java
+++ b/src/com/android/gallery3d/ui/DialogDetailsView.java
@@ -34,14 +34,18 @@ import com.android.gallery3d.R;
import com.android.gallery3d.app.AbstractGalleryActivity;
import com.android.gallery3d.common.Utils;
import com.android.gallery3d.data.MediaDetails;
+import com.android.gallery3d.exif.ExifInterface;
import com.android.gallery3d.ui.DetailsAddressResolver.AddressResolvingListener;
import com.android.gallery3d.ui.DetailsHelper.CloseListener;
import com.android.gallery3d.ui.DetailsHelper.DetailsSource;
import com.android.gallery3d.ui.DetailsHelper.DetailsViewContainer;
import com.android.gallery3d.ui.DetailsHelper.ResolutionResolvingListener;
+import java.text.DateFormat;
import java.text.DecimalFormat;
+import java.text.ParseException;
import java.util.ArrayList;
+import java.util.Date;
import java.util.Locale;
import java.util.Map.Entry;
@@ -132,6 +136,15 @@ public class DialogDetailsView implements DetailsViewContainer {
setDetails(context, details);
}
+ private String exifDateToFormatedDate(String exifDt) {
+ try {
+ Date date = ExifInterface.DATETIME_FORMAT.parse(exifDt);
+ return DateFormat.getDateTimeInstance().format(date);
+ } catch (ParseException e) {
+ return exifDt;
+ }
+ }
+
private void setDetails(Context context, MediaDetails details) {
boolean resolutionIsValid = true;
String path = null;
@@ -222,6 +235,9 @@ public class DialogDetailsView implements DetailsViewContainer {
case MediaDetails.INDEX_ORIENTATION:
value = toLocalInteger(detail.getValue());
break;
+ case MediaDetails.INDEX_DATETIME_ORIGINAL:
+ value = exifDateToFormatedDate(detail.getValue().toString());
+ break;
default: {
Object valueObj = detail.getValue();
// This shouldn't happen, log its key to help us diagnose the problem.