Path path = mApplication.getDataManager()
.findPathByUri(intent.getData(), intent.getType());
if (path != null) {
+ Path albumPath = mApplication.getDataManager().getDefaultSetOf(path);
+ if (!albumPath.equalsIgnoreCase(mOriginalSetPathString)) {
+ // If the edited image is stored in a different album, we need
+ // to start a new activity state to show the new image
+ Bundle data = new Bundle(getData());
+ data.putString(KEY_MEDIA_SET_PATH, albumPath.toString());
+ data.putString(PhotoPage.KEY_MEDIA_ITEM_PATH, path.toString());
+ mActivity.getStateManager().startState(PhotoPage.class, data);
+ return;
+ }
mModel.setCurrentPhoto(path, mCurrentIndex);
}
}
return true;
}
- private static String getLocalizedName(Resources res, int bucketId,
+ public static String getLocalizedName(Resources res, int bucketId,
String name) {
if (bucketId == MediaSetUtils.CAMERA_BUCKET_ID) {
return res.getString(R.string.folder_camera);
return res.getString(R.string.folder_imported);
} else if (bucketId == MediaSetUtils.SNAPSHOT_BUCKET_ID) {
return res.getString(R.string.folder_screenshot);
+ } else if (bucketId == MediaSetUtils.EDITED_ONLINE_PHOTOS_BUCKET_ID) {
+ return res.getString(R.string.folder_edited_online_photos);
} else {
return name;
}
}
@Override
+ // TODO: toString() should be more efficient, will fix it later
public String toString() {
synchronized (Path.class) {
StringBuilder sb = new StringBuilder();
}
}
+ public boolean equalsIgnoreCase (String p) {
+ String path = toString();
+ return path.equalsIgnoreCase(p);
+ }
+
public static Path fromString(String s) {
synchronized (Path.class) {
String[] segments = split(s);
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.ContentValues;
+import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.widget.Toast;
import com.android.gallery3d.R;
+import com.android.gallery3d.data.LocalAlbum;
import com.android.gallery3d.filtershow.cache.ImageLoader;
import com.android.gallery3d.filtershow.filters.ImageFilter;
import com.android.gallery3d.filtershow.filters.ImageFilterBorder;
import com.android.gallery3d.filtershow.ui.ImageButtonTitle;
import com.android.gallery3d.filtershow.ui.ImageCurves;
import com.android.gallery3d.filtershow.ui.Spline;
+import com.android.gallery3d.util.GalleryUtils;
import java.io.File;
import java.lang.ref.WeakReference;
return (133 * msize) / metrics.densityDpi;
}
- private void showSavingProgress() {
+ private void showSavingProgress(String albumName) {
ProgressDialog progress;
if (mSavingProgressDialog != null) {
progress = mSavingProgressDialog.get();
}
}
// TODO: Allow cancellation of the saving process
- progress = ProgressDialog.show(this, "", getString(R.string.saving_image), true, false);
+ String progressText;
+ if (albumName == null) {
+ progressText = getString(R.string.saving_image);
+ } else {
+ progressText = getString(R.string.filtershow_saving_image, albumName);
+ }
+ progress = ProgressDialog.show(this, "", progressText, true, false);
mSavingProgressDialog = new WeakReference<ProgressDialog>(progress);
}
mSharingImage = true;
// Process and save the image in the background.
- showSavingProgress();
+ showSavingProgress(null);
mImageShow.saveImage(this, mSharedOutputFile);
return true;
}
public void saveImage() {
if (mImageShow.hasModifications()) {
- showSavingProgress();
+ // Get the name of the album, to which the image will be saved
+ File saveDir = SaveCopyTask.getFinalSaveDirectory(this, mImageLoader.getUri());
+ int bucketId = GalleryUtils.getBucketId(saveDir.getPath());
+ String albumName = LocalAlbum.getLocalizedName(getResources(), bucketId, null);
+ showSavingProgress(albumName);
mImageShow.saveImage(this, null);
} else {
finish();
import android.view.Gravity;
import android.widget.Toast;
+import com.android.camera.R;
import com.android.gallery3d.filtershow.presets.ImagePreset;
//import com.android.gallery3d.R;
*/
public class SaveCopyTask extends AsyncTask<ProcessedBitmap, Void, Uri> {
- public static final String DOWNLOAD = "download";
- public static final String DEFAULT_SAVE_DIRECTORY = "Download";
private static final int DEFAULT_COMPRESS_QUALITY = 95;
+ private static final String DEFAULT_SAVE_DIRECTORY = "EditedOnlinePhotos";
/**
* Saves the bitmap in the final destination
System.currentTimeMillis()));
}
- public static File getNewFile(Context context, Uri sourceUri) {
+ public static File getFinalSaveDirectory(Context context, Uri sourceUri) {
File saveDirectory = getSaveDirectory(context, sourceUri);
if ((saveDirectory == null) || !saveDirectory.canWrite()) {
saveDirectory = new File(Environment.getExternalStorageDirectory(),
- DOWNLOAD);
+ DEFAULT_SAVE_DIRECTORY);
}
+ return saveDirectory;
+ }
+ public static File getNewFile(Context context, Uri sourceUri) {
+ File saveDirectory = getFinalSaveDirectory(context, sourceUri);
String filename = new SimpleDateFormat(TIME_STAMP_NAME).format(new Date(
System.currentTimeMillis()));
return new File(saveDirectory, filename + ".JPG");
public static final String IMPORTED = "Imported";
public static final String DOWNLOAD = "download";
+ public static final String EDITED_ONLINE_PHOTOS = "EditedOnlinePhotos";
}
public static final int DOWNLOAD_BUCKET_ID = GalleryUtils.getBucketId(
Environment.getExternalStorageDirectory().toString() + "/"
+ BucketNames.DOWNLOAD);
+ public static final int EDITED_ONLINE_PHOTOS_BUCKET_ID = GalleryUtils.getBucketId(
+ Environment.getExternalStorageDirectory().toString() + "/"
+ + BucketNames.EDITED_ONLINE_PHOTOS);
public static final int IMPORTED_BUCKET_ID = GalleryUtils.getBucketId(
Environment.getExternalStorageDirectory().toString() + "/"
+ BucketNames.IMPORTED);