summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorztenghui <ztenghui@google.com>2013-06-27 15:46:39 -0700
committerztenghui <ztenghui@google.com>2013-06-28 09:25:10 -0700
commit59e60d36233f4acd67c4542bf849a0bcfce54adc (patch)
tree6fb1b7c7701530605baf4b11273fe3c62d415ca3
parent39f4ad6d7e663778d74a47c8b25768c4f221fbdc (diff)
downloadandroid_packages_apps_Snap-59e60d36233f4acd67c4542bf849a0bcfce54adc.zip
android_packages_apps_Snap-59e60d36233f4acd67c4542bf849a0bcfce54adc.tar.gz
android_packages_apps_Snap-59e60d36233f4acd67c4542bf849a0bcfce54adc.tar.bz2
Add a switch to turn on/off the aux directory saving
bug:9468909 Change-Id: Iaecda20a74a02556d883f0e97250e9ec4d856677
-rw-r--r--src/com/android/gallery3d/filtershow/tools/SaveCopyTask.java24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/com/android/gallery3d/filtershow/tools/SaveCopyTask.java b/src/com/android/gallery3d/filtershow/tools/SaveCopyTask.java
index 9e96e96..ee2ce96 100644
--- a/src/com/android/gallery3d/filtershow/tools/SaveCopyTask.java
+++ b/src/com/android/gallery3d/filtershow/tools/SaveCopyTask.java
@@ -74,6 +74,11 @@ public class SaveCopyTask extends AsyncTask<ImagePreset, Void, Uri> {
private static final String POSTFIX_JPG = ".jpg";
private static final String AUX_DIR_NAME = ".aux";
+ // When this is true, the source file will be saved into auxiliary directory
+ // and hidden from MediaStore. Otherwise, the source will be kept as the
+ // same.
+ private static final boolean USE_AUX_DIR = true;
+
private final Context mContext;
private final Uri mSourceUri;
private final Callback mCallback;
@@ -283,8 +288,12 @@ public class SaveCopyTask extends AsyncTask<ImagePreset, Void, Uri> {
// If necessary, move the source file into the auxiliary directory,
// newSourceUri is then pointing to the new location.
// If no file is moved, newSourceUri will be the same as mSourceUri.
- Uri newSourceUri = moveSrcToAuxIfNeeded(mSourceUri, mDestinationFile);
-
+ Uri newSourceUri;
+ if (USE_AUX_DIR) {
+ newSourceUri = moveSrcToAuxIfNeeded(mSourceUri, mDestinationFile);
+ } else {
+ newSourceUri = mSourceUri;
+ }
// Stopgap fix for low-memory devices.
while (noBitmap) {
try {
@@ -321,13 +330,14 @@ public class SaveCopyTask extends AsyncTask<ImagePreset, Void, Uri> {
// Since we have a new image inserted to media store, we can
// safely remove the old one which is selected by the user.
- String scheme = mSelectedImageUri.getScheme();
- if (scheme != null && scheme.equals(ContentResolver.SCHEME_CONTENT)) {
- if (mSelectedImageUri.getAuthority().equals(MediaStore.AUTHORITY)) {
- mContext.getContentResolver().delete(mSelectedImageUri, null, null);
+ if (USE_AUX_DIR) {
+ String scheme = mSelectedImageUri.getScheme();
+ if (scheme != null && scheme.equals(ContentResolver.SCHEME_CONTENT)) {
+ if (mSelectedImageUri.getAuthority().equals(MediaStore.AUTHORITY)) {
+ mContext.getContentResolver().delete(mSelectedImageUri, null, null);
+ }
}
}
-
noBitmap = false;
UsageStatistics.onEvent(UsageStatistics.COMPONENT_EDITOR,
"SaveComplete", null);