diff options
| author | Chih-Chung Chang <chihchung@google.com> | 2011-10-24 15:56:30 +0800 |
|---|---|---|
| committer | Chih-Chung Chang <chihchung@google.com> | 2011-10-24 16:28:05 +0800 |
| commit | 6caf221c4888f8632e8eb5b60b145bfca3557b3a (patch) | |
| tree | f60d42d997a2c95301916005458e39476c9e88c5 | |
| parent | 7bdf5cc3671ba866458eaa52ab41fe42bf2d7eda (diff) | |
| download | android_packages_apps_Gallery2-6caf221c4888f8632e8eb5b60b145bfca3557b3a.tar.gz android_packages_apps_Gallery2-6caf221c4888f8632e8eb5b60b145bfca3557b3a.tar.bz2 android_packages_apps_Gallery2-6caf221c4888f8632e8eb5b60b145bfca3557b3a.zip | |
Fix 5454748: Localize hardcoded folder names.
Change-Id: I91586d6f707a0352be6be524e848bd2c2dacab7e
| -rw-r--r-- | res/values/strings.xml | 14 | ||||
| -rw-r--r-- | src/com/android/gallery3d/data/LocalAlbum.java | 24 | ||||
| -rw-r--r-- | src/com/android/gallery3d/util/MediaSetUtils.java | 3 |
3 files changed, 38 insertions, 3 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 74ba1f31b..e4352f808 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -415,4 +415,18 @@ <!-- The title of menu item where user can add a new account --> <string name="add_account">Add account</string> + + <!-- The label for the folder contains pictures taken by the camera. [CHAR LIMIT=20]--> + <string name="folder_camera">Camera</string> + + <!-- The label for the folder contains downloaded pictures. [CHAR LIMIT=20]--> + <string name="folder_download">Download</string> + + <!-- The label for the folder contains pictures that was imported from an + external camera. [CHAR LIMIT=20]--> + <string name="folder_imported">Imported</string> + + <!-- The label for the folder contains screenshot images. [CHAR LIMIT=20]--> + <string name="folder_screenshot">Screenshot</string> + </resources> diff --git a/src/com/android/gallery3d/data/LocalAlbum.java b/src/com/android/gallery3d/data/LocalAlbum.java index 5bd4398b4..28364cb71 100644 --- a/src/com/android/gallery3d/data/LocalAlbum.java +++ b/src/com/android/gallery3d/data/LocalAlbum.java @@ -16,11 +16,14 @@ package com.android.gallery3d.data; +import com.android.gallery3d.R; import com.android.gallery3d.app.GalleryApp; import com.android.gallery3d.common.Utils; import com.android.gallery3d.util.GalleryUtils; +import com.android.gallery3d.util.MediaSetUtils; import android.content.ContentResolver; +import android.content.res.Resources; import android.database.Cursor; import android.net.Uri; import android.provider.MediaStore.Images; @@ -45,7 +48,7 @@ public class LocalAlbum extends MediaSet { private final GalleryApp mApplication; private final ContentResolver mResolver; private final int mBucketId; - private final String mBucketName; + private final String mName; private final boolean mIsImage; private final ChangeNotifier mNotifier; private final Path mItemPath; @@ -57,7 +60,7 @@ public class LocalAlbum extends MediaSet { mApplication = application; mResolver = application.getContentResolver(); mBucketId = bucketId; - mBucketName = name; + mName = getLocalizedName(application.getResources(), bucketId, name); mIsImage = isImage; if (isImage) { @@ -221,7 +224,7 @@ public class LocalAlbum extends MediaSet { @Override public String getName() { - return mBucketName; + return mName; } @Override @@ -249,4 +252,19 @@ public class LocalAlbum extends MediaSet { public boolean isLeafAlbum() { return true; } + + private static String getLocalizedName(Resources res, int bucketId, + String name) { + if (bucketId == MediaSetUtils.CAMERA_BUCKET_ID) { + return res.getString(R.string.folder_camera); + } else if (bucketId == MediaSetUtils.DOWNLOAD_BUCKET_ID) { + return res.getString(R.string.folder_download); + } else if (bucketId == MediaSetUtils.IMPORTED_BUCKET_ID) { + return res.getString(R.string.folder_imported); + } else if (bucketId == MediaSetUtils.SNAPSHOT_BUCKET_ID) { + return res.getString(R.string.folder_screenshot); + } else { + return name; + } + } } diff --git a/src/com/android/gallery3d/util/MediaSetUtils.java b/src/com/android/gallery3d/util/MediaSetUtils.java index 817ffedcb..8a556aa79 100644 --- a/src/com/android/gallery3d/util/MediaSetUtils.java +++ b/src/com/android/gallery3d/util/MediaSetUtils.java @@ -34,6 +34,9 @@ public class MediaSetUtils { public static final int IMPORTED_BUCKET_ID = GalleryUtils.getBucketId( Environment.getExternalStorageDirectory().toString() + "/" + MtpContext.NAME_IMPORTED_FOLDER); + public static final int SNAPSHOT_BUCKET_ID = GalleryUtils.getBucketId( + Environment.getExternalStorageDirectory().toString() + + "/Pictures/Screenshots"); private static final Path[] CAMERA_PATHS = { Path.fromString("/local/all/" + CAMERA_BUCKET_ID), |
