diff options
author | Winson Chung <winsonc@google.com> | 2011-07-25 17:10:21 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2011-07-25 17:13:31 -0700 |
commit | 753e40b1472563987489bd5b187ced4c1b608b0d (patch) | |
tree | ac7d43769acecc877125185fff1733c652ee99cb /packages/SystemUI/src/com/android/systemui/screenshot | |
parent | 895de9269fa125bf3903c21faf5e8d2750bfb000 (diff) | |
download | frameworks_base-753e40b1472563987489bd5b187ced4c1b608b0d.zip frameworks_base-753e40b1472563987489bd5b187ced4c1b608b0d.tar.gz frameworks_base-753e40b1472563987489bd5b187ced4c1b608b0d.tar.bz2 |
Using the filename as the media title for screenshots and changing filename format.
- Fixes bugs 5075366 and 5076125
Change-Id: I985be1efa8ffad7203b1bbc8d97da2d4a7156adb
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/screenshot')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index 83a5578..73f559b 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -78,7 +78,8 @@ class SaveImageInBackgroundTask extends AsyncTask<SaveImageInBackgroundData, Voi SaveImageInBackgroundData> { private static final String TAG = "SaveImageInBackgroundTask"; private static final String SCREENSHOTS_DIR_NAME = "Screenshots"; - private static final String SCREENSHOT_FILE_PATH_TEMPLATE = "%s/%s/Screenshot_%s-%d.png"; + private static final String SCREENSHOT_FILE_NAME_TEMPLATE = "Screenshot_%s.png"; + private static final String SCREENSHOT_FILE_PATH_TEMPLATE = "%s/%s/%s"; @Override protected SaveImageInBackgroundData doInBackground(SaveImageInBackgroundData... params) { @@ -89,18 +90,18 @@ class SaveImageInBackgroundTask extends AsyncTask<SaveImageInBackgroundData, Voi try{ long currentTime = System.currentTimeMillis(); - String date = new SimpleDateFormat("MM-dd-yy-kk-mm-ss").format(new Date(currentTime)); + String date = new SimpleDateFormat("yyyy-MM-dd-kk-mm-ss").format(new Date(currentTime)); String imageDir = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES).getAbsolutePath(); - String imageFilePath = String.format(SCREENSHOT_FILE_PATH_TEMPLATE, - imageDir, SCREENSHOTS_DIR_NAME, - date, currentTime % 1000); + String imageFileName = String.format(SCREENSHOT_FILE_NAME_TEMPLATE, date); + String imageFilePath = String.format(SCREENSHOT_FILE_PATH_TEMPLATE, imageDir, + SCREENSHOTS_DIR_NAME, imageFileName); // Save the screenshot to the MediaStore ContentValues values = new ContentValues(); values.put(MediaStore.Images.ImageColumns.DATA, imageFilePath); - values.put(MediaStore.Images.ImageColumns.TITLE, "Screenshot"); - values.put(MediaStore.Images.ImageColumns.DISPLAY_NAME, "Screenshot"); + values.put(MediaStore.Images.ImageColumns.TITLE, imageFileName); + values.put(MediaStore.Images.ImageColumns.DISPLAY_NAME, imageFileName); values.put(MediaStore.Images.ImageColumns.DATE_TAKEN, currentTime); values.put(MediaStore.Images.ImageColumns.DATE_ADDED, currentTime); values.put(MediaStore.Images.ImageColumns.DATE_MODIFIED, currentTime); |