am 74976b13: Do not use card effect for camera screen nail.
* commit '74976b1397fe34b212741bd92e30fa25aaec7ad8':
Do not use card effect for camera screen nail.
diff --git a/res/values/photoeditor_strings.xml b/res/values/photoeditor_strings.xml
index b282a45..2305e0b 100644
--- a/res/values/photoeditor_strings.xml
+++ b/res/values/photoeditor_strings.xml
@@ -19,16 +19,13 @@
<string name="photoeditor_name">Photo Studio</string>
<!-- Toast shown when selected photo could not be loaded. [CHAR LIMIT=40] -->
- <string name="loading_failure">Photo cannot be loaded</string>
+ <string name="loading_failure">Couldn\'t load the photo</string>
<!-- Toast shown when edited photo could not be saved. [CHAR LIMIT=40] -->
- <string name="saving_failure">Photo cannot be saved</string>
+ <string name="saving_failure">Couldn\'t save edited photo</string>
- <!-- Toast shown when edited photo is successfully saved under %s album [CHAR LIMIT=40] -->
- <string name="photo_saved">Photo saved to <xliff:g id="album_name">%s</xliff:g> album</string>
-
- <!-- Album name where edited photo will be saved in the storage. [CHAR LIMIT=12] -->
- <string name="edited_photo_bucket_name">Edited</string>
+ <!-- Toast shown when edited photo is successfully saved under %s folder [CHAR LIMIT=40] -->
+ <string name="photo_saved">Edited photo saved to <xliff:g id="folder_name">%s</xliff:g></string>
<!-- Dialog message prompted when the user is abandoning unsaved changes. [CHAR LIMIT=40] -->
<string name="save_photo">Save edited photo?</string>
@@ -133,7 +130,7 @@
<string name="flip_tooltip">Drag photo to flip it</string>
<!-- Tool-tip toast shown when the user chooses to remove red eyes. [CHAR LIMIT=40] -->
- <string name="redeye_tooltip">Tap to remove red eyes</string>
+ <string name="redeye_tooltip">Tap on red eyes to remove them</string>
<!-- Tool-tip toast shown when the user chooses to rotate photo. [CHAR LIMIT=40] -->
<string name="rotate_tooltip">Drag photo to rotate it</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e8bf0f4..3bff3ba 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -230,8 +230,9 @@
<string name="appwidget_empty_text">No photos.</string>
<!-- Toast message shown when the cropped image has been saved in the
- download folder [CHAR LIMIT=50]-->
- <string name="crop_saved">Cropped image saved to Downloads.</string>
+ %s folder (string: folder_download) [CHAR LIMIT=50]-->
+ <string name="crop_saved">
+ Cropped image saved to <xliff:g id="folder_name">%s</xliff:g>.</string>
<!-- Toast message shown when the cropped image is not saved
[CHAR LIMIT=50]-->
diff --git a/src/com/android/gallery3d/app/CropImage.java b/src/com/android/gallery3d/app/CropImage.java
index 40b357d..4fec95b 100644
--- a/src/com/android/gallery3d/app/CropImage.java
+++ b/src/com/android/gallery3d/app/CropImage.java
@@ -58,6 +58,7 @@
import com.android.gallery3d.ui.GLRoot;
import com.android.gallery3d.ui.SynchronizedHandler;
import com.android.gallery3d.ui.TileImageViewAdapter;
+import com.android.gallery3d.util.BucketNames;
import com.android.gallery3d.util.Future;
import com.android.gallery3d.util.FutureListener;
import com.android.gallery3d.util.GalleryUtils;
@@ -120,9 +121,8 @@
private static final int STATE_LOADED = 1;
private static final int STATE_SAVING = 2;
- public static final String DOWNLOAD_STRING = "download";
public static final File DOWNLOAD_BUCKET = new File(
- Environment.getExternalStorageDirectory(), DOWNLOAD_STRING);
+ Environment.getExternalStorageDirectory(), BucketNames.DOWNLOAD);
public static final String CROP_ACTION = "com.android.camera.action.CROP";
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index add175e..1169729 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -587,11 +587,12 @@
}
break;
case REQUEST_CROP_PICASA: {
- int message = resultCode == Activity.RESULT_OK
- ? R.string.crop_saved
- : R.string.crop_not_saved;
- Toast.makeText(mActivity.getAndroidContext(),
- message, Toast.LENGTH_SHORT).show();
+ Context context = mActivity.getAndroidContext();
+ // TODO: Use crop_saved instead of photo_saved after its new translation is done.
+ String message = resultCode == Activity.RESULT_OK ? context.getString(
+ R.string.photo_saved, context.getString(R.string.folder_download))
+ : context.getString(R.string.crop_not_saved);
+ Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
break;
}
case REQUEST_SLIDESHOW: {
diff --git a/src/com/android/gallery3d/data/MtpContext.java b/src/com/android/gallery3d/data/MtpContext.java
index ee5cf7e..0749020 100644
--- a/src/com/android/gallery3d/data/MtpContext.java
+++ b/src/com/android/gallery3d/data/MtpContext.java
@@ -10,6 +10,7 @@
import android.widget.Toast;
import com.android.gallery3d.R;
+import com.android.gallery3d.util.BucketNames;
import com.android.gallery3d.util.GalleryUtils;
import java.io.File;
@@ -19,8 +20,6 @@
public class MtpContext implements MtpClient.Listener {
private static final String TAG = "MtpContext";
- public static final String NAME_IMPORTED_FOLDER = "Imported";
-
private ScannerClient mScannerClient;
private Context mContext;
private MtpClient mClient;
@@ -104,7 +103,7 @@
public boolean copyFile(String deviceName, MtpObjectInfo objInfo) {
if (GalleryUtils.hasSpaceForSize(objInfo.getCompressedSize())) {
File dest = Environment.getExternalStorageDirectory();
- dest = new File(dest, NAME_IMPORTED_FOLDER);
+ dest = new File(dest, BucketNames.IMPORTED);
dest.mkdirs();
String destPath = new File(dest, objInfo.getName()).getAbsolutePath();
int objectId = objInfo.getObjectHandle();
diff --git a/src/com/android/gallery3d/photoeditor/SaveCopyTask.java b/src/com/android/gallery3d/photoeditor/SaveCopyTask.java
index 6b7b7c3..1b59292 100644
--- a/src/com/android/gallery3d/photoeditor/SaveCopyTask.java
+++ b/src/com/android/gallery3d/photoeditor/SaveCopyTask.java
@@ -30,6 +30,7 @@
import android.widget.Toast;
import com.android.gallery3d.R;
+import com.android.gallery3d.util.BucketNames;
import java.io.File;
import java.sql.Date;
@@ -59,7 +60,7 @@
private final Uri sourceUri;
private final Callback callback;
private final String saveFileName;
- private File saveDirectory;
+ private String saveFolderName;
public SaveCopyTask(Context context, Uri sourceUri, Callback callback) {
this.context = context;
@@ -79,8 +80,17 @@
if (params[0] == null) {
return null;
}
+ // Use the default save directory if the source directory cannot be saved.
+ File saveDirectory = getSaveDirectory();
+ if ((saveDirectory == null) || !saveDirectory.canWrite()) {
+ saveDirectory = new File(Environment.getExternalStorageDirectory(),
+ BucketNames.DOWNLOAD);
+ saveFolderName = context.getString(R.string.folder_download);
+ } else {
+ saveFolderName = saveDirectory.getName();
+ }
+
Bitmap bitmap = params[0];
- getSaveDirectory();
File file = new BitmapUtils(context).saveBitmap(
bitmap, saveDirectory, saveFileName, Bitmap.CompressFormat.JPEG);
Uri uri = (file != null) ? insertContent(file) : null;
@@ -91,7 +101,7 @@
@Override
protected void onPostExecute(Uri result) {
String message = (result == null) ? context.getString(R.string.saving_failure)
- : context.getString(R.string.photo_saved, saveDirectory.getName());
+ : context.getString(R.string.photo_saved, saveFolderName);
Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
@@ -116,19 +126,16 @@
}
}
- private void getSaveDirectory() {
+ private File getSaveDirectory() {
+ final File[] dir = new File[1];
querySource(new String[] { ImageColumns.DATA }, new ContentResolverQueryCallback () {
@Override
public void onCursorResult(Cursor cursor) {
- saveDirectory = new File(cursor.getString(0)).getParentFile();
+ dir[0] = new File(cursor.getString(0)).getParentFile();
}
});
- // Use the default save directory if the source directory cannot be saved.
- if ((saveDirectory == null) || !saveDirectory.canWrite()) {
- saveDirectory = new File(Environment.getExternalStorageDirectory(),
- context.getString(R.string.edited_photo_bucket_name));
- }
+ return dir[0];
}
/**
diff --git a/src/com/android/gallery3d/util/BucketNames.java b/src/com/android/gallery3d/util/BucketNames.java
new file mode 100644
index 0000000..043dd3d
--- /dev/null
+++ b/src/com/android/gallery3d/util/BucketNames.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gallery3d.util;
+
+/**
+ * Bucket names for buckets that are created and used in the Gallery.
+ */
+public class BucketNames {
+
+ public static final String IMPORTED = "Imported";
+ public static final String DOWNLOAD = "download";
+}
diff --git a/src/com/android/gallery3d/util/MediaSetUtils.java b/src/com/android/gallery3d/util/MediaSetUtils.java
index 8e60f59..3bb3f8b 100644
--- a/src/com/android/gallery3d/util/MediaSetUtils.java
+++ b/src/com/android/gallery3d/util/MediaSetUtils.java
@@ -19,7 +19,6 @@
import android.os.Environment;
import com.android.gallery3d.data.MediaSet;
-import com.android.gallery3d.data.MtpContext;
import com.android.gallery3d.data.Path;
import java.util.Comparator;
@@ -30,10 +29,11 @@
public static final int CAMERA_BUCKET_ID = GalleryUtils.getBucketId(
Environment.getExternalStorageDirectory().toString() + "/DCIM/Camera");
public static final int DOWNLOAD_BUCKET_ID = GalleryUtils.getBucketId(
- Environment.getExternalStorageDirectory().toString() + "/download");
+ Environment.getExternalStorageDirectory().toString() + "/"
+ + BucketNames.DOWNLOAD);
public static final int IMPORTED_BUCKET_ID = GalleryUtils.getBucketId(
Environment.getExternalStorageDirectory().toString() + "/"
- + MtpContext.NAME_IMPORTED_FOLDER);
+ + BucketNames.IMPORTED);
public static final int SNAPSHOT_BUCKET_ID = GalleryUtils.getBucketId(
Environment.getExternalStorageDirectory().toString() +
"/Pictures/Screenshots");