diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2012-10-24 15:08:59 -0700 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2012-10-24 15:15:30 -0700 |
commit | 19a8eac2eb19c02e62d0881b8b6fd9cface43b4d (patch) | |
tree | caf59eef988323de9fd7e3b40489174ba709ebcf /src/com/android/gallery3d/app | |
parent | 30cea9fd7d02cffe4a15c58a61fa823fee29db42 (diff) | |
download | android_packages_apps_Snap-19a8eac2eb19c02e62d0881b8b6fd9cface43b4d.tar.gz android_packages_apps_Snap-19a8eac2eb19c02e62d0881b8b6fd9cface43b4d.tar.bz2 android_packages_apps_Snap-19a8eac2eb19c02e62d0881b8b6fd9cface43b4d.zip |
Initialize the modified date correctly.
On top of that, the date_taken is in units of seconds, while others are in
units of milliseconds.
bug:7307090
Change-Id: I3f14a6354fa72a20d228d49a92d5c2007ca29df1
Diffstat (limited to 'src/com/android/gallery3d/app')
-rw-r--r-- | src/com/android/gallery3d/app/TrimVideo.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/com/android/gallery3d/app/TrimVideo.java b/src/com/android/gallery3d/app/TrimVideo.java index 01fe462c2..38b403b10 100644 --- a/src/com/android/gallery3d/app/TrimVideo.java +++ b/src/com/android/gallery3d/app/TrimVideo.java @@ -342,15 +342,15 @@ public class TrimVideo extends Activity implements * Insert the content (saved file) with proper video properties. */ private Uri insertContent(File file) { - long now = System.currentTimeMillis() / 1000; - + long nowInMs = System.currentTimeMillis(); + long nowInSec = nowInMs / 1000; final ContentValues values = new ContentValues(12); values.put(Video.Media.TITLE, mSaveFileName); values.put(Video.Media.DISPLAY_NAME, file.getName()); values.put(Video.Media.MIME_TYPE, "video/mp4"); - values.put(Video.Media.DATE_TAKEN, now); - values.put(Video.Media.DATE_MODIFIED, now); - values.put(Video.Media.DATE_ADDED, now); + values.put(Video.Media.DATE_TAKEN, nowInMs); + values.put(Video.Media.DATE_MODIFIED, nowInSec); + values.put(Video.Media.DATE_ADDED, nowInSec); values.put(Video.Media.DATA, file.getAbsolutePath()); values.put(Video.Media.SIZE, file.length()); // Copy the data taken and location info from src. @@ -365,7 +365,10 @@ public class TrimVideo extends Activity implements querySource(projection, new ContentResolverQueryCallback() { @Override public void onCursorResult(Cursor cursor) { - values.put(Video.Media.DATE_TAKEN, cursor.getLong(0)); + long timeTaken = cursor.getLong(0); + if (timeTaken > 0) { + values.put(Video.Media.DATE_TAKEN, timeTaken); + } double latitude = cursor.getDouble(1); double longitude = cursor.getDouble(2); // TODO: Change || to && after the default location issue is |